EShoppingCart::remove PHP Method

remove() public method

Removes position from the shopping cart of key
public remove ( mixed $key ) : mixed | void
$key mixed
return mixed | void
    public function remove($key)
    {
        parent::remove($key);
        $this->applyDiscounts();
        $this->saveState();
        $this->eventManager->fire(CartEvents::CART_REMOVE_ITEM, new CartEvent(Yii::app()->getUser(), $this));
    }

Usage Example

Esempio n. 1
0
 function testEventOnRemovePosition()
 {
     $this->setUp();
     $cart = new EShoppingCart();
     $this->testVar = false;
     $cart->attachEventHandler('onRemovePosition', array($this, 'testEventHandler'));
     $book = Book::model()->findByPk(1);
     $cart->put($book);
     $cart->remove($book->getId());
     $this->assertTrue($cart->hasEvent('onRemovePosition'));
     $this->assertTrue($cart->hasEventHandler('onRemovePosition'));
     $this->assertTrue($this->testVar);
 }
All Usage Examples Of EShoppingCart::remove