Я программно разрешил покупателю редактировать цену продукта.
проблема в том, что когда я добавляю продукт на 400 $ и снова добавляю тот же продукт на 500 $, на странице корзины отображается продукт - | количество=2 -| общая цена=1000$
так что это не логично, общая цена должна быть 900 $, и количество не должно быть равно 2.
я знаю, что проблема в SKU, есть ли решение для этого, я не хочу изменять SKU?
проблема для меня:
должно быть так:
это работает по индивидуальной цене:
/**
* @param Varien_Event_Observer $observer
*/
public function applyCustomPrice(Varien_Event_Observer $observer) {
/* @var $item Mage_Sales_Model_Quote_Item */
$item = $observer->getQuoteItem();
if ($item->getParentItem()) {
$item = $item->getParentItem();
}
Mage::app()->getRequest()->getPost();
$customPrice = Mage::app()->getRequest()->getParam('custom_price');
$defaultCp = $item->getProduct()->getData('min_price');
$product = $observer->getEvent()->getProduct();
//$product_id = Mage::registry('current_product')->getId();
$product->addCustomOption('testpricez', '1078');
if($customPrice >= $defaultCp){
$item->setCustomPrice($customPrice);
$item->setOriginalCustomPrice($customPrice);
$item->getProduct()->setIsSuperMode(true);
}
}
я сделал много поиска, но безрезультатно
как это сделать с наблюдателем?