public function testRemoveFromCart()
 {
     // add items via url
     $this->get(ShoppingCart_Controller::set_quantity_item_link($this->mp3player, array('quantity' => 5)));
     $this->assertTrue($this->cart->get($this->mp3player) !== false, "mp3player item now exists in cart");
     $this->get(ShoppingCart_Controller::add_item_link($this->socks));
     $this->assertTrue($this->cart->get($this->socks) !== false, "socks item now exists in cart");
     // remove items via url
     $this->get(ShoppingCart_Controller::remove_item_link($this->socks));
     //remove one different = remove completely
     $this->assertFalse($this->cart->get($this->socks));
     $this->get(ShoppingCart_Controller::remove_item_link($this->mp3player));
     //remove one product = 4 left
     $mp3playeritem = $this->cart->get($this->mp3player);
     $this->assertTrue($mp3playeritem !== false, "product still exists");
     $this->assertEquals($mp3playeritem->Quantity, 4, "only 4 of item left");
     $items = ShoppingCart::curr()->Items();
     $this->assertNotNull($items, "Cart is not empty");
     $this->cart->clear();
     //test clearing cart
     $this->assertEquals(ShoppingCart::curr(), null, 'Cart is clear');
     //items is a databoject set, and will therefore be null when cart is empty.
 }
 /**
  * @return string
  */
 public function removeLink()
 {
     $buyable = $this->Buyable();
     return $buyable ? ShoppingCart_Controller::remove_item_link($buyable, $this->uniquedata()) : '';
 }
 /**
  * Link to remove one of this product from cart.
  * @return string link
  */
 public function removeLink()
 {
     return ShoppingCart_Controller::remove_item_link($this);
 }
 /**
  * remove one buyable's orderitem from cart
  * @return String (Link)
  */
 function RemoveLink()
 {
     return ShoppingCart_Controller::remove_item_link($this->ID, $this->ClassName, $this->linkParameters());
 }
Esempio n. 5
0
 public function removeLink()
 {
     return ShoppingCart_Controller::remove_item_link($this->Buyable(), $this->uniquedata());
 }
 function removeLink()
 {
     return ShoppingCart_Controller::remove_item_link($this->_productID);
 }
 /**
  *@return String (URLSegment)
  **/
 function DecrementLink()
 {
     return ShoppingCart_Controller::remove_item_link($this->orderItem->BuyableID, $this->orderItem->BuyableClassName, $this->parameters);
 }
 public function testRemoveFromCart()
 {
     // add items via url
     $this->get(ShoppingCart_Controller::set_quantity_item_link($this->mp3player, array('quantity' => 5)));
     $this->get(ShoppingCart_Controller::add_item_link($this->socks));
     // remove items via url
     $r = $this->get(ShoppingCart_Controller::remove_item_link($this->socks), null, $this->ajaxHeaders);
     //remove one different = remove completely
     $data = json_decode($r->getBody(), true);
     $this->assertNotEmpty($data[AjaxHTTPResponse::EVENTS_KEY]['cartremove']);
     $this->assertFalse($this->cart->get($this->socks));
     $r = $this->get(ShoppingCart_Controller::remove_item_link($this->mp3player));
     //remove one product = 4 left
     $this->assertFalse($r instanceof AjaxHTTPResponse);
     $mp3playeritem = $this->cart->get($this->mp3player);
     $this->assertTrue($mp3playeritem !== false, "product still exists");
     $this->assertEquals($mp3playeritem->Quantity, 4, "only 4 of item left");
     $items = ShoppingCart::curr()->Items();
     $this->assertNotNull($items, "Cart is not empty");
     $this->cart->clear();
     //test clearing cart
     $this->assertEquals(ShoppingCart::curr(), null, 'Cart is clear');
     //items is a databoject set, and will therefore be null when cart is empty.
 }