Magento Product Rules, adding one product at a time

91 views Asked by At

I sell two services in my Magento store. I've disabled cart and multi-page checkout. I want to sell only one service at a time. Means I want to accomplish, if customer tries to add both services to cart so the previous service should be removed.

How can I accomplish this? I've been searching this from last 5 hours.

1

There are 1 answers

1
Marko Krstic On BEST ANSWER

in the file

app/code/core/Mage/Sales/Model/Quote.php

there is a method public function addProduct($product, $request = null); you should only add $this->removeAllItems(); to be the first line in the method, like:

public function addProduct(Mage_Catalog_Model_Product $product, $request = null)
{
    $this->removeAllItems(); // new code
    ....
}

of course, it's better idea to be overridden in the local pool.