How to add my code in reorder action using my custom module
-
13-12-2019 - |
Question
I want to add my code in reorder action using my custom module.
I want to do this because I am using this event checkout_cart_product_add_after
to set custom option and price but when I reorder that order that time price and custom option is not set as last order.
Is that correct way to set that option and price ?
Solution 2
Reference-https://stackoverflow.com/a/9570013/4572021
in checkout_cart_product_add_after
event
action = Mage::app()->getFrontController()->getAction();
if ($action->getFullActionName() == 'sales_order_reorder')
{
$buyInfo = $obs->getQuoteItem()->getBuyRequest();
if ($option= $buyInfo->getCustomOption())
{
//get my custom option using that i can get price and set a price
}
}
OTHER TIPS
From what I can remember to reorder Magento actually merges the quote. So using sales_quote_merge_before
would be an event you could watch.
Another option would be to use the sales_quote_collect_totals_before
event. It's triggered before calculating totals like subtotal and grand total.
However, for both options you don't know if it is a normal order or a reorder so you might want to store in a session or something a reorder has been triggered