문제

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top