I am developing one extension. I have created attribute at backend and assigned to product. And I am changing that product attribute while adding to cart and I am fetching same on checkout/cart page but I am not able to get same value on checkout/cart page.

I am storing this product value in checkout/cart model like this:

//saving product to cart
$product_id = Mage::app()->getRequest()->getPost('id'); 
        $qty = Mage::app()->getRequest()->getPost('qty'); 
        $product = Mage::getModel('catalog/product')->load($product_id);

$cart = Mage::getModel('checkout/cart');
        $cart->addProduct($product, array('qty' => $qty));
        Mage::getSingleton('core/session')->addSuccess('Product added successfully');

And I can retrieve my attribute value at same page like following code but I am not able to get it on checkout/cart page.

$cartQuote = Mage::getModel('checkout/cart')->getQuote()->getAllVisibleItems();
        foreach ($cartQuote as $item) {
            $productId = $item->getProduct()->getId();
            $productPrice = $item->getProduct()->getPrice();
            $item->getProduct()->getCanImage();//I can get my value here

And I have used same code which is above but I am not getting value from checkout/cart quote.

And I don't want to store this value in database because it will create trouble if many user will add this product dynamically so I think quote is good place to keep data for product.

Please suggest me solution.

2 Answers 2


First , $product->setCanImage('wasdwasdwasd');does not save the value at model object until use $product->save();

So you could not get $item->getProduct()->getCanImage() data as $item->getProduct()->getCanImage() is Object of Mage_Catalog_Model_Product.

One thing you can do save the value in session variable then use it at checkout/cart page.

Concept is that,that session variable's value is saved as array with format like.


Mage::getSingleton( 'customer/session' )->setCanImage($ValueinArray);

Then on cart page you need to call that variable value by Mage::getSingleton( 'customer/session' )->getCanImage()

and match with product index


$product->save() is missing in your code.

I will recommend to use customer session to set this value and fetch in cart page. Please do not forget to unset the session value


Your Answer

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

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