i want to append some extra thing to all product name in view cart how can i do it via observer

please tell which observer should i use or call for that

3 Answers 3


Magento product name at Cart has been coming from function getProductName() at class Mage_Checkout_Block_Cart_Item_Renderer_Configurable



You need to change on this function.So rewrite those two blocks and do change on function getProductName.

public function getProductName()
    if ($this->hasProductName()) {
        return $this->getData('product_name');
    return $this->getProduct()->getName(). 'myAppend';

mour,you can do this by event sales_quote_item_set_product

Config.xml code:

      <sales_quote_item_set_product> <!-- identifier of the event we want to catch -->
          <sales_quote_item_set_product_handler> <!-- identifier of the event handler -->
            <type>model</type> <!-- class method call type; valid are model, object and singleton -->
            <class>magento58323/observer</class> <!-- observers class alias -->
            <method>setmynameOption</method>  <!-- observer's method to be called -->
            <args></args> <!-- additional arguments passed to observer -->



function change name

class Stackexchange_58323_Model_Observer

    public function setmynameOption(Varien_Event_Observer $observer)
        $Event = $observer->getEvent();
        //Mage::dispatchEvent('sales_quote_item_set_product', array('product' => $product,'quote_item' => $this));
  • not works, i want to append it on view cart page "checkout/cart/" for all product name Feb 23, 2015 at 12:15

I wanted to do the same thing..... after trying all the day finally I ended up doing adding an extra column at the table "sales_flat_quote_item" named custom_product_name and saved the modified name.

just like $item->setCustomProductName($modified_name) and save it $item->save();

inside the deault.phtml (your_theme/checkout/cart/item/default) invoke the modified name $item->getCustomProductName()..

of course, careful with the other product names... so check the product type using if statement

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.