jQuery – Click Through Div / Element to Underlying Element

Although I would much rather tell you to rewrite your code to get this working properly, there are ways around it. If you’ve ever finished writing your markup and ended up with an overlaying div or other element and noticed that your links/click events are no longer working, there is an elegant solution that is cross-browser compatible! Using jQuery, we are going to hide the element in question, send a click() trigger, and then show that element again. <!–more–>

$('.your-element').click(function(e){
    var l = $(window).scrollLeft();
    var t = $(window).scrollTop();

    //here we hide our element in question
    $(this).css('display','none');
    //cause click even to underlying element.
    $(document.elementFromPoint(e.pageX-left, e.pageY-top)).click();
    $(this).css('display','block');
});

Some CSS to go along with it, keeping the Pointer.

.your-element { cursor:pointer; position:absolute; width:100%; display:block; }
.your-element .sub-element { display:block; width:auto; }
Posted in CSS, jQuery

PHP Dynamic Copyright Date – Echo the Year

Just a short update today – a way to dynamically output the year with PHP, so your site always stays updated! One less thing to worry about. This will output in a format, say “© 2010 – 2012 My awesome company.”

<?php
echo "&copy;";
$startYear = 2012;  
$currentYear = date('Y');  
echo $startYear . (($startYear != $currentYear) ? '-' . $currentYear : ''); 
echo " Your Company, Inc, LLC, GmbH, LTD, ... you get the drift.";
?>
Posted in PHP

Windows Phone 8 SDK Images First Look

Images of the new Windows Phone 8 SDK are out! Some of the outlined features have been shown:
Text message backup to SkyDrive
•Office 2013 for Windows Phone
•Photo options
•New Accent colors
•Lock screen options
•Phone storage (+ SD card support)
•App list + setting backup feature
•Microsoft Account
•Voice Command options
•Xbox Music

Visit http://www.wpcentral.com/trove-windows-phone-8-sdk-images-show-exposing-app-backup to see a ton of features coming.

Posted in HTML5, Windows Phone 8

Magento 1.7 Released with Tons of Improvements!

Just a quick update here! If you haven’t already seen the gigantic list of additions, improvements, and fixes in Magento 1.7 (Community Edition, EE was also updated), you should! Some of my favorite updates:
– Auto Generation of Coupon Codes
– CAPTCHA support for both admin and customer users
– Different base prices for different customer groups!
More past the break.
Continue reading “Magento 1.7 Released with Tons of Improvements!” »

Posted in Magento, Magento Enterprise, Magento Fixes, Mobile Development, PHP

Moving the Magento Breadcrumbs

The breadcrumbs in Magento’s default layout are fairly well placed, but lets say you want to move them to the header.phtml file? How do you go about moving it, because you cannot simply cut the

<?php echo $this->getChildHtml('breadcrumbsContainer') ?>

out of the page template and move it.

Very simple here, remove that default call (obviously), and place this line of code where you’d like the new breadcrumb navigation to go!

<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml(); ?> 
Posted in Magento, Magento Enterprise, Magento Fixes, Magento Professional, PHP

Magento – Delete Products Programmatically

In a previous post, I showed how to delete products in the Magento catalog using the SOAP API. In this post, we’ll be using a simple method using our Mage class, and removing products via the Magento Mage calls. Using this will result in removal of every product in your Magento catalog, so be careful! Be sure to modify the store call as well if you have multiple storefronts with different products. Onward!
Continue reading “Magento – Delete Products Programmatically” »

Posted in Magento, Magento Enterprise, Magento Fixes, Magento Professional, PHP

Magento – Delete Products using SOAP API

Deleted Magento Products via API

A question was posted in the comments section regarding deleting every product in the Magento Catalog without manually removing them via the Magento admin, so I wrote up a quick script using the Magento SOAP API. It’s not the fastest method, and if you’d like to see a quicker way using the Mage class, see this post here – Magento: Delete Products Programmatically.
Continue reading “Magento – Delete Products using SOAP API” »

Posted in Magento, Magento Enterprise, Magento Fixes, Magento Professional, PHP

Magento – Link to Base URL within Static Blocks and PHP

An extremely useful call in Magento is the ability to link to your base URL, without having to do hard-coded links, such as “/contact-us” or something similar. I’ll display two ways to do this – one way is to link to your store’s base url within static blocks, and one way is to do it within your PHP code (which cannot be used in Static Blocks).

Continue reading “Magento – Link to Base URL within Static Blocks and PHP” »

Posted in PHP

How to Fix Magento Product Flat Data Index Stuck on Processing

Magento Product Flat Data Index Processing

If you’ve ever gone in to re-index your Product Flat Data index, and noticed that the orange Processing… status icon won’t go away, you are not alone! It’s quite a common problem, especially for those that have backed-up and restored any piece of the Magento database, especially anything relating to emptying or truncating the product tables to remove all products in Magento and reset product IDs to 0. Luckily, there’s *usually* a simple fix!
Continue reading “How to Fix Magento Product Flat Data Index Stuck on Processing” »

Posted in Magento, Magento Enterprise, Magento Fixes, Magento Professional, MySQL

Magento – Change Default Product Quantity to 1

Magento Default Quantity to 1

A very short and simple update today! I get asked alot if there’s an easy way to update Magento’s default 0 Quantity setting on the product pages, and the answer is yes (past 1.4 at least)! To do so, simply log in, head to System -> configuration -> Catalog (Inventory) menu on the left side. On your new page options that load here, look for “Minimum Qty Allowed in Shopping Cart”, click the “Add Minimum Qty” button, select “ALL GROUPS” under Customer group, and place a “1” in the Minimum Qty field. Save Config, and voila! No more 0 Quantites on *any* product (bundles without selected defaults may still default to 0).

Short and sweet! Image screenshot after the break.
Continue reading “Magento – Change Default Product Quantity to 1” »

Posted in Magento, Magento Enterprise, Magento Professional