Reputation: 501
I'm customizing my Magento webstore to use rich snippets, so that I had changed the price.phtml to add the itemprop="price" to the price span. The problemn is that I'm getting various itemprop attributes when I have related or agregate products.
I would like to know if there is a way to get the block parent name in php, so I'll be able to ignore the itemprop rendering out of the main product.
Upvotes: 0
Views: 154
Reputation: 4214
The price.phtml
template and the corresponding block is almost always called via Mage_Catalog_Block_Product_Abstract::getPriceHtml($product, $displayMinimalPrice, $idSuffix)
, and therefore has no parent.
To detect from which blocks it is used, you could update those blocks to add something like $product->setIsCalledFromParentBlock(true)
before the getPriceHtml()
call, and then test the value of $product->getIsCalledFromParentBlock()
in price.phtml
Upvotes: 1
Reputation: 5670
I would advise you to get a developer-toolbar extension like mgt-commerce is offering one for free! You get all kind of information straight in your webbrowser.
Good luck!
Upvotes: 0