How to update subtotal after changing price with observer The 2019 Stack Overflow Developer Survey Results Are InUpdate product custom option price in observerDynamically add extra price on subtotal on cartHow to change product name in quote item dynamicallySubtotal doubled in cart after updateSet custom price of product when adding to cart code not workinghow to update cart subtotal after change item price with observer magento 1.8update price Observer is not working on cart pageHow to change price (Custom Price) of Bundle Child products during add to cart using observerMagento 2 : How to Update Price After Changing Qty On Cartmini cart subtotal update in observer

How to answer pointed "are you quitting" questioning when I don't want them to suspect

What does "fetching by region is not available for SAM files" means?

Should I use my personal e-mail address, or my workplace one, when registering to external websites for work purposes?

Does a dangling wire really electrocute me if I'm standing in water?

Worn-tile Scrabble

What could be the right powersource for 15 seconds lifespan disposable giant chainsaw?

Are children permitted to help build the Beis Hamikdash?

What do hard-Brexiteers want with respect to the Irish border?

Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?

Is there a symbol for a right arrow with a square in the middle?

Falsification in Math vs Science

Geography at the pixel level

Can you compress metal and what would be the consequences?

Is there any way to tell whether the shot is going to hit you or not?

Have you ever entered Singapore using a different passport or name?

How to support a colleague who finds meetings extremely tiring?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

FPGA - DIY Programming

How to save as into a customized destination on macOS?

How to notate time signature switching consistently every measure

Resizing object distorts it (Illustrator CC 2018)

Landlord wants to switch my lease to a "Land contract" to "get back at the city"

Do these rules for Critical Successes and Critical Failures seem Fair?

If I score a critical hit on an 18 or higher, what are my chances of getting a critical hit if I roll 3d20?



How to update subtotal after changing price with observer



The 2019 Stack Overflow Developer Survey Results Are InUpdate product custom option price in observerDynamically add extra price on subtotal on cartHow to change product name in quote item dynamicallySubtotal doubled in cart after updateSet custom price of product when adding to cart code not workinghow to update cart subtotal after change item price with observer magento 1.8update price Observer is not working on cart pageHow to change price (Custom Price) of Bundle Child products during add to cart using observerMagento 2 : How to Update Price After Changing Qty On Cartmini cart subtotal update in observer



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I am using observer to change bundle product price. I have tried events 'checkout_cart_product_add_after' and 'checkout_cart_save_after'. Both events update product's price but subtotal remains same. In my case Price is 50 and Subtotal is 18.



Observer code (checkout_cart_save_after):



public function apply_customprice(Varien_Event_Observer $observer)


$quote= $observer->getCart()->getQuote();
foreach ($quote->getAllItems() as $bundleitems)
$parentProductId = $bundleitems->getProduct()->getId();
if($bundleitems->getProduct()->getTypeId() == 'bundle')

$storeId = Mage::app()->getStore()->getStoreId();
$Custom_price= 50;
$item = Mage::getModel('sales/quote_item')->load($bundleitems->getId());
$product_id = $item->getProductId();
$product = Mage::getModel('catalog/product')->load($product_id);
$item->setStoreId($storeId);
$item->setCustomPrice($Custom_price);
$item->setOriginalCustomPrice($Custom_price);
$item->setProduct($product);
$item->save();

//for updating the totals
$quote = Mage::getModel('checkout/session')->getQuote();
$quote->collectTotals()->save();














share|improve this question














bumped to the homepage by Community yesterday


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.





















    1















    I am using observer to change bundle product price. I have tried events 'checkout_cart_product_add_after' and 'checkout_cart_save_after'. Both events update product's price but subtotal remains same. In my case Price is 50 and Subtotal is 18.



    Observer code (checkout_cart_save_after):



    public function apply_customprice(Varien_Event_Observer $observer)


    $quote= $observer->getCart()->getQuote();
    foreach ($quote->getAllItems() as $bundleitems)
    $parentProductId = $bundleitems->getProduct()->getId();
    if($bundleitems->getProduct()->getTypeId() == 'bundle')

    $storeId = Mage::app()->getStore()->getStoreId();
    $Custom_price= 50;
    $item = Mage::getModel('sales/quote_item')->load($bundleitems->getId());
    $product_id = $item->getProductId();
    $product = Mage::getModel('catalog/product')->load($product_id);
    $item->setStoreId($storeId);
    $item->setCustomPrice($Custom_price);
    $item->setOriginalCustomPrice($Custom_price);
    $item->setProduct($product);
    $item->save();

    //for updating the totals
    $quote = Mage::getModel('checkout/session')->getQuote();
    $quote->collectTotals()->save();














    share|improve this question














    bumped to the homepage by Community yesterday


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      1












      1








      1








      I am using observer to change bundle product price. I have tried events 'checkout_cart_product_add_after' and 'checkout_cart_save_after'. Both events update product's price but subtotal remains same. In my case Price is 50 and Subtotal is 18.



      Observer code (checkout_cart_save_after):



      public function apply_customprice(Varien_Event_Observer $observer)


      $quote= $observer->getCart()->getQuote();
      foreach ($quote->getAllItems() as $bundleitems)
      $parentProductId = $bundleitems->getProduct()->getId();
      if($bundleitems->getProduct()->getTypeId() == 'bundle')

      $storeId = Mage::app()->getStore()->getStoreId();
      $Custom_price= 50;
      $item = Mage::getModel('sales/quote_item')->load($bundleitems->getId());
      $product_id = $item->getProductId();
      $product = Mage::getModel('catalog/product')->load($product_id);
      $item->setStoreId($storeId);
      $item->setCustomPrice($Custom_price);
      $item->setOriginalCustomPrice($Custom_price);
      $item->setProduct($product);
      $item->save();

      //for updating the totals
      $quote = Mage::getModel('checkout/session')->getQuote();
      $quote->collectTotals()->save();














      share|improve this question














      I am using observer to change bundle product price. I have tried events 'checkout_cart_product_add_after' and 'checkout_cart_save_after'. Both events update product's price but subtotal remains same. In my case Price is 50 and Subtotal is 18.



      Observer code (checkout_cart_save_after):



      public function apply_customprice(Varien_Event_Observer $observer)


      $quote= $observer->getCart()->getQuote();
      foreach ($quote->getAllItems() as $bundleitems)
      $parentProductId = $bundleitems->getProduct()->getId();
      if($bundleitems->getProduct()->getTypeId() == 'bundle')

      $storeId = Mage::app()->getStore()->getStoreId();
      $Custom_price= 50;
      $item = Mage::getModel('sales/quote_item')->load($bundleitems->getId());
      $product_id = $item->getProductId();
      $product = Mage::getModel('catalog/product')->load($product_id);
      $item->setStoreId($storeId);
      $item->setCustomPrice($Custom_price);
      $item->setOriginalCustomPrice($Custom_price);
      $item->setProduct($product);
      $item->save();

      //for updating the totals
      $quote = Mage::getModel('checkout/session')->getQuote();
      $quote->collectTotals()->save();











      magento-1.9 cart event-observer bundled-product






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 20 '17 at 15:47









      SayaliSayali

      651416




      651416





      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community yesterday


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I could be mistaken, but it seems like your question is very similar to another one that has been answered here. If so, try to add your observer to the sales_quote_save_before event and use this line to force recalculation: $quote->setTotalsCollectedFlag(false)->collectTotals(); rather than calling save() again.






          share|improve this answer

























          • Thank you for the answer. I solved this issue by setting bundle product price to fixed :)

            – Sayali
            Apr 28 '17 at 8:12











          • @Sayali - glad you found a resolution. You should post the details in an answer to your question and mark it as accepted to help others!

            – fantasticrice
            Apr 28 '17 at 14:18











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "479"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f171007%2fhow-to-update-subtotal-after-changing-price-with-observer%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I could be mistaken, but it seems like your question is very similar to another one that has been answered here. If so, try to add your observer to the sales_quote_save_before event and use this line to force recalculation: $quote->setTotalsCollectedFlag(false)->collectTotals(); rather than calling save() again.






          share|improve this answer

























          • Thank you for the answer. I solved this issue by setting bundle product price to fixed :)

            – Sayali
            Apr 28 '17 at 8:12











          • @Sayali - glad you found a resolution. You should post the details in an answer to your question and mark it as accepted to help others!

            – fantasticrice
            Apr 28 '17 at 14:18















          0














          I could be mistaken, but it seems like your question is very similar to another one that has been answered here. If so, try to add your observer to the sales_quote_save_before event and use this line to force recalculation: $quote->setTotalsCollectedFlag(false)->collectTotals(); rather than calling save() again.






          share|improve this answer

























          • Thank you for the answer. I solved this issue by setting bundle product price to fixed :)

            – Sayali
            Apr 28 '17 at 8:12











          • @Sayali - glad you found a resolution. You should post the details in an answer to your question and mark it as accepted to help others!

            – fantasticrice
            Apr 28 '17 at 14:18













          0












          0








          0







          I could be mistaken, but it seems like your question is very similar to another one that has been answered here. If so, try to add your observer to the sales_quote_save_before event and use this line to force recalculation: $quote->setTotalsCollectedFlag(false)->collectTotals(); rather than calling save() again.






          share|improve this answer















          I could be mistaken, but it seems like your question is very similar to another one that has been answered here. If so, try to add your observer to the sales_quote_save_before event and use this line to force recalculation: $quote->setTotalsCollectedFlag(false)->collectTotals(); rather than calling save() again.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 23 '17 at 12:37









          Community

          1




          1










          answered Apr 20 '17 at 16:15









          fantasticricefantasticrice

          691616




          691616












          • Thank you for the answer. I solved this issue by setting bundle product price to fixed :)

            – Sayali
            Apr 28 '17 at 8:12











          • @Sayali - glad you found a resolution. You should post the details in an answer to your question and mark it as accepted to help others!

            – fantasticrice
            Apr 28 '17 at 14:18

















          • Thank you for the answer. I solved this issue by setting bundle product price to fixed :)

            – Sayali
            Apr 28 '17 at 8:12











          • @Sayali - glad you found a resolution. You should post the details in an answer to your question and mark it as accepted to help others!

            – fantasticrice
            Apr 28 '17 at 14:18
















          Thank you for the answer. I solved this issue by setting bundle product price to fixed :)

          – Sayali
          Apr 28 '17 at 8:12





          Thank you for the answer. I solved this issue by setting bundle product price to fixed :)

          – Sayali
          Apr 28 '17 at 8:12













          @Sayali - glad you found a resolution. You should post the details in an answer to your question and mark it as accepted to help others!

          – fantasticrice
          Apr 28 '17 at 14:18





          @Sayali - glad you found a resolution. You should post the details in an answer to your question and mark it as accepted to help others!

          – fantasticrice
          Apr 28 '17 at 14:18

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Magento Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f171007%2fhow-to-update-subtotal-after-changing-price-with-observer%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Grendel Contents Story Scholarship Depictions Notes References Navigation menu10.1093/notesj/gjn112Berserkeree

          Area configuration aggregation error after install Porto themeMagento 2.1 CE Installed but front/backend not loading/workingCSS not loading on page within Magento 2 pageCannot install module in Magento 2no commands defined in the “setup” namespace. in Magento2Magento 2: Static files are present but shows 404Why do i have to always run the commands to clean cache in Magento 2.1.8?Failure reason: 'Unable to unserialize value.'Error 500 after magento migrationIn production mode the site does not loadMagento 2 : Error 500 after installing

          Middle Expansion Olielle Resaix Definition: Uttering songs of triumph shouting with joy triumphant exulting Sejunction Journal 붙다 달 고급 품목 외출 The stretch trades the screeching tin. Definition: The act of speaking with a drawl a drawl Cough Sand Definition: An uproar a quarrel a noisy outbreak Shake Iron Publicize Horse House Baby 사과 Resaix Flaggy Jelly Temporary Unequaled Puppet A drop in the bucket Shrew 성격 회원 성질 미팅 The burn frames the tacky quality. Materialistic The smoke reduces the way. Yammoe Nondescript Cheek 얼굴 배 약하다 날리다 타다 The illegal country shows the iron. Help Rule Drearien Smoke Teaching Meaty Wasp Abraham Lincoln Jaws 진심 수리하다 Size Cork Idea Convert Think Lark John Lennon 거울 청소 군 추천하다 아이스크림