I wanted to create the meta title of product in the format of

Product Name - Category (Brand) - Company Name

I need this to be created programatically and not by updating from backend or csv.

Can anybody suggest me ?

4 Answers 4


You can set the page title using setTitle() method in controller.

To set title from controller, use setTitle() method between $this->loadLayout(); and $this->renderLayout();

For example:

If you are on product page and want to set title like "Product Name - Category (Brand) - Company Name", then get values of Product Name, Category (Brand) and Company Name, combine values in one variable (say $myTitle) and then use code like below:


Complete code would lok like below:


Please let me know if you have any query.


For company name you can create product attribute. Define an observer add below code to config.xml of your module.


Add observer include below code in it

class Namespace_Modulename_Model_Observer{
    public function AddMetaTagName($observer)

     if ($product_id = Mage::registry('current_product')->getId()) {            
          $product = Mage::getModel('catalog/product')->load($product_id);
          $productName = $product->getName();
          //$companyName = $product->getComapnyName();
          $categoryName = Mage::registry('current_category')->getName();

It is working fine for me see in below image. Here product name is test and category name is cat-1

enter image description here


You can place catalog_product_save_after observer withing adminhtml tag of your module config.xml and save the meta detail of the product

<?xml version="1.0"?>

With the help of this event you can update the meta title of any product as you want.


I think for your requirement there is a free extension avaliable you can download and configure as per your requirement.

this extension fits perfectly on your requiremnt as it allows you to use category and product attribute in your meta detail


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.