I am having some difficulty at the minute with Magento developing a site for my client.
Currently, the product title is [PRODUCT_NAME] | [PRODUCT_CATEGORY]
I would like to change this to say [PREFIX] [PRODUCT_NAME] [SUFFIX]
I know this can be done using Magento's prefix and suffix pages however I want this to only apply to products. Any ideas how I can implement this without it being overwritted when Magento is updated.
Thanks.
Wow, you have several options for how you can implement this. The product meta title comes from the Mage_Catalog_Block_Product_View
class specifically seeking out the HTML head block instance (Mage_Page_Block_Html_Head
) from the layout object (Mage_Core_Model_Layout
) and setting its 'title' property to the product model's (Mage_Catalog_Model_Product
) getMetaTitle() value.
Based on this, you could rewrite the product model class and add a custom getMetaTitle() method which includes your prefix/suffix logic. You could also rewrite the product view block's _prepareLayout()
method to include your prefix and suffix. You could also do this through observers or by rewriting the catalog product view controller.
Comment if you need a hand with any of the above.