Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Removing all products from Shopping Card

Go to End

5 Posts   1353 Views


Community Member, 21 Posts

1 August 2009 at 3:38am

Edited: 03/08/2009 10:14pm

I've got small issue,
I'm preparing my Shopping Card for selling only one product variation in one time.
My product page is only a holder and I don't have there any code like "adding product to" or "remove product from" Shopping Card, just only adding product variations, so I've got there only links like:


after clicking link like that, product variation is added to Shopping Card and customer is redirected to checkout . I've added at the end of function addVariation() this code :

Before doing that, I want to make sure, Shopping Card is empty, so I've tried to add some code at the beginning of this function.

I've checked :


But without any positive results. If I go back on other product variations, and I put it on Shopping Card, at checkout page I've got another position, not just the last one.

Could somebody help me and tell me, which function I need to use in this case, to make sure, I have just one product Variation on the checkout page? I don't understand some of this code from ecommerce module, so any reply will be very helpfull for me.


Community Member, 21 Posts

4 August 2009 at 11:01pm

Edited: 04/08/2009 11:01pm


Is it really so complicated, that nobody can't answer for my question? ;-)


Community Member, 21 Posts

4 September 2009 at 10:56pm

Could anybody help me with this issue?


Community Member, 271 Posts

4 September 2009 at 11:06pm

Not tested, but maybe it works if you add :


in ShoppingCart.php function add_new_item()

static function add_new_item(OrderItem $item) {
		$itemsTableIndex = self::items_table_name();
		self::clear(); //added
		if($serializedItems = Session::get($itemsTableIndex)) {
			foreach($serializedItems as $itemIndex => $serializedItem) {
				if($serializedItem != null) {
					$unserializedItem = unserialize($serializedItem);
					if($unserializedItem->hasSameContent($item)) return self::add_item($itemIndex, $item->getQuantity());
		self::set_item($item->getProductID(), $item);


Community Member, 21 Posts

5 September 2009 at 12:44am

Well, it could be good idea, for me it should be worked, but nothing changed.

I don't know why this ShoppingCard::clear() function doesn't work in any way. For example, I've still got two ProductVariaton items from two different products in the checkout.
If I go back and change Product Variation items from one product, it's replacing the first one item, but another product variation is still in the basket.

It's very, very strange, and I don't know, why it's happening in this way and what wrong I'm doing.

Thanks for help Martijn.