I recently added rich snippets to the product detail page for simple and configurable.
But now I'm asking myself if it was right to add the meta datas at the end of the templates.

How do you solved this in your projects?

I first tried to set the meta tags outside my template or with other words at the top of my layout.
But then I had to struggle with all product details.

  • How do I know if the product is a simple or configurable?
  • How do I know if the product has related products?

To solve this I need a new template and a new block to make all the queries I have to do when I enter the product detail page.
But at that point I guess it is much easier to create a module.


You can get the current product object by the following code.


Use this code in any of your file inside the product view page.

To check product type

$currentProduct = Mage::registry('current_product');
$currentProduct->getTypeId(); //return simple, configurable,..

To check related product


This will return related product ids of currency product.

  • I hope it is not to early to mark this answer as perfect ... but it sounds perfect to me. So it seems that it isn't too hard to create a module for rich snippets that maybe hold all microdata information e.g. in the HEAD-TAG e.g. as JSON? – Timo.Klement Aug 11 '15 at 6:32

I used to add all itemprop attributes in my templates, but in the end, you'll have to edit a whole bunch of templates.

I'm currently looking into developing an extension, which adds the rich snippets via JSON-LD. The idea is that you can install the extension in your webshop and it will just add a JSON block in the footer (or header) of your page.

It will be publicly available on GitHub asap.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.