Beispiel #1
0
 /**
  * @param ShopgateCartItem $c
  */
 public function visitCartItem(ShopgateCartItem $c)
 {
     $properties = $c->buildProperties();
     // iterate the simple variables
     $properties = $this->iterateSimpleProperties($properties);
     // iterate ShopgateAddress objects
     $properties['options'] = $this->iterateObjectList($properties['options']);
     $properties['inputs'] = $this->iterateObjectList($properties['inputs']);
     $properties['attributes'] = $this->iterateObjectList($properties['attributes']);
     // set last value to converted array
     $this->array = $properties;
 }
Beispiel #2
0
 /**
  * Generates a ShopgateCartItem for the checkCart Response
  *
  * @param Mage_Catalog_Model_Product $product
  * @param boolean                    $isBuyable
  * @param int                        $qtyBuyable
  * @param int|float                  $priceExclTax
  * @param int|float                  $priceInclTax
  * @param array                      $errors
  * @param bool                       $stockQuantity
  *
  * @return ShopgateCartItem
  */
 public function generateShopgateCartItem($product, $isBuyable = false, $qtyBuyable = 0, $priceInclTax = 0, $priceExclTax = 0, $errors = array(), $stockQuantity = false)
 {
     $item = new ShopgateCartItem();
     $item->setItemNumber($product->getShopgateItemNumber());
     $item->setOptions($product->getShopgateOptions());
     $item->setInputs($product->getShopgateInputs());
     $item->setAttributes($product->getShhopgateAttributes());
     $item->setIsBuyable((int) $isBuyable);
     $item->setQtyBuyable($qtyBuyable);
     $item->setStockQuantity($stockQuantity);
     $item->setUnitAmount($priceExclTax);
     $item->setUnitAmountWithTax($priceInclTax);
     foreach ($errors as $error) {
         $item->setError($error['type']);
         $item->setErrorText($error['message']);
     }
     return $item;
 }
 /**
  * add a item exception
  *
  * @param ShopgateCartItem $item
  * @param                  $code
  * @param mixed            $message
  */
 protected function _addItemException(ShopgateCartItem $item, $code, $message = false)
 {
     $item->setError($code);
     /**
      * add custom message
      */
     if ($message) {
         $item->setErrorText($message);
     } else {
         $item->setErrorText(ShopgateLibraryException::getMessageFor($code));
     }
 }