Code Archive

Expand/Collapse Layered Navigation Categories

If your site has a lot of categories and/or sub-categories, your layered navigation “Shopping Options” block can get pretty large. An option is to make each category collapse or expand thereby saving valuable real estate on your page. The method is pretty straight-forword. 1. Copy/Backup app/design/frontend/default/YOURTHEME/template/catalog/layer/view.phtml 2. In your new copy, make the following changes

‘Please make sure your passwords match’ – Error in 1.9

If you’ve recently installed/upgraded to Magento 1.9, you may be receiving and error when a customer tries to register a new account. Changing one line of code should fix your situation – COPY: app/code/core/Mage/Customer/Model/Customer.php TO: app/code/local/Mage/Customer/Model/Customer.php In your LOCAL copy, make the following change around line 844 (comment out the $confirmation line and replace with

Remove a Specific Image from all Cache Directories

I’ve had instances where I’ve updated a specific image yet wanted to keep the same image name etc. If you upload the image via the admin panel, it will append a “_1” to the file name thereby creating a whole new image. The code below will delete the specific image (or images) from every cache

Create a Zip file of your active images

Here’s a straight-forward and fast way to backup all your images for active items into a zip file that can be downloaded or ftp’d to another site. Another advantage of this methodology is it will also report on any “broken” images you may have (image doesn’t exist even though it’s defined in the product file)

ReCreate Foreign Keys in a shared host

I had noticed that every now and then it looked like some foreign key constraints were missing, so I did a comparison to a v1.7 fresh install to determine which tables had missing foreign key constraints. Doing some research, I located a great script that does all the work. The script can be located here (Charles

Fix “Notice: Undefined property:” in PayPal Advanced

While reviewing your system logs, you may see a “Notice: Undefined property” message if you’re using Magento with PayPal’s advanced payment methods. The message would be something like this:

Create a ‘Free Shipping’ Image Overlay

This post is for creating a ‘free shipping’ image overlay in the product list pages but the same methods would apply to any other callouts you’d find appropriate, such as ‘reduced’, ‘sale’, ‘special’, ‘new’. It’s all determined by what attributes you use and how they’re set. (This assumes you have an attribute called ‘free_shipping’ and

Convert an attribute to a link

In the “additional information” section of the product view page, I had removed the “N/A” attributes (see post) but then I decided that it would be nice to have a few of the additional attributes such as manufacturer and classification as links to the product search page to help customers search. The change is pretty

Remove Search Auto Complete

I’ve never been a big fan of the search auto complete because it usually produces inaccurate results and sometimes leads the user to click on a suggested term that may not be exactly what they were looking for. Commenting out one single line in your template is all that’s needed to remove the functionality. OPEN:

catalog_product_flat_1 has wrong url_path

While reviewing the google merchant center dashboard, I’d notice every now and then that there would be errors listed as ‘wrong url’.  At first, there were only a few skus, so I simply ignored the issue until each week there’d be more and more skus listed. Doing some research into it, the google feed file