Rich Snippets in Magento 1.9.x

This blog post will show you how to implement the Rich Snippet for product availability when the HTML for price and product availability are not in the same parent div. Magento 1.9.x was released with a new theme called rwd (Responsive Web Dedsign). Both product availability and price are separated in this new Magento theme. They don’t appear in the same parent div anymore which makes implementation of Rich Snippets as described in my earlier blog post “Magento Rich Snippets made easy” not possible. According to some tests the Rich Snippets don’t appear correctly when I use two separate item scopes for item type Offer. One of them is filled item property price and another with item property availability. Continu to read this blog post and learn how to solve it.

rich-snippets-magento-1.9.x
Rich Snippets in Magento 1.9.x

To implement rich snippets in Magento 1.9.x you can follow the instructions of my earlier blog post “Magento Rich Snippets made easy” except for chapters “Define scope of Offer” and “Add availability”. We’re not going to add the itemprop availability in the phtml file which shows the availability in the front-end. We’re going to create a new file and place it close to the display of the price. Follow the instructions below.

Add availability

new file: app/design/frontend/<your_package>/<your_theme> /template/catalog/product/view/type/availability/snippet/default.phtml

new file: app/design/frontend/<your_package>/<your_theme> /template/bundle/catalog/product/view/type/availability/snippet/default.phtml

file: app/design/frontend/<your_package>/<your_theme> /layout/local.xml

Define scope of Offer

file: app/design/frontend/<your_package>/<your_theme> /template/catalog/product/view.phtml

before

after

With these code additions and changes your source code of a Magento 1.9.x product page will look like the following screenshot.

Magento Rich Snippets endresult
Magento Rich Snippets endresult

Continue implementation

You can continue the implementation of Rich Snippets in a Magento 1.9.x product page at chapter “Add product price” of my earlier blog post “Magento Rich Snippets made easy“. The tutorial in this blog post can also be used in a Magento 1.7.x and Magento 1.8.x website where price and availability appear on different places on your product page.

Have fun adding structured data to your Magento product page and draw more attention to relevant search in Google, Yahoo, Bing and Yandex.

 op

Hans Kuijpers is Joomla! en Magento specialist. Zijn eerste website maakte hij in 1995 tijdens zijn studie Technische Bedrijfskunde en sindsdien zijn er tientallen meer verschenen. Met de totstandkoming van deze Byte blog mag hij zichzelf ook wel een ver gevorderde WordPress ontwikkelaar noemen. Kennis delen en plezier hebben in het leven is wat Hans wil.