I'm spliting the magento order separately like different vendors, I'm fallowing the Vinai Answer from previous post. But it's returning an error.

Error: Invalid method Mage_Sales_Model_Quote::removeItemByKey()

Mage_Sales_Model_Quote this class have this method but it's returning error WHY?

my code is


class Easylife_SplitOrder_Model_Type_Onepage extends Mage_Checkout_Model_Type_Onepage

    public function saveOrder()
        $quote = $this->getQuote();

        // First build an array with the items split by vendor
        $sortedItems = array();
        foreach ($quote->getAllItems() as $item) {
            //$vendor = $item->getProduct()->getVendor(); // <- whatever you need
            $product = Mage::getModel('catalog/product')->load($item->getProductId());
            $vendor = $product->getVendor();
            if($vendor != 0){
                if (! isset($sortedItems[$vendor])) {
                    $sortedItems[$vendor] = $item;

        foreach ($sortedItems as $vendor => $items) {
            // Empty quote
            foreach ($quote->getAllItems() as $item) {
            foreach ($items as $item) {
            // Update totals for vendor

            // Delegate to parent method to place an order for each vendor
        return $this;


How can I solve this?

Thanks in advance..

3 Answers 3


This method doesn't quite exist in Mage_Sales_Model_Quote in Magento and this is why you are getting this error.


The function removeItemByKey can be found on the class Varien_Data_Collection. This means that is is a core function for collection objects. The class Mage_Sales_Model_Quote is not a collection object and so does not have this class.

I think what you want is removeItem this will take the id of the item you wish to remove and removes the item.


What Vinai wrote is:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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