Update quote item price without using custom price The 2019 Stack Overflow Developer Survey Results Are InRemove taxes from quote item programaticallyHow to handle multiple-currency and custom quote item price on Magento?Make custom option price to be added to bundle product price in cartMagento buy 2 get one freeSet Discount Amount and Recalculae TaxHow can I add custom discount amount for specific quote Item/s?collectTotals() on quote does not update configurable product item priceHow to give non-fixed discount for different fixed prices?Magento 2 programmatically create quote but don't count all item in totalMagento 1.9 tier discount precision

What do the Banks children have against barley water?

It's possible to achieve negative score?

Where to refill my bottle in India?

Time travel alters history but people keep saying nothing's changed

Dual Citizen. Exited the US on Italian passport recently

How to manage monthly salary

Could JWST stay at L2 "forever"?

Feasability of miniature nuclear reactors for humanoid cyborgs

"What time...?" or "At what time...?" - what is more grammatically correct?

Deadlock Graph and Interpretation, solution to avoid

How are circuits which use complex ICs normally simulated?

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

Idiomatic way to prevent slicing?

JSON.serialize: is it possible to suppress null values of a map?

How can I create a character who can assume the widest possible range of creature sizes?

I see my dog run

Where does the "burst of radiance" from Holy Weapon originate?

Does light intensity oscillate really fast since it is a wave?

Why is it "Tumoren" and not "Tumore"?

How to change the limits of integration

A poker game description that does not feel gimmicky

On the insanity of kings as an argument against Monarchy

Realistic Alternatives to Dust: What Else Could Feed a Plankton Bloom?

Why is Grand Jury testimony secret?



Update quote item price without using custom price



The 2019 Stack Overflow Developer Survey Results Are InRemove taxes from quote item programaticallyHow to handle multiple-currency and custom quote item price on Magento?Make custom option price to be added to bundle product price in cartMagento buy 2 get one freeSet Discount Amount and Recalculae TaxHow can I add custom discount amount for specific quote Item/s?collectTotals() on quote does not update configurable product item priceHow to give non-fixed discount for different fixed prices?Magento 2 programmatically create quote but don't count all item in totalMagento 1.9 tier discount precision



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








0















We are developing a custom module wich applies custom tier prices by product category. Our solution works on frontend checkout so far, and consists of observing the sales_quote_item_set_product event and running custom code that checks other quote items of given category to apply a custom price.



The function responsible for applying the custom price to the item is below:



public function applyTierPrice($item, $tier)

$oldPrice = (float)$item->getProduct()->getPrice();
$newPrice = (float)$tier['discount'];
if ($tier['type'] === 'percent')
$newPrice = $oldPrice - $oldPrice * ($tier['discount'] / 100);


$item->setCustomPrice($newPrice);
$item->setOriginalCustomPrice($newPrice);

$item->getProduct()->setIsSuperMode(true);
$item->save();



This solution becomes a problem on order creation by admin panel, because there is a field where you can set manually the item price, and apparently it also uses the methods setCustomPrice().



magento-se-issue-scrot



So, when we add a product to the quote, it runs the custom applyTierPrice() method. But if i want to use that custom price field, our solution will override that field input, and we loose the default custom price functionality.



So i was thinking of a solution where we set the quote item price by calling $item->setPrice(), and not messing with custom price.



public function applyTierPrice($item, $tier)

$oldPrice = (float)$item->getProduct()->getPrice();
$newPrice = (float)$tier['discount'];
if ($tier['type'] === 'percent')
$newPrice = $oldPrice - $oldPrice * ($tier['discount'] / 100);


// $item->setCustomPrice($newPrice);
// $item->setOriginalCustomPrice($newPrice);

$item->setPrice(42);

$item->getProduct()->setIsSuperMode(true);
$item->save();



$quote->collectTotals() and $quote->save() are being called after this function.



It updates the price field on the sales_flat_quote_item table, but the change doesn't reflect on subtotal, row total, order total calculations.



How can i solve it? Any advice is apreciated.










share|improve this question




























    0















    We are developing a custom module wich applies custom tier prices by product category. Our solution works on frontend checkout so far, and consists of observing the sales_quote_item_set_product event and running custom code that checks other quote items of given category to apply a custom price.



    The function responsible for applying the custom price to the item is below:



    public function applyTierPrice($item, $tier)

    $oldPrice = (float)$item->getProduct()->getPrice();
    $newPrice = (float)$tier['discount'];
    if ($tier['type'] === 'percent')
    $newPrice = $oldPrice - $oldPrice * ($tier['discount'] / 100);


    $item->setCustomPrice($newPrice);
    $item->setOriginalCustomPrice($newPrice);

    $item->getProduct()->setIsSuperMode(true);
    $item->save();



    This solution becomes a problem on order creation by admin panel, because there is a field where you can set manually the item price, and apparently it also uses the methods setCustomPrice().



    magento-se-issue-scrot



    So, when we add a product to the quote, it runs the custom applyTierPrice() method. But if i want to use that custom price field, our solution will override that field input, and we loose the default custom price functionality.



    So i was thinking of a solution where we set the quote item price by calling $item->setPrice(), and not messing with custom price.



    public function applyTierPrice($item, $tier)

    $oldPrice = (float)$item->getProduct()->getPrice();
    $newPrice = (float)$tier['discount'];
    if ($tier['type'] === 'percent')
    $newPrice = $oldPrice - $oldPrice * ($tier['discount'] / 100);


    // $item->setCustomPrice($newPrice);
    // $item->setOriginalCustomPrice($newPrice);

    $item->setPrice(42);

    $item->getProduct()->setIsSuperMode(true);
    $item->save();



    $quote->collectTotals() and $quote->save() are being called after this function.



    It updates the price field on the sales_flat_quote_item table, but the change doesn't reflect on subtotal, row total, order total calculations.



    How can i solve it? Any advice is apreciated.










    share|improve this question
























      0












      0








      0








      We are developing a custom module wich applies custom tier prices by product category. Our solution works on frontend checkout so far, and consists of observing the sales_quote_item_set_product event and running custom code that checks other quote items of given category to apply a custom price.



      The function responsible for applying the custom price to the item is below:



      public function applyTierPrice($item, $tier)

      $oldPrice = (float)$item->getProduct()->getPrice();
      $newPrice = (float)$tier['discount'];
      if ($tier['type'] === 'percent')
      $newPrice = $oldPrice - $oldPrice * ($tier['discount'] / 100);


      $item->setCustomPrice($newPrice);
      $item->setOriginalCustomPrice($newPrice);

      $item->getProduct()->setIsSuperMode(true);
      $item->save();



      This solution becomes a problem on order creation by admin panel, because there is a field where you can set manually the item price, and apparently it also uses the methods setCustomPrice().



      magento-se-issue-scrot



      So, when we add a product to the quote, it runs the custom applyTierPrice() method. But if i want to use that custom price field, our solution will override that field input, and we loose the default custom price functionality.



      So i was thinking of a solution where we set the quote item price by calling $item->setPrice(), and not messing with custom price.



      public function applyTierPrice($item, $tier)

      $oldPrice = (float)$item->getProduct()->getPrice();
      $newPrice = (float)$tier['discount'];
      if ($tier['type'] === 'percent')
      $newPrice = $oldPrice - $oldPrice * ($tier['discount'] / 100);


      // $item->setCustomPrice($newPrice);
      // $item->setOriginalCustomPrice($newPrice);

      $item->setPrice(42);

      $item->getProduct()->setIsSuperMode(true);
      $item->save();



      $quote->collectTotals() and $quote->save() are being called after this function.



      It updates the price field on the sales_flat_quote_item table, but the change doesn't reflect on subtotal, row total, order total calculations.



      How can i solve it? Any advice is apreciated.










      share|improve this question














      We are developing a custom module wich applies custom tier prices by product category. Our solution works on frontend checkout so far, and consists of observing the sales_quote_item_set_product event and running custom code that checks other quote items of given category to apply a custom price.



      The function responsible for applying the custom price to the item is below:



      public function applyTierPrice($item, $tier)

      $oldPrice = (float)$item->getProduct()->getPrice();
      $newPrice = (float)$tier['discount'];
      if ($tier['type'] === 'percent')
      $newPrice = $oldPrice - $oldPrice * ($tier['discount'] / 100);


      $item->setCustomPrice($newPrice);
      $item->setOriginalCustomPrice($newPrice);

      $item->getProduct()->setIsSuperMode(true);
      $item->save();



      This solution becomes a problem on order creation by admin panel, because there is a field where you can set manually the item price, and apparently it also uses the methods setCustomPrice().



      magento-se-issue-scrot



      So, when we add a product to the quote, it runs the custom applyTierPrice() method. But if i want to use that custom price field, our solution will override that field input, and we loose the default custom price functionality.



      So i was thinking of a solution where we set the quote item price by calling $item->setPrice(), and not messing with custom price.



      public function applyTierPrice($item, $tier)

      $oldPrice = (float)$item->getProduct()->getPrice();
      $newPrice = (float)$tier['discount'];
      if ($tier['type'] === 'percent')
      $newPrice = $oldPrice - $oldPrice * ($tier['discount'] / 100);


      // $item->setCustomPrice($newPrice);
      // $item->setOriginalCustomPrice($newPrice);

      $item->setPrice(42);

      $item->getProduct()->setIsSuperMode(true);
      $item->save();



      $quote->collectTotals() and $quote->save() are being called after this function.



      It updates the price field on the sales_flat_quote_item table, but the change doesn't reflect on subtotal, row total, order total calculations.



      How can i solve it? Any advice is apreciated.







      magento-1.9 quote quoteitem






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 6 hours ago









      wdarkingwdarking

      14218




      14218




















          0






          active

          oldest

          votes












          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%2f269423%2fupdate-quote-item-price-without-using-custom-price%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          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%2f269423%2fupdate-quote-item-price-without-using-custom-price%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

          Best approach to update all entries in a list that is paginated?Best way to add items to a paginated listChoose Your Country: Best Usability approachUpdate list when a user is viewing the list without annoying themWhen would the best day to update your webpage be?What should happen when I add a Row to a paginated, sorted listShould I adopt infinite scrolling or classical pagination?How to show user that page objects automatically updateWhat is the best location to locate the comments section in a list pageBest way to combine filtering and selecting items in a listWhen one of two inputs must be updated to satisfy a consistency criteria, which should you update (if at all)?

          Вунгтау (аеропорт) Загальні відомості | Див. також | Посилання | Навігаційне меню10°22′00″ пн. ш. 107°05′00″ сх. д. / 10.36667° пн. ш. 107.08333° сх. д. / 10.36667; 107.0833310°22′00″ пн. ш. 107°05′00″ сх. д. / 10.36667° пн. ш. 107.08333° сх. д. / 10.36667; 107.083337731608Vinh AirportVinh airport facelift improves serviceвиправивши або дописавши їївиправивши або дописавши їїр

          Тонконіг бульбистий Зміст Опис | Поширення | Екологія | Господарське значення | Примітки | Див. також | Література | Джерела | Посилання | Навігаційне меню1114601320038-241116202404kew-435458Poa bulbosaЭлектронный каталог сосудистых растений Азиатской России [Електронний каталог судинних рослин Азіатської Росії]Малышев Л. Л. Дикие родичи культурных растений. Poa bulbosa L. - Мятлик луковичный. [Малишев Л. Л. Дикі родичи культурних рослин. Poa bulbosa L. - Тонконіг бульбистий.]Мятлик (POA) Сем. Злаки (Мятликовые) [Тонконіг (POA) Род. Злаки (Тонконогові)]Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Description from Flora of China) [Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Опис від Флора Китаю)]Poa bulbosa L. – lipnice cibulkatá / lipnica cibulkatáPoa bulbosa в базі даних Poa bulbosa на сайті Poa bulbosa в базі даних «Global Biodiversity Information Facility» (GBIF)Poa bulbosa в базі даних «Euro + Med PlantBase» — інформаційному ресурсі для Євро-середземноморського розмаїття рослинPoa bulbosa L. на сайті «Плантариум»