public function deleteCoupon( $code, $removecode = false )
	{
		$products = array();

		if( isset( $this->_coupons[$code] ) )
		{
			$this->_notifyListeners( 'deleteCoupon.before', $code );

			$products = $this->_coupons[$code];

			foreach( $products as $product )
			{
				if( ( $key = array_search( $product, $this->_products, true ) ) !== false ) {
					unset( $this->_products[$key] );
				}
			}

			if( $removecode === true ) {
				unset( $this->_coupons[$code] );
			} else {
				$this->_coupons[$code] = array();
			}

			$this->_modified = true;

			$this->_notifyListeners( 'deleteCoupon.after' );
		}

		return $products;
	}
public function deleteCoupon( $code, $removecode = false )
	{
		$products = array();

		if( isset( $this->_coupons[$code] ) )
		{
			$this->_notifyListeners( 'deleteCoupon.before', $code );

			$products = $this->_coupons[$code];

			foreach( $products as $product )
			{
				if( ( $key = array_search( $product, $this->_products, true ) ) !== false ) {
					unset( $this->_products[$key] );
				}
			}

			if( $removecode === true ) {
				unset( $this->_coupons[$code] );
			} else {
				$this->_coupons[$code] = array();
			}

			$this->_modified = true;

			$this->_notifyListeners( 'deleteCoupon.after' );
		}

		return $products;
	}
public function deleteCoupon ( $ code , $ removecode = false ) { $ products = array ( ) ; if ( isset ( $ this -> _coupons [ $ code ] ) ) { $ this -> _notifyListeners ( 'deleteCoupon.before' , $ code ) ; $ products = $ this -> _coupons [ $ code ] ; foreach ( $ products as $ product ) { if ( ( $ key = array_search ( $ product , $ this -> _products , true ) ) !== false ) { unset ( $ this -> _products [ $ key ] ) ; } } if ( $ removecode === true ) { unset ( $ this -> _coupons [ $ code ] ) ; } else { $ this -> _coupons [ $ code ] = array ( ) ; } $ this -> _modified = true ; $ this -> _notifyListeners ( 'deleteCoupon.after' ) ; } return $ products ; }
Removes a coupon and the related product items from the basket.

@param string $code Coupon code
@param boolean $removecode If the coupon code should also be removed
@return array List of affected product items implementing MShop_Order_Item_Base_Product_Interface
or an empty list if no products are affected by a coupon
Removes a coupon and the related product items from the basket .