/** * 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)); } }