1 | <?php |
||
21 | class Standard |
||
22 | extends Base |
||
2 ignored issues
–
show
|
|||
23 | implements Iface, \Aimeos\Controller\Frontend\Common\Iface |
||
1 ignored issue
–
show
|
|||
24 | { |
||
25 | private $baskets = array(); |
||
26 | private $domainManager; |
||
27 | private $type = 'default'; |
||
28 | |||
29 | |||
30 | /** |
||
31 | * Initializes the frontend controller. |
||
32 | * |
||
33 | * @param \Aimeos\MShop\Context\Item\Iface $context Object storing the required instances for manaing databases |
||
34 | * connections, logger, session, etc. |
||
35 | */ |
||
36 | public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
||
42 | |||
43 | |||
44 | /** |
||
45 | * Empties the basket and removing all products, addresses, services, etc. |
||
46 | * |
||
47 | * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object |
||
48 | */ |
||
49 | public function clear() |
||
56 | |||
57 | |||
58 | /** |
||
59 | * Returns the basket object. |
||
60 | * |
||
61 | * @return \Aimeos\MShop\Order\Item\Base\Iface Basket holding products, addresses and delivery/payment options |
||
62 | */ |
||
63 | public function get() |
||
73 | |||
74 | |||
75 | /** |
||
76 | * Explicitely persists the basket content |
||
77 | * |
||
78 | * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object |
||
79 | */ |
||
80 | public function save() |
||
88 | |||
89 | |||
90 | /** |
||
91 | * Sets the new basket type |
||
92 | * |
||
93 | * @param string $type Basket type |
||
94 | * @return \Aimeos\Controller\Frontend\Basket\Iface Basket frontend object |
||
95 | */ |
||
96 | public function setType( $type ) |
||
101 | |||
102 | |||
103 | /** |
||
104 | * Creates a new order base object from the current basket |
||
105 | * |
||
106 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including products, addresses and services |
||
107 | */ |
||
108 | public function store() |
||
118 | |||
119 | |||
120 | /** |
||
121 | * Returns the order base object for the given ID |
||
122 | * |
||
123 | * @param string $id Unique ID of the order base object |
||
124 | * @param integer $parts Constants which parts of the order base object should be loaded |
||
125 | * @return \Aimeos\MShop\Order\Item\Base\Iface Order base object including the given parts |
||
126 | */ |
||
127 | public function load( $id, $parts = \Aimeos\MShop\Order\Manager\Base\Base::PARTS_ALL ) |
||
131 | |||
132 | |||
133 | /** |
||
134 | * Adds a categorized product to the basket of the user stored in the session. |
||
135 | * |
||
136 | * @param string $prodid ID of the base product to add |
||
137 | * @param integer $quantity Amount of products that should by added |
||
138 | * @param array $options Possible options are: 'stock'=>true|false and 'variant'=>true|false |
||
139 | * The 'stock'=>false option allows adding products without being in stock. |
||
140 | * The 'variant'=>false option allows adding the selection product to the basket |
||
141 | * instead of the specific sub-product if the variant-building attribute IDs |
||
142 | * doesn't match a specific sub-product or if the attribute IDs are missing. |
||
143 | * @param array $variantAttributeIds List of variant-building attribute IDs that identify a specific product |
||
144 | * in a selection products |
||
145 | * @param array $configAttributeIds List of attribute IDs that doesn't identify a specific product in a |
||
146 | * selection of products but are stored together with the product (e.g. for configurable products) |
||
147 | * @param array $hiddenAttributeIds List of attribute IDs that should be stored along with the product in the order |
||
148 | * @param array $customAttributeValues Associative list of attribute IDs and arbitrary values that should be stored |
||
149 | * along with the product in the order |
||
150 | * @param string $stocktype Unique code of the stock type to deliver the products from |
||
151 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
||
152 | */ |
||
153 | public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
||
185 | |||
186 | |||
187 | /** |
||
188 | * Deletes a product item from the basket. |
||
189 | * |
||
190 | * @param integer $position Position number (key) of the order product item |
||
191 | */ |
||
192 | public function deleteProduct( $position ) |
||
205 | |||
206 | |||
207 | /** |
||
208 | * Edits the quantity of a product item in the basket. |
||
209 | * |
||
210 | * @param integer $position Position number (key) of the order product item |
||
211 | * @param integer $quantity New quantiy of the product item |
||
212 | * @param array $options Possible options are: 'stock'=>true|false |
||
213 | * The 'stock'=>false option allows adding products without being in stock. |
||
214 | * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED |
||
215 | */ |
||
216 | public function editProduct( $position, $quantity, array $options = array(), |
||
247 | |||
248 | |||
249 | /** |
||
250 | * Adds the given coupon code and updates the basket. |
||
251 | * |
||
252 | * @param string $code Coupon code entered by the user |
||
253 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed |
||
254 | */ |
||
255 | public function addCoupon( $code ) |
||
300 | |||
301 | |||
302 | /** |
||
303 | * Removes the given coupon code and its effects from the basket. |
||
304 | * |
||
305 | * @param string $code Coupon code entered by the user |
||
306 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid |
||
307 | */ |
||
308 | public function deleteCoupon( $code ) |
||
325 | |||
326 | |||
327 | /** |
||
328 | * Sets the address of the customer in the basket. |
||
329 | * |
||
330 | * @param string $type Address type constant from \Aimeos\MShop\Order\Item\Base\Address\Base |
||
331 | * @param \Aimeos\MShop\Common\Item\Address\Iface|array|null $value Address object or array with key/value pairs of address or null to remove address from basket |
||
332 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of |
||
333 | * if one of the keys is invalid when using an array with key/value pairs |
||
334 | */ |
||
335 | public function setAddress( $type, $value ) |
||
361 | |||
362 | |||
363 | /** |
||
364 | * Sets the delivery/payment service item based on the service ID. |
||
365 | * |
||
366 | * @param string $type Service type code like 'payment' or 'delivery' |
||
367 | * @param string $id Unique ID of the service item |
||
368 | * @param array $attributes Associative list of key/value pairs containing the attributes selected or |
||
369 | * entered by the customer when choosing one of the delivery or payment options |
||
370 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
||
371 | */ |
||
372 | public function setService( $type, $id, array $attributes = array() ) |
||
410 | |||
411 | |||
412 | /** |
||
413 | * Fills the order address object with the values from the array. |
||
414 | * |
||
415 | * @param \Aimeos\MShop\Order\Item\Base\Address\Iface $address Address item to store the values into |
||
416 | * @param array $map Associative array of key/value pairs. The keys must be the same as when calling toArray() from |
||
417 | * an address item. |
||
418 | * @throws \Aimeos\Controller\Frontend\Basket\Exception |
||
419 | */ |
||
420 | protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map ) |
||
434 | } |
||
435 |