2

I want to remove some items if I am pressing the reorder button from adminpanel. I'm using this event: controller_action_postdispatch_adminhtml_sales_order_create_reorder

and this is my method from my observer:

    $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
    foreach($quote->getAllItems() as $item) {
        if ($item->getSku() === 'with smth') {
            $quote->removeItem($item->getId());
        }
    }
    $quote->collectTotals()->save();

I don't get any errors, and the item is not removed :) What am I doing wrong here ? :)

Thank you!

1

I managed to fix it by using the delete() method:

    $quote = Mage::getSingleton('adminhtml/session_quote')->getQuote();
    foreach($quote->getAllItems() as $item) {
        if (my condition here) {
            $item->delete();
        }
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.