- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2017
04:41 AM
01-31-2017
04:41 AM
$aPost = Mage::app()->getFrontController()->getRequest()->getPost(); $id = $aPost['product']; $qty = $aPost['qty']; $product = Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($id); $bundleType = $product->getTypeId(); if ($bundleType == 'bundle') { $collection = $product->getTypeInstance(true)->getSelectionsCollection($product->getTypeInstance(true)->getOptionsIds($product), $product); $itemIds = array(); $b=0; $n=1; foreach ($collection as $item) { if($n == 1) {$price = $item->getPrice();} $sku = $item->getSku(); if($sku = 'shoose01') { $b=20; } elseif ($sku = 'shoose01') { $b=30; } elseif ($sku = 'simple2122'){ $b=40; } elseif ($sku = 'moniteur24'){ $b=60; } else { $b=0; } $n++; } } $single_price = $price+$b; if($bundleType == 'bundle') { $item->setCustomPrice($single_price); $item->setOriginalCustomPrice($single_price); }
i am updating cart item price of bundle product in the time of add to cart , but sub total is not updating but Unit price and grand total is updating , please help me , what is the issue in my code
lavlesh kumar shukla
Solved! Go to Solution.
2 ACCEPTED SOLUTIONS
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017
04:54 AM
02-01-2017
04:54 AM
Try with $item->getProduct()->setIsSuperMode(true);
$item->setCustomPrice($single_price); $item->setOriginalCustomPrice($single_price); $item->getProduct()->setIsSuperMode(true);
//for updating the totals
$quote = Mage::getModel('checkout/session')->getQuote();
$quote->collectTotals()->save();
If first solution not work second solution is
$item= Mage::getModel('sales/quote_item')->load($item->getId()); $product_id = $item->getProductId(); $product=Mage::getModel('catalog/product')->load($product_id); $item->setStoreId(Mage::app()->getStore()->getStoreId()); $item->setCustomPrice($single_price); $item->setOriginalCustomPrice($single_price); $item->setProduct($product); $item->save();
//for updating the totals
$quote = Mage::getModel('checkout/session')->getQuote();
$quote->collectTotals()->save();
Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti
Problem solved? Click Accept as Solution!"
Qaisar Satti
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2017
11:52 PM
03-09-2017
11:52 PM
Both Technique is not working for update subtotal amount
lavlesh kumar shukla
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2017
04:54 AM
02-01-2017
04:54 AM
Try with $item->getProduct()->setIsSuperMode(true);
$item->setCustomPrice($single_price); $item->setOriginalCustomPrice($single_price); $item->getProduct()->setIsSuperMode(true);
//for updating the totals
$quote = Mage::getModel('checkout/session')->getQuote();
$quote->collectTotals()->save();
If first solution not work second solution is
$item= Mage::getModel('sales/quote_item')->load($item->getId()); $product_id = $item->getProductId(); $product=Mage::getModel('catalog/product')->load($product_id); $item->setStoreId(Mage::app()->getStore()->getStoreId()); $item->setCustomPrice($single_price); $item->setOriginalCustomPrice($single_price); $item->setProduct($product); $item->save();
//for updating the totals
$quote = Mage::getModel('checkout/session')->getQuote();
$quote->collectTotals()->save();
Find helpful ? Consider Giving Kudos to this post.
Problem solved? Click Accept as Solution!"
Qaisar Satti
Problem solved? Click Accept as Solution!"
Qaisar Satti
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2017
11:52 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2017
12:21 AM
03-24-2017
12:21 AM
Re: how to update custom price cart subtotal programmatically in magento
Hi , Qaisar
your solution is fine for me . Thanks for your support
lavlesh kumar shukla