bool value, ...] */ public static function getCartItemCapabilities() { return []; } public function setErrors(array $errors) { $this->_errors = $errors; return $this; } public function addErrors(array $errors) { $this->_errors = $this->_errors + $errors; return $this; } /** * Method should set primary key and init item object * @param array $data ['id' =>, 'cartId' =>, 'productId' =>, ...] * * @return CartItemObj */ public function setCartItemData(array $data) { $this->_cartItemData = $data; $this->setPrimaryKey($this->_cartItemData['id']); return $this; } public function getCartItemData() { return $this->_cartItemData; } /** * Prepare item data (from db) * @return array */ public function prepareCartItemData() { $allowChangeQuantity = in_array(ItemObjFactory::CAPABILITY_CHANGE_QTY, $this->getCartItemCapabilities()) ? 'y' : 'n'; $itemData = [ 'cartItemType' => static::ITEM_TYPE, 'typeTitle' => static::ITEM_TYPE_TITLE, 'description' => '', 'applyTax' => 'n', 'applyShipping' => 'n', 'allowChangeQuantity' => $allowChangeQuantity, 'showDescription' => 'y', 'url' => View::getPage('url'), ]; $this->_cartItemData = array_merge($this->_cartItemData, $itemData); return $this->_cartItemData; } public function beforeValidateCart() { return $this; } /** * @return bool */ public function validateCartItem() { return true; } public function completeItemList(array $itemList) { return $this; } public function afterCartItemRemove() { return $this; } /** * assign additionalData to $_cartData for displaying at cart full list * * @return mixed */ public function prepareCartItemForCartList() { $this->_cartItemData['additionalData'] = ''; return $this; } }