setCartItemData($options['cartItemData']); } } public function getData($field = null, $default = null) { return array( 'title' => Entity::TITLE, 'description' => Entity::DESCRIPTION, 'soldOut' => 'n', 'show' => 'y', 'deleted' => 'n', ); } /** * for change quantity, etc. * * @return array [name => bool value, ...] */ public static function getCartItemCapabilities() { return []; } /** * Method should set primary key and init item object * @param array $data ['id' =>, 'cartId' =>, 'productId' =>, ...] * * @return mixed */ public function setCartItemData(array $data) { $this->_cartItemData = $data; return $this; } public function getCartItemData() { return $this->_cartItemData; } /** * Prepare item data * @return array */ public function prepareCartItemData() { $this->_cartItemData = $this->getData() + $this->_cartItemData + [ 'price' => Entity::PRICE, 'quantity' => 1, 'allowChangeQuantity' => 'n', 'showDescription' => 'y', 'cartItemType' => 'ECommerce\\ServiceProduct\\', 'typeTitle' => Entity::CART_ITEM_TYPE_TITLE, 'applyTax' => 'n', 'applyShipping' => 'n', ]; return $this->_cartItemData; } public function beforeValidateCart() { } /** * @return bool */ public function validateCartItem() { return true; } public function completeItemList(array $itemList) { return $this; } public function afterCartItemRemove() { return $this; } public function getErrors() { return $this->_errors; } /** * assign additionalData to $_cartData for displaying at cart full list * * @return mixed */ public function prepareCartItemForCartList() { $this->_cartItemData['additionalData'] = ''; return $this; } }