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;
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().

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
add a comment |
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().

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
add a comment |
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().

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
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().

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
magento-1.9 quote quoteitem
asked 6 hours ago
wdarkingwdarking
14218
14218
add a comment |
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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