0

We used event checkout_cart_product_add_after for update group price in cart page.

we get proper group price in event but, after event go to the cart page at that time Bundle Option price displayed wrong (Not displayed Group price ).

public function changePrice($observer) {

        $event = $observer->getEvent();
        $item = $event->getQuoteItem();

        $product = Mage::getModel('catalog/product')->load($item->getProductId());

        $selectedCustomerEmail = Mage::getSingleton('core/session')->getMySessionVariable();   

        $customer = Mage::getModel("customer/customer");                      
                    $customer->setWebsiteId(Mage::app()->getStore()->getWebsiteId());
                    $customer->loadByEmail($selectedCustomerEmail);

        $customerGroupId = $customer->getGroupId(); 

        $grp_price = $product->getData('group_price'); 


        $group_price = $grp_price[$customerGroupId]['price'];

        $baseCurrencyCode = Mage::app()->getStore()->getBaseCurrencyCode(); 
        $currentCurrencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();

        $priceTwo = Mage::helper('directory')->currencyConvert($group_price, $baseCurrencyCode, $currentCurrencyCode);

        $finalPrice = $priceTwo;



        if($finalPrice > 0){
            $item->setCustomPrice($finalPrice);
            $item->setOriginalCustomPrice($finalPrice);
            $item->getProduct()->setIsSuperMode(true);
            $item->save();
        }

        //Mage::getSingleton('core/session')->addSuccess($finalPrice);   
    }
  • can you put your observer code at here , otherwise its very tough to help you – Murtuza Zabuawala Apr 30 '18 at 5:53
  • Hello @MurtuzaZabuawala if you have any idea then please share here. – Ashish Kacha May 17 '18 at 12:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.