function testRemoveFromCart() { /* Retrieve the product to compare from fixture */ $product = $this->objFromFixture('Product', 'mp3player'); $anotherproduct = $this->objFromFixture('Product', 'tshirt'); /* add items via url */ $this->get(ShoppingCart::set_quantity_item_link($product->ID, $product->class) . "?quantity=5"); $this->get(ShoppingCart::add_item_link($anotherproduct->ID, $product->class)); /* remove items via url */ $this->get(ShoppingCart::remove_item_link($product->ID, $product->class)); $this->get(ShoppingCart::remove_item_link($anotherproduct->ID, $product->class)); $items = ShoppingCart::get_items(); $this->assertEquals($items->Count(), 1, 'There is 1 item in the cart'); $this->assertEquals($items->First()->Quantity, 4, 'We have 4 mp3 players in the cart.'); ShoppingCart::clear(); //test clearing cart $this->assertEquals(ShoppingCart::get_items(), null, 'Cart is clear'); //items is a databoject set, and will therefore be null when cart is empty. //TODO: remove item not in cart - insanity check }
function DecrementLink() { $varid = $this->item instanceof ProductVariation_OrderItem ? $this->item->ProductVariationID : null; return Convert::raw2att(ShoppingCart::remove_item_link($this->item->getProductIDForSerialization(), $varid, $this->parameters)); }
function removeLink() { return ShoppingCart::remove_item_link($this->_productID, $this->_productVariationID); }
function removeLink() { return ShoppingCart::remove_item_link($this->_productID, null, $this->linkParameters()); }