Magento themes and extensions

Magento: Display Only If There Are Products In The Category

Posted on June 3rd, 2011 | Posted by admin

This is a more difficult post to title – but I think that should do it. Here was my need today: We’ve got some navigational links in the header, and there are two categories “Sale Items” and “Internet Only” that should show up as links ONLY if there are products in those categories – otherwise, they shouldn’t be there (no need to have a link to a category with no products in it).

The Solution

There’s a quick’n’easy code line that you can pass in a category id to, and it will return how many products are in that category:


So – I got the category IDs from the admin and I created the following code to check the count – and display the link only if there are products in that category:

    $sale_count = Mage::getModel('catalog/category')->load(198)->getProductCount();
    if ($sale_count > 0) : ?>
        <li><a href="/sale/">Sale Items</a></li>
    $internet_count = Mage::getModel('catalog/category')->load(200)->getProductCount();
    if ($internet_count > 0) : ?>
        <li><a href="/internet-only/">Internet Only</a></li>

Hopefully you can find that useful if you need it!


Magento Admin Grid: how to change number of rows

Posted on June 2nd, 2011 | Posted by admin

We had a request from our client, that we change default number of items in Magento admin grid. Now, this is very simple, when we know how to change it. Below you can see an example which uses magento observer model and event hocking “core_block_abstract_prepare_layout_before”.

First of all, make backup copies of your files.

Step 1.
This is example of event hocking, put it in config.xml

Magento FirePHP extension

Posted on June 2nd, 2011 | Posted by admin

FirePHP is Firefox add-on that enables you to log to your Firebug Console, which makes it great debugging tool for any web developer. I’m using it, like it and can’t live without it for some time now ;) So here’s nicely packed Magento FirePHP extension, I believe you’ll be seeing it at Magento Connect in a while.

You can get it via file: or even better, use Magento FirePHP Extension on Magento Connect.

Since FirePHP is implemented in Zend Framework it’s really easy to use it with Magento, my friend Branko wrote about it before.

Download FirePHP from its homepage You must have Firebug installed and the “Net” panel enabled to use it, and Firefox of course.

Magento: Custom Page Templates in CMS Layout Dropdown

Posted on June 2nd, 2011 | Posted by admin

Creating new page templates is as easy as duplicating and editing the files in /template/page/. However, you can add as many new ones as you want, but no new ones will show up in the Layout dropdown when selecting a template to use for a specific CMS page.

The solution: Create your own simple module to add your templates. This should only take you 5 minutes if you know what you are doing with custom modules.

Step 1: Create Your Module Config File

Create this file: /app/code/local/YOURMODS/CmsTemplates/etc/config.xml and put the following code in, modifying it to suit your templates:

Demystifying the Demystifying of the Duplicate Content Penalty in Magento

Posted on May 31st, 2011 | Posted by admin

Almost a year ago, I wrote about duplicate content issues with Magento. Since then, people have often been referring to Roy’s thread at Magento forums that quotes Google’s official blog.

This is what the quote says:

Having duplicate content can affect your site in a variety of ways; but unless you’ve been duplicating deliberately, it’s unlikely that one of those ways will be a penalty. This means that:

* You typically don’t need to submit a reconsideration request when you’re cleaning up innocently duplicated content.
* If you’re a webmaster of beginner-to-intermediate savviness, you probably don’t need to put too much energy into worrying about duplicate content, since most search engines have ways of handling it.
* You can help your fellow webmasters by not perpetuating the myth of duplicate content penalties! The remedies for duplicate content are entirely within your control. Here are some good places to start.

We (SEO professionals) do understand that in this case there is no penalty for having duplicate content.

The problem is: Google doesn’t have to enforce any penalty, duplicate content is bad for you by default.

It’s actually pretty logical, let me explain:

You have a product page that can be reached via two different categories, which would create two different URLs with identical content:


Your store is sending the link juice (the PageRank value) to two of these URLs. If you only had one instead, it would receive double the amount of link juice.

Now imagine what happens if you have multiple products in multiple categories all over your store. How much link juice are you actually throwing away? A lot.

Different URLs when product is listed in multiple categories is just one of the cases in which Magento serves almost identical content on two different URLs. This is why Magento is not really on-site SEO perfect out of the box and you need someone to “make it right”.

In the recent release of Magento, there have been some on-site SEO improvements with the default theme, so I can see Magento team is working hard on getting Magento on-site SEO perfect.

Please note that Magento is not “bad” or “terrible” in on-site SEO, as the matter of fact, most of the other open source e-commerce solutions have much bigger SEO problems out of the box. We’re just trying to reach perfection here, and that’s why we advise you to solve the duplicate content problems at your Magento store.


Page 31 of 49« First...1020«2930313233»40...Last »