I want to change some values of some products while adding them to the cart in Magento CE 1.7
Im trying with the Observer checkout_cart_add_product_complete
for this. Change the price (CustomPrice) works well if I try to change the product name or product images, its not saved.
Is there a way to change this attributes already on adding to cart?
public function checkout_cart_add_product_complete(Varien_Event_Observer $observer) {
[...]
// Set new Price
$lastAddedItem->setOriginalCustomPrice($originalProduct->getPrice());
$lastAddedItem->setCustomPrice($originalProduct->getPrice());
// Set Product-Name
$lastAddedItem->setName($originalProduct->getName());
// Set Product-Images
$lastAddedItem->setImage($originalProduct->getImage());
$lastAddedItem->setSmallImage($originalProduct->getSmallImage());
$lastAddedItem->setThumbnail($originalProduct->getThumbnail());
// Save updated Item and Cart
//$lastAddedItem->save();
Mage::getSingleton('checkout/cart')->save();
// Recalc Totals and save
$quote->setTotalsCollectedFlag(false);
$quote->collectTotals();
$quote->save();
Mage::getSingleton('checkout/session')->setCartWasUpdated(true);
}