3

I want to change the title of the review page.

Currently it is display as "Productname | Websitename". But I want to change it in "Reviews of Productname | Websitename"

How can I achieve that?

Because I cannot change the XML file, because I need to load the title dynamic because of the productname.

11

There are several methods available to do that. But i will prefer second one.

   1 Core block override
   2 Event/Observer

So, once you have created your module, you will need to declare the observer in your config.xml:

<!-- config xml -->

<frontend>
    <events>
        <controller_action_layout_render_before_review_product_list>
            <observers>
                <productmeta>
                    <class>YourCompany_YourModule_Model_Observer</class>
                    <method>controller_action_layout_render_before_review_product_list</method>
                </productmeta>
            </observers>
        </controller_action_layout_render_before_review_product_list>
    </events>
</frontend>

<!-- config xml -->

Then your observer would be similar to this...

<?php

class YourCompany_YourModule_Model_Observer
{
    /**
     * @pram Varien_Event_Observer $observer
     * @return void
     */
    public function controller_action_layout_render_before_review_product_list(Varien_Event_Observer $observer)
    {   //Get product name and website name in variable after that replace with text below
        $title = "Reviews of Productname | Websitename";
       //After adding dynamic values in variables it looks like below..
       //$title = 'Reviews of' . $product->getName() | $websitename;
        Mage::app()->getLayout()->getBlock('head')->setData('title', $title);
    }
}

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.