2

Currently I'm doing some work on a Magento shop (1.8) and one of the problems the site has is that the SEO and page titles are very poor. So far I've managed to change all of the page titles and meta descriptions for the categories and now I have to sort out the page titles for the product pages.

At the moment, the page title is written like this:

Product NameCategoryCategoryCategory

For a real world example:

Reversible GiletWaistcoats & Gilets For MenClothingMen

Basically there is no space between the product title and the hierarchical category names, which is obviously not desirable.

What I want to do is to just display the product name and the category name that the product is under. So in this example the page title would be:

Reversible Gilet - Waistcoats & Gilets For Men

How can I achieve this?

0

you have to rewrite this class to change on product detail page

Mage_Catalog_Block_Product_View

you can rewrite it with below example

in config.xml

<global>
  <blocks>
    <catalog>
       <rewrite> <product_view>YourNameSpace_Catalog_Block_Product_View</product_view>
      </rewrite>
     </catalog>            
  </blocks>
</global>

override in file

class YourNameSpace_Catalog_Block_Product_View extends Mage_Catalog_Block_Product_View
{
    protected function _prepareLayout() {
        $product = $this->getProduct();
        $meta_description = $product->getMetaDescription();
       // change your meta title here and assign to product 
return parent::_prepareLayout();
}

hope this will sure help to you

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.