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 | * Adds a categorized product to the basket of the user stored in the session. |
||
105 | * |
||
106 | * @param string $prodid ID of the base product to add |
||
107 | * @param integer $quantity Amount of products that should by added |
||
108 | * @param array $options Possible options are: 'stock'=>true|false and 'variant'=>true|false |
||
109 | * The 'stock'=>false option allows adding products without being in stock. |
||
110 | * The 'variant'=>false option allows adding the selection product to the basket |
||
111 | * instead of the specific sub-product if the variant-building attribute IDs |
||
112 | * doesn't match a specific sub-product or if the attribute IDs are missing. |
||
113 | * @param array $variantAttributeIds List of variant-building attribute IDs that identify a specific product |
||
114 | * in a selection products |
||
115 | * @param array $configAttributeIds List of attribute IDs that doesn't identify a specific product in a |
||
116 | * selection of products but are stored together with the product (e.g. for configurable products) |
||
117 | * @param array $hiddenAttributeIds List of attribute IDs that should be stored along with the product in the order |
||
118 | * @param array $customAttributeValues Associative list of attribute IDs and arbitrary values that should be stored |
||
119 | * along with the product in the order |
||
120 | * @param string $stocktype Unique code of the stock type to deliver the products from |
||
121 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
||
122 | */ |
||
123 | public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
||
155 | |||
156 | |||
157 | /** |
||
158 | * Deletes a product item from the basket. |
||
159 | * |
||
160 | * @param integer $position Position number (key) of the order product item |
||
161 | */ |
||
162 | public function deleteProduct( $position ) |
||
175 | |||
176 | |||
177 | /** |
||
178 | * Edits the quantity of a product item in the basket. |
||
179 | * |
||
180 | * @param integer $position Position number (key) of the order product item |
||
181 | * @param integer $quantity New quantiy of the product item |
||
182 | * @param array $options Possible options are: 'stock'=>true|false |
||
183 | * The 'stock'=>false option allows adding products without being in stock. |
||
184 | * @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED |
||
185 | */ |
||
186 | public function editProduct( $position, $quantity, array $options = array(), |
||
217 | |||
218 | |||
219 | /** |
||
220 | * Adds the given coupon code and updates the basket. |
||
221 | * |
||
222 | * @param string $code Coupon code entered by the user |
||
223 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed |
||
224 | */ |
||
225 | public function addCoupon( $code ) |
||
270 | |||
271 | |||
272 | /** |
||
273 | * Removes the given coupon code and its effects from the basket. |
||
274 | * |
||
275 | * @param string $code Coupon code entered by the user |
||
276 | * @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid |
||
277 | */ |
||
278 | public function deleteCoupon( $code ) |
||
295 | |||
296 | |||
297 | /** |
||
298 | * Sets the address of the customer in the basket. |
||
299 | * |
||
300 | * @param string $type Address type constant from \Aimeos\MShop\Order\Item\Base\Address\Base |
||
301 | * @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 |
||
302 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of |
||
303 | * if one of the keys is invalid when using an array with key/value pairs |
||
304 | */ |
||
305 | public function setAddress( $type, $value ) |
||
331 | |||
332 | |||
333 | /** |
||
334 | * Sets the delivery/payment service item based on the service ID. |
||
335 | * |
||
336 | * @param string $type Service type code like 'payment' or 'delivery' |
||
337 | * @param string $id Unique ID of the service item |
||
338 | * @param array $attributes Associative list of key/value pairs containing the attributes selected or |
||
339 | * entered by the customer when choosing one of the delivery or payment options |
||
340 | * @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
||
341 | */ |
||
342 | public function setService( $type, $id, array $attributes = array() ) |
||
380 | |||
381 | |||
382 | /** |
||
383 | * Fills the order address object with the values from the array. |
||
384 | * |
||
385 | * @param \Aimeos\MShop\Order\Item\Base\Address\Iface $address Address item to store the values into |
||
386 | * @param array $map Associative array of key/value pairs. The keys must be the same as when calling toArray() from |
||
387 | * an address item. |
||
388 | * @throws \Aimeos\Controller\Frontend\Basket\Exception |
||
389 | */ |
||
390 | protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map ) |
||
404 | } |
||
405 |