3

I am facing a problem in changing bundler product price in checkout_cart_product_add_after event. i have written code which changes the price of simple products which are child of bundle product. Quote item changes as per my requirement but when a cart page get refreshed, row total of each item get set to default price of product.

Following is the code i have written to change the product custom price and rowtotal.

        $quote      = Mage::getSingleton('checkout/session')->getQuote();
        $product1   = Mage::getModel('catalog/product')->loadByAttribute('sku',$bundlePackageSku);

        $bundler_Price = 0;

        foreach($quote->getAllVisibleItems() as $quote_item1) {
                if ($bundler_Price > 0) {

                    if($quote_item1->getProductId() == $bundleId){
                        // print_r(get_class_methods($quote_item1));
                        $quote_item1->setPrice($bundler_Price);
                        $quote_item1->setCustomPrice($bundler_Price);
                        $quote_item1->setOriginalCustomPrice($bundler_Price);
                        $quote_item1->setRowTotal($bundler_Price);                          
                        $quote_item1->save(); 
                        // exit();
                    } //end of if condition 
                }

            } //end of foreach 

I came to conclusion that magento's default behaviour which regenerates the Rowtotal of each quote item after changing the quote price from table itself.

Can anybody tell me where and what class need to be override to overcome this problem???

Thanks in advance.

closed as too broad by Marius Mar 31 '15 at 6:40

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.