|
@@ -32,11 +32,11 @@ discard block |
|
|
block discarded – undo |
|
32
|
32
|
* @param \Aimeos\MShop\Context\Item\Iface $context Object storing the required instances for manaing databases |
|
33
|
33
|
* connections, logger, session, etc. |
|
34
|
34
|
*/ |
|
35
|
|
- public function __construct( \Aimeos\MShop\Context\Item\Iface $context ) |
|
|
35
|
+ public function __construct(\Aimeos\MShop\Context\Item\Iface $context) |
|
36
|
36
|
{ |
|
37
|
|
- parent::__construct( $context ); |
|
|
37
|
+ parent::__construct($context); |
|
38
|
38
|
|
|
39
|
|
- $this->domainManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base' ); |
|
|
39
|
+ $this->domainManager = \Aimeos\MShop\Factory::createManager($context, 'order/base'); |
|
40
|
40
|
$this->basket = $this->domainManager->getSession(); |
|
41
|
41
|
|
|
42
|
42
|
$this->checkLocale(); |
|
@@ -48,8 +48,8 @@ discard block |
|
|
block discarded – undo |
|
48
|
48
|
*/ |
|
49
|
49
|
public function save() |
|
50
|
50
|
{ |
|
51
|
|
- if( $this->basket->isModified() ) { |
|
52
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
51
|
+ if ($this->basket->isModified()) { |
|
|
52
|
+ $this->domainManager->setSession($this->basket); |
|
53
|
53
|
} |
|
54
|
54
|
} |
|
55
|
55
|
|
|
@@ -60,7 +60,7 @@ discard block |
|
|
block discarded – undo |
|
60
|
60
|
public function clear() |
|
61
|
61
|
{ |
|
62
|
62
|
$this->basket = $this->domainManager->createItem(); |
|
63
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
63
|
+ $this->domainManager->setSession($this->basket); |
|
64
|
64
|
} |
|
65
|
65
|
|
|
66
|
66
|
|
|
@@ -95,48 +95,48 @@ discard block |
|
|
block discarded – undo |
|
95
|
95
|
* @param string $warehouse Unique code of the warehouse to deliver the products from |
|
96
|
96
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception If the product isn't available |
|
97
|
97
|
*/ |
|
98
|
|
- public function addProduct( $prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
|
98
|
+ public function addProduct($prodid, $quantity = 1, array $options = array(), array $variantAttributeIds = array(), |
|
99
|
99
|
array $configAttributeIds = array(), array $hiddenAttributeIds = array(), array $customAttributeValues = array(), |
|
100
|
|
- $warehouse = 'default' ) |
|
|
100
|
+ $warehouse = 'default') |
|
101
|
101
|
{ |
|
102
|
102
|
$context = $this->getContext(); |
|
103
|
103
|
|
|
104
|
|
- $productItem = $this->getDomainItem( 'product', 'product.id', $prodid, array( 'media', 'supplier', 'price', 'product', 'text' ) ); |
|
|
104
|
+ $productItem = $this->getDomainItem('product', 'product.id', $prodid, array('media', 'supplier', 'price', 'product', 'text')); |
|
105
|
105
|
|
|
106
|
|
- $orderBaseProductItem = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product' )->createItem(); |
|
107
|
|
- $orderBaseProductItem->copyFrom( $productItem ); |
|
108
|
|
- $orderBaseProductItem->setQuantity( $quantity ); |
|
109
|
|
- $orderBaseProductItem->setWarehouseCode( $warehouse ); |
|
|
106
|
+ $orderBaseProductItem = \Aimeos\MShop\Factory::createManager($context, 'order/base/product')->createItem(); |
|
|
107
|
+ $orderBaseProductItem->copyFrom($productItem); |
|
|
108
|
+ $orderBaseProductItem->setQuantity($quantity); |
|
|
109
|
+ $orderBaseProductItem->setWarehouseCode($warehouse); |
|
110
|
110
|
|
|
111
|
111
|
$attr = array(); |
|
112
|
|
- $prices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
|
112
|
+ $prices = $productItem->getRefItems('price', 'default', 'default'); |
|
113
|
113
|
|
|
114
|
|
- switch( $productItem->getType() ) |
|
|
114
|
+ switch ($productItem->getType()) |
|
115
|
115
|
{ |
|
116
|
116
|
case 'select': |
|
117
|
|
- $attr = $this->getVariantDetails( $orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options ); |
|
|
117
|
+ $attr = $this->getVariantDetails($orderBaseProductItem, $productItem, $prices, $variantAttributeIds, $options); |
|
118
|
118
|
break; |
|
119
|
119
|
case 'bundle': |
|
120
|
|
- $this->addBundleProducts( $orderBaseProductItem, $productItem, $variantAttributeIds, $warehouse ); |
|
|
120
|
+ $this->addBundleProducts($orderBaseProductItem, $productItem, $variantAttributeIds, $warehouse); |
|
121
|
121
|
break; |
|
122
|
122
|
} |
|
123
|
123
|
|
|
124
|
|
- $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
125
|
|
- $price = $priceManager->getLowestPrice( $prices, $quantity ); |
|
|
124
|
+ $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
|
125
|
+ $price = $priceManager->getLowestPrice($prices, $quantity); |
|
126
|
126
|
|
|
127
|
|
- $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $configAttributeIds, 'config' ) ); |
|
128
|
|
- $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, $hiddenAttributeIds, 'hidden' ) ); |
|
129
|
|
- $attr = array_merge( $attr, $this->createOrderProductAttributes( $price, $prodid, $quantity, array_keys( $customAttributeValues ), 'custom', $customAttributeValues ) ); |
|
|
127
|
+ $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $configAttributeIds, 'config')); |
|
|
128
|
+ $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, $hiddenAttributeIds, 'hidden')); |
|
|
129
|
+ $attr = array_merge($attr, $this->createOrderProductAttributes($price, $prodid, $quantity, array_keys($customAttributeValues), 'custom', $customAttributeValues)); |
|
130
|
130
|
|
|
131
|
131
|
// remove product rebate of original price in favor to rebates granted for the order |
|
132
|
|
- $price->setRebate( '0.00' ); |
|
|
132
|
+ $price->setRebate('0.00'); |
|
133
|
133
|
|
|
134
|
|
- $orderBaseProductItem->setPrice( $price ); |
|
135
|
|
- $orderBaseProductItem->setAttributes( $attr ); |
|
|
134
|
+ $orderBaseProductItem->setPrice($price); |
|
|
135
|
+ $orderBaseProductItem->setAttributes($attr); |
|
136
|
136
|
|
|
137
|
|
- $this->addProductInStock( $orderBaseProductItem, $productItem->getId(), $quantity, $options, $warehouse ); |
|
|
137
|
+ $this->addProductInStock($orderBaseProductItem, $productItem->getId(), $quantity, $options, $warehouse); |
|
138
|
138
|
|
|
139
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
139
|
+ $this->domainManager->setSession($this->basket); |
|
140
|
140
|
} |
|
141
|
141
|
|
|
142
|
142
|
|
|
@@ -145,18 +145,18 @@ discard block |
|
|
block discarded – undo |
|
145
|
145
|
* |
|
146
|
146
|
* @param integer $position Position number (key) of the order product item |
|
147
|
147
|
*/ |
|
148
|
|
- public function deleteProduct( $position ) |
|
|
148
|
+ public function deleteProduct($position) |
|
149
|
149
|
{ |
|
150
|
|
- $product = $this->basket->getProduct( $position ); |
|
|
150
|
+ $product = $this->basket->getProduct($position); |
|
151
|
151
|
|
|
152
|
|
- if( $product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
|
152
|
+ if ($product->getFlags() === \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
153
|
153
|
{ |
|
154
|
|
- $msg = sprintf( 'Basket item at position "%1$d" cannot be deleted manually', $position ); |
|
155
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
|
154
|
+ $msg = sprintf('Basket item at position "%1$d" cannot be deleted manually', $position); |
|
|
155
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
156
|
156
|
} |
|
157
|
157
|
|
|
158
|
|
- $this->basket->deleteProduct( $position ); |
|
159
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
158
|
+ $this->basket->deleteProduct($position); |
|
|
159
|
+ $this->domainManager->setSession($this->basket); |
|
160
|
160
|
} |
|
161
|
161
|
|
|
162
|
162
|
|
|
@@ -169,35 +169,35 @@ discard block |
|
|
block discarded – undo |
|
169
|
169
|
* The 'stock'=>false option allows adding products without being in stock. |
|
170
|
170
|
* @param string[] $configAttributeCodes Codes of the product config attributes that should be REMOVED |
|
171
|
171
|
*/ |
|
172
|
|
- public function editProduct( $position, $quantity, array $options = array(), |
|
173
|
|
- array $configAttributeCodes = array() ) |
|
|
172
|
+ public function editProduct($position, $quantity, array $options = array(), |
|
|
173
|
+ array $configAttributeCodes = array()) |
|
174
|
174
|
{ |
|
175
|
|
- $product = $this->basket->getProduct( $position ); |
|
176
|
|
- $product->setQuantity( $quantity ); // Enforce check immediately |
|
|
175
|
+ $product = $this->basket->getProduct($position); |
|
|
176
|
+ $product->setQuantity($quantity); // Enforce check immediately |
|
177
|
177
|
|
|
178
|
|
- if( $product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE ) |
|
|
178
|
+ if ($product->getFlags() & \Aimeos\MShop\Order\Item\Base\Product\Base::FLAG_IMMUTABLE) |
|
179
|
179
|
{ |
|
180
|
|
- $msg = sprintf( 'Basket item at position "%1$d" cannot be changed', $position ); |
|
181
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
|
180
|
+ $msg = sprintf('Basket item at position "%1$d" cannot be changed', $position); |
|
|
181
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
182
|
182
|
} |
|
183
|
183
|
|
|
184
|
184
|
$attributes = $product->getAttributes(); |
|
185
|
|
- foreach( $attributes as $key => $attribute ) |
|
|
185
|
+ foreach ($attributes as $key => $attribute) |
|
186
|
186
|
{ |
|
187
|
|
- if( in_array( $attribute->getCode(), $configAttributeCodes ) ) { |
|
188
|
|
- unset( $attributes[$key] ); |
|
|
187
|
+ if (in_array($attribute->getCode(), $configAttributeCodes)) { |
|
|
188
|
+ unset($attributes[$key]); |
|
189
|
189
|
} |
|
190
|
190
|
} |
|
191
|
|
- $product->setAttributes( $attributes ); |
|
|
191
|
+ $product->setAttributes($attributes); |
|
192
|
192
|
|
|
193
|
|
- $productItem = $this->getDomainItem( 'product', 'product.code', $product->getProductCode(), array( 'price', 'text' ) ); |
|
194
|
|
- $prices = $productItem->getRefItems( 'price', 'default' ); |
|
|
193
|
+ $productItem = $this->getDomainItem('product', 'product.code', $product->getProductCode(), array('price', 'text')); |
|
|
194
|
+ $prices = $productItem->getRefItems('price', 'default'); |
|
195
|
195
|
|
|
196
|
|
- $product->setPrice( $this->calcPrice( $product, $prices, $quantity ) ); |
|
|
196
|
+ $product->setPrice($this->calcPrice($product, $prices, $quantity)); |
|
197
|
197
|
|
|
198
|
|
- $this->editProductInStock( $product, $productItem, $quantity, $position, $options ); |
|
|
198
|
+ $this->editProductInStock($product, $productItem, $quantity, $position, $options); |
|
199
|
199
|
|
|
200
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
200
|
+ $this->domainManager->setSession($this->basket); |
|
201
|
201
|
} |
|
202
|
202
|
|
|
203
|
203
|
|
|
@@ -207,50 +207,50 @@ discard block |
|
|
block discarded – undo |
|
207
|
207
|
* @param string $code Coupon code entered by the user |
|
208
|
208
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid or not allowed |
|
209
|
209
|
*/ |
|
210
|
|
- public function addCoupon( $code ) |
|
|
210
|
+ public function addCoupon($code) |
|
211
|
211
|
{ |
|
212
|
|
- $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
213
|
|
- $codeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon/code' ); |
|
|
212
|
+ $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
|
213
|
+ $codeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon/code'); |
|
214
|
214
|
|
|
215
|
215
|
|
|
216
|
|
- $search = $codeManager->createSearch( true ); |
|
|
216
|
+ $search = $codeManager->createSearch(true); |
|
217
|
217
|
$expr = array( |
|
218
|
|
- $search->compare( '==', 'coupon.code.code', $code ), |
|
|
218
|
+ $search->compare('==', 'coupon.code.code', $code), |
|
219
|
219
|
$search->getConditions(), |
|
220
|
220
|
); |
|
221
|
|
- $search->setConditions( $search->combine( '&&', $expr ) ); |
|
222
|
|
- $search->setSlice( 0, 1 ); |
|
|
221
|
+ $search->setConditions($search->combine('&&', $expr)); |
|
|
222
|
+ $search->setSlice(0, 1); |
|
223
|
223
|
|
|
224
|
|
- $result = $codeManager->searchItems( $search ); |
|
|
224
|
+ $result = $codeManager->searchItems($search); |
|
225
|
225
|
|
|
226
|
|
- if( ( $codeItem = reset( $result ) ) === false ) { |
|
227
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid or not available any more', $code ) ); |
|
|
226
|
+ if (($codeItem = reset($result)) === false) { |
|
|
227
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid or not available any more', $code)); |
|
228
|
228
|
} |
|
229
|
229
|
|
|
230
|
230
|
|
|
231
|
|
- $search = $manager->createSearch( true ); |
|
|
231
|
+ $search = $manager->createSearch(true); |
|
232
|
232
|
$expr = array( |
|
233
|
|
- $search->compare( '==', 'coupon.id', $codeItem->getParentId() ), |
|
|
233
|
+ $search->compare('==', 'coupon.id', $codeItem->getParentId()), |
|
234
|
234
|
$search->getConditions(), |
|
235
|
235
|
); |
|
236
|
|
- $search->setConditions( $search->combine( '&&', $expr ) ); |
|
237
|
|
- $search->setSlice( 0, 1 ); |
|
|
236
|
+ $search->setConditions($search->combine('&&', $expr)); |
|
|
237
|
+ $search->setSlice(0, 1); |
|
238
|
238
|
|
|
239
|
|
- $result = $manager->searchItems( $search ); |
|
|
239
|
+ $result = $manager->searchItems($search); |
|
240
|
240
|
|
|
241
|
|
- if( ( $item = reset( $result ) ) === false ) { |
|
242
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon for code "%1$s" is not available any more', $code ) ); |
|
|
241
|
+ if (($item = reset($result)) === false) { |
|
|
242
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon for code "%1$s" is not available any more', $code)); |
|
243
|
243
|
} |
|
244
|
244
|
|
|
245
|
245
|
|
|
246
|
|
- $provider = $manager->getProvider( $item, $code ); |
|
|
246
|
+ $provider = $manager->getProvider($item, $code); |
|
247
|
247
|
|
|
248
|
|
- if( $provider->isAvailable( $this->basket ) !== true ) { |
|
249
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Requirements for coupon code "%1$s" aren\'t met', $code ) ); |
|
|
248
|
+ if ($provider->isAvailable($this->basket) !== true) { |
|
|
249
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Requirements for coupon code "%1$s" aren\'t met', $code)); |
|
250
|
250
|
} |
|
251
|
251
|
|
|
252
|
|
- $provider->addCoupon( $this->basket ); |
|
253
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
252
|
+ $provider->addCoupon($this->basket); |
|
|
253
|
+ $this->domainManager->setSession($this->basket); |
|
254
|
254
|
} |
|
255
|
255
|
|
|
256
|
256
|
|
|
@@ -260,22 +260,22 @@ discard block |
|
|
block discarded – undo |
|
260
|
260
|
* @param string $code Coupon code entered by the user |
|
261
|
261
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception if the coupon code is invalid |
|
262
|
262
|
*/ |
|
263
|
|
- public function deleteCoupon( $code ) |
|
|
263
|
+ public function deleteCoupon($code) |
|
264
|
264
|
{ |
|
265
|
|
- $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'coupon' ); |
|
|
265
|
+ $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'coupon'); |
|
266
|
266
|
|
|
267
|
267
|
$search = $manager->createSearch(); |
|
268
|
|
- $search->setConditions( $search->compare( '==', 'coupon.code.code', $code ) ); |
|
269
|
|
- $search->setSlice( 0, 1 ); |
|
|
268
|
+ $search->setConditions($search->compare('==', 'coupon.code.code', $code)); |
|
|
269
|
+ $search->setSlice(0, 1); |
|
270
|
270
|
|
|
271
|
|
- $result = $manager->searchItems( $search ); |
|
|
271
|
+ $result = $manager->searchItems($search); |
|
272
|
272
|
|
|
273
|
|
- if( ( $item = reset( $result ) ) === false ) { |
|
274
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Coupon code "%1$s" is invalid', $code ) ); |
|
|
273
|
+ if (($item = reset($result)) === false) { |
|
|
274
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Coupon code "%1$s" is invalid', $code)); |
|
275
|
275
|
} |
|
276
|
276
|
|
|
277
|
|
- $manager->getProvider( $item, $code )->deleteCoupon( $this->basket ); |
|
278
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
277
|
+ $manager->getProvider($item, $code)->deleteCoupon($this->basket); |
|
|
278
|
+ $this->domainManager->setSession($this->basket); |
|
279
|
279
|
} |
|
280
|
280
|
|
|
281
|
281
|
|
|
@@ -287,31 +287,31 @@ discard block |
|
|
block discarded – undo |
|
287
|
287
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception If the billing or delivery address is not of any required type of |
|
288
|
288
|
* if one of the keys is invalid when using an array with key/value pairs |
|
289
|
289
|
*/ |
|
290
|
|
- public function setAddress( $type, $value ) |
|
|
290
|
+ public function setAddress($type, $value) |
|
291
|
291
|
{ |
|
292
|
|
- $address = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/address' )->createItem(); |
|
293
|
|
- $address->setType( $type ); |
|
|
292
|
+ $address = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/address')->createItem(); |
|
|
293
|
+ $address->setType($type); |
|
294
|
294
|
|
|
295
|
|
- if( $value instanceof \Aimeos\MShop\Common\Item\Address\Iface ) |
|
|
295
|
+ if ($value instanceof \Aimeos\MShop\Common\Item\Address\Iface) |
|
296
|
296
|
{ |
|
297
|
|
- $address->copyFrom( $value ); |
|
298
|
|
- $this->basket->setAddress( $address, $type ); |
|
|
297
|
+ $address->copyFrom($value); |
|
|
298
|
+ $this->basket->setAddress($address, $type); |
|
299
|
299
|
} |
|
300
|
|
- else if( is_array( $value ) ) |
|
|
300
|
+ else if (is_array($value)) |
|
301
|
301
|
{ |
|
302
|
|
- $this->setAddressFromArray( $address, $value ); |
|
303
|
|
- $this->basket->setAddress( $address, $type ); |
|
|
302
|
+ $this->setAddressFromArray($address, $value); |
|
|
303
|
+ $this->basket->setAddress($address, $type); |
|
304
|
304
|
} |
|
305
|
|
- else if( $value === null ) |
|
|
305
|
+ else if ($value === null) |
|
306
|
306
|
{ |
|
307
|
|
- $this->basket->deleteAddress( $type ); |
|
|
307
|
+ $this->basket->deleteAddress($type); |
|
308
|
308
|
} |
|
309
|
309
|
else |
|
310
|
310
|
{ |
|
311
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) ); |
|
|
311
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception(sprintf('Invalid value for address type "%1$s"', $type)); |
|
312
|
312
|
} |
|
313
|
313
|
|
|
314
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
314
|
+ $this->domainManager->setSession($this->basket); |
|
315
|
315
|
} |
|
316
|
316
|
|
|
317
|
317
|
|
|
@@ -324,43 +324,43 @@ discard block |
|
|
block discarded – undo |
|
324
|
324
|
* entered by the customer when choosing one of the delivery or payment options |
|
325
|
325
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception If there is no price to the service item attached |
|
326
|
326
|
*/ |
|
327
|
|
- public function setService( $type, $id, array $attributes = array() ) |
|
|
327
|
+ public function setService($type, $id, array $attributes = array()) |
|
328
|
328
|
{ |
|
329
|
329
|
$context = $this->getContext(); |
|
330
|
330
|
|
|
331
|
|
- $serviceManager = \Aimeos\MShop\Factory::createManager( $context, 'service' ); |
|
332
|
|
- $serviceItem = $this->getDomainItem( 'service', 'service.id', $id, array( 'media', 'price', 'text' ) ); |
|
|
331
|
+ $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service'); |
|
|
332
|
+ $serviceItem = $this->getDomainItem('service', 'service.id', $id, array('media', 'price', 'text')); |
|
333
|
333
|
|
|
334
|
|
- $provider = $serviceManager->getProvider( $serviceItem ); |
|
335
|
|
- $result = $provider->checkConfigFE( $attributes ); |
|
336
|
|
- $unknown = array_diff_key( $attributes, $result ); |
|
|
334
|
+ $provider = $serviceManager->getProvider($serviceItem); |
|
|
335
|
+ $result = $provider->checkConfigFE($attributes); |
|
|
336
|
+ $unknown = array_diff_key($attributes, $result); |
|
337
|
337
|
|
|
338
|
|
- if( count( $unknown ) > 0 ) |
|
|
338
|
+ if (count($unknown) > 0) |
|
339
|
339
|
{ |
|
340
|
|
- $msg = sprintf( 'Unknown attributes "%1$s"', implode( '","', array_keys( $unknown ) ) ); |
|
341
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
|
340
|
+ $msg = sprintf('Unknown attributes "%1$s"', implode('","', array_keys($unknown))); |
|
|
341
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
342
|
342
|
} |
|
343
|
343
|
|
|
344
|
|
- foreach( $result as $key => $value ) |
|
|
344
|
+ foreach ($result as $key => $value) |
|
345
|
345
|
{ |
|
346
|
|
- if( $value !== null ) { |
|
347
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $value ); |
|
|
346
|
+ if ($value !== null) { |
|
|
347
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($value); |
|
348
|
348
|
} |
|
349
|
349
|
} |
|
350
|
350
|
|
|
351
|
|
- $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/service' ); |
|
|
351
|
+ $orderBaseServiceManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/service'); |
|
352
|
352
|
$orderServiceItem = $orderBaseServiceManager->createItem(); |
|
353
|
|
- $orderServiceItem->copyFrom( $serviceItem ); |
|
|
353
|
+ $orderServiceItem->copyFrom($serviceItem); |
|
354
|
354
|
|
|
355
|
|
- $price = $provider->calcPrice( $this->basket ); |
|
|
355
|
+ $price = $provider->calcPrice($this->basket); |
|
356
|
356
|
// remove service rebate of original price |
|
357
|
|
- $price->setRebate( '0.00' ); |
|
358
|
|
- $orderServiceItem->setPrice( $price ); |
|
|
357
|
+ $price->setRebate('0.00'); |
|
|
358
|
+ $orderServiceItem->setPrice($price); |
|
359
|
359
|
|
|
360
|
|
- $provider->setConfigFE( $orderServiceItem, $attributes ); |
|
|
360
|
+ $provider->setConfigFE($orderServiceItem, $attributes); |
|
361
|
361
|
|
|
362
|
|
- $this->basket->setService( $orderServiceItem, $type ); |
|
363
|
|
- $this->domainManager->setSession( $this->basket ); |
|
|
362
|
+ $this->basket->setService($orderServiceItem, $type); |
|
|
363
|
+ $this->domainManager->setSession($this->basket); |
|
364
|
364
|
} |
|
365
|
365
|
|
|
366
|
366
|
|
|
@@ -372,44 +372,44 @@ discard block |
|
|
block discarded – undo |
|
372
|
372
|
* @param array $variantAttributeIds List of product variant attribute IDs |
|
373
|
373
|
* @param string $warehouse |
|
374
|
374
|
*/ |
|
375
|
|
- protected function addBundleProducts( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
376
|
|
- \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $warehouse ) |
|
|
375
|
+ protected function addBundleProducts(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
|
376
|
+ \Aimeos\MShop\Product\Item\Iface $productItem, array $variantAttributeIds, $warehouse) |
|
377
|
377
|
{ |
|
378
|
378
|
$quantity = $orderBaseProductItem->getQuantity(); |
|
379
|
379
|
$products = $subProductIds = $orderProducts = array(); |
|
380
|
|
- $orderProductManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product' ); |
|
|
380
|
+ $orderProductManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product'); |
|
381
|
381
|
|
|
382
|
|
- foreach( $productItem->getRefItems( 'product', null, 'default' ) as $item ) { |
|
|
382
|
+ foreach ($productItem->getRefItems('product', null, 'default') as $item) { |
|
383
|
383
|
$subProductIds[] = $item->getId(); |
|
384
|
384
|
} |
|
385
|
385
|
|
|
386
|
|
- if( count( $subProductIds ) > 0 ) |
|
|
386
|
+ if (count($subProductIds) > 0) |
|
387
|
387
|
{ |
|
388
|
|
- $productManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
|
388
|
+ $productManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
389
|
389
|
|
|
390
|
|
- $search = $productManager->createSearch( true ); |
|
|
390
|
+ $search = $productManager->createSearch(true); |
|
391
|
391
|
$expr = array( |
|
392
|
|
- $search->compare( '==', 'product.id', $subProductIds ), |
|
|
392
|
+ $search->compare('==', 'product.id', $subProductIds), |
|
393
|
393
|
$search->getConditions(), |
|
394
|
394
|
); |
|
395
|
|
- $search->setConditions( $search->combine( '&&', $expr ) ); |
|
|
395
|
+ $search->setConditions($search->combine('&&', $expr)); |
|
396
|
396
|
|
|
397
|
|
- $products = $productManager->searchItems( $search, array( 'attribute', 'media', 'price', 'text' ) ); |
|
|
397
|
+ $products = $productManager->searchItems($search, array('attribute', 'media', 'price', 'text')); |
|
398
|
398
|
} |
|
399
|
399
|
|
|
400
|
|
- foreach( $products as $product ) |
|
|
400
|
+ foreach ($products as $product) |
|
401
|
401
|
{ |
|
402
|
|
- $prices = $product->getRefItems( 'price', 'default', 'default' ); |
|
|
402
|
+ $prices = $product->getRefItems('price', 'default', 'default'); |
|
403
|
403
|
|
|
404
|
404
|
$orderProduct = $orderProductManager->createItem(); |
|
405
|
|
- $orderProduct->copyFrom( $product ); |
|
406
|
|
- $orderProduct->setWarehouseCode( $warehouse ); |
|
407
|
|
- $orderProduct->setPrice( $this->calcPrice( $orderProduct, $prices, $quantity ) ); |
|
|
405
|
+ $orderProduct->copyFrom($product); |
|
|
406
|
+ $orderProduct->setWarehouseCode($warehouse); |
|
|
407
|
+ $orderProduct->setPrice($this->calcPrice($orderProduct, $prices, $quantity)); |
|
408
|
408
|
|
|
409
|
409
|
$orderProducts[] = $orderProduct; |
|
410
|
410
|
} |
|
411
|
411
|
|
|
412
|
|
- $orderBaseProductItem->setProducts( $orderProducts ); |
|
|
412
|
+ $orderBaseProductItem->setProducts($orderProducts); |
|
413
|
413
|
} |
|
414
|
414
|
|
|
415
|
415
|
|
|
@@ -423,32 +423,32 @@ discard block |
|
|
block discarded – undo |
|
423
|
423
|
* @param string $warehouse Warehouse code for retrieving the stock level |
|
424
|
424
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception If there's not enough stock available |
|
425
|
425
|
*/ |
|
426
|
|
- protected function addProductInStock( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
427
|
|
- $productId, $quantity, array $options, $warehouse ) |
|
|
426
|
+ protected function addProductInStock(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
|
427
|
+ $productId, $quantity, array $options, $warehouse) |
|
428
|
428
|
{ |
|
429
|
429
|
$stocklevel = null; |
|
430
|
|
- if( !isset( $options['stock'] ) || $options['stock'] != false ) { |
|
431
|
|
- $stocklevel = $this->getStockLevel( $productId, $warehouse ); |
|
|
430
|
+ if (!isset($options['stock']) || $options['stock'] != false) { |
|
|
431
|
+ $stocklevel = $this->getStockLevel($productId, $warehouse); |
|
432
|
432
|
} |
|
433
|
433
|
|
|
434
|
|
- if( $stocklevel === null || $stocklevel > 0 ) |
|
|
434
|
+ if ($stocklevel === null || $stocklevel > 0) |
|
435
|
435
|
{ |
|
436
|
|
- $position = $this->get()->addProduct( $orderBaseProductItem ); |
|
437
|
|
- $orderBaseProductItem = clone $this->get()->getProduct( $position ); |
|
|
436
|
+ $position = $this->get()->addProduct($orderBaseProductItem); |
|
|
437
|
+ $orderBaseProductItem = clone $this->get()->getProduct($position); |
|
438
|
438
|
$quantity = $orderBaseProductItem->getQuantity(); |
|
439
|
439
|
|
|
440
|
|
- if( $stocklevel > 0 && $stocklevel < $quantity ) |
|
|
440
|
+ if ($stocklevel > 0 && $stocklevel < $quantity) |
|
441
|
441
|
{ |
|
442
|
|
- $this->get()->deleteProduct( $position ); |
|
443
|
|
- $orderBaseProductItem->setQuantity( $stocklevel ); |
|
444
|
|
- $this->get()->addProduct( $orderBaseProductItem, $position ); |
|
|
442
|
+ $this->get()->deleteProduct($position); |
|
|
443
|
+ $orderBaseProductItem->setQuantity($stocklevel); |
|
|
444
|
+ $this->get()->addProduct($orderBaseProductItem, $position); |
|
445
|
445
|
} |
|
446
|
446
|
} |
|
447
|
447
|
|
|
448
|
|
- if( $stocklevel !== null && $stocklevel < $quantity ) |
|
|
448
|
+ if ($stocklevel !== null && $stocklevel < $quantity) |
|
449
|
449
|
{ |
|
450
|
|
- $msg = sprintf( 'There are not enough products "%1$s" in stock', $orderBaseProductItem->getName() ); |
|
451
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
|
450
|
+ $msg = sprintf('There are not enough products "%1$s" in stock', $orderBaseProductItem->getName()); |
|
|
451
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
452
|
452
|
} |
|
453
|
453
|
} |
|
454
|
454
|
|
|
@@ -464,36 +464,36 @@ discard block |
|
|
block discarded – undo |
|
464
|
464
|
* @param array $attributeValues Associative list of attribute IDs as keys and their codes as values |
|
465
|
465
|
* @return array List of items implementing \Aimeos\MShop\Order\Item\Product\Attribute\Iface |
|
466
|
466
|
*/ |
|
467
|
|
- protected function createOrderProductAttributes( \Aimeos\MShop\Price\Item\Iface $price, $prodid, $quantity, |
|
468
|
|
- array $attributeIds, $type, array $attributeValues = array() ) |
|
|
467
|
+ protected function createOrderProductAttributes(\Aimeos\MShop\Price\Item\Iface $price, $prodid, $quantity, |
|
|
468
|
+ array $attributeIds, $type, array $attributeValues = array()) |
|
469
|
469
|
{ |
|
470
|
|
- if( empty( $attributeIds ) ) { |
|
|
470
|
+ if (empty($attributeIds)) { |
|
471
|
471
|
return array(); |
|
472
|
472
|
} |
|
473
|
473
|
|
|
474
|
|
- $attrTypeId = $this->getProductListTypeItem( 'attribute', $type )->getId(); |
|
475
|
|
- $this->checkReferences( $prodid, 'attribute', $attrTypeId, $attributeIds ); |
|
|
474
|
+ $attrTypeId = $this->getProductListTypeItem('attribute', $type)->getId(); |
|
|
475
|
+ $this->checkReferences($prodid, 'attribute', $attrTypeId, $attributeIds); |
|
476
|
476
|
|
|
477
|
477
|
$list = array(); |
|
478
|
478
|
$context = $this->getContext(); |
|
479
|
479
|
|
|
480
|
|
- $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
481
|
|
- $orderProductAttributeManager = \Aimeos\MShop\Factory::createManager( $context, 'order/base/product/attribute' ); |
|
|
480
|
+ $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
|
481
|
+ $orderProductAttributeManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/product/attribute'); |
|
482
|
482
|
|
|
483
|
|
- foreach( $this->getAttributes( $attributeIds ) as $id => $attrItem ) |
|
|
483
|
+ foreach ($this->getAttributes($attributeIds) as $id => $attrItem) |
|
484
|
484
|
{ |
|
485
|
|
- $prices = $attrItem->getRefItems( 'price', 'default', 'default' ); |
|
|
485
|
+ $prices = $attrItem->getRefItems('price', 'default', 'default'); |
|
486
|
486
|
|
|
487
|
|
- if( !empty( $prices ) ) { |
|
488
|
|
- $price->addItem( $priceManager->getLowestPrice( $prices, $quantity ) ); |
|
|
487
|
+ if (!empty($prices)) { |
|
|
488
|
+ $price->addItem($priceManager->getLowestPrice($prices, $quantity)); |
|
489
|
489
|
} |
|
490
|
490
|
|
|
491
|
491
|
$item = $orderProductAttributeManager->createItem(); |
|
492
|
|
- $item->copyFrom( $attrItem ); |
|
493
|
|
- $item->setType( $type ); |
|
|
492
|
+ $item->copyFrom($attrItem); |
|
|
493
|
+ $item->setType($type); |
|
494
|
494
|
|
|
495
|
|
- if( isset( $attributeValues[$id] ) ) { |
|
496
|
|
- $item->setValue( $attributeValues[$id] ); |
|
|
495
|
+ if (isset($attributeValues[$id])) { |
|
|
496
|
+ $item->setValue($attributeValues[$id]); |
|
497
|
497
|
} |
|
498
|
498
|
|
|
499
|
499
|
$list[] = $item; |
|
@@ -513,26 +513,26 @@ discard block |
|
|
block discarded – undo |
|
513
|
513
|
* @param array Associative list of options |
|
514
|
514
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception If there's not enough stock available |
|
515
|
515
|
*/ |
|
516
|
|
- protected function editProductInStock( \Aimeos\MShop\Order\Item\Base\Product\Iface $product, |
|
517
|
|
- \Aimeos\MShop\Product\Item\Iface $productItem, $quantity, $position, array $options ) |
|
|
516
|
+ protected function editProductInStock(\Aimeos\MShop\Order\Item\Base\Product\Iface $product, |
|
|
517
|
+ \Aimeos\MShop\Product\Item\Iface $productItem, $quantity, $position, array $options) |
|
518
|
518
|
{ |
|
519
|
519
|
$stocklevel = null; |
|
520
|
|
- if( !isset( $options['stock'] ) || $options['stock'] != false ) { |
|
521
|
|
- $stocklevel = $this->getStockLevel( $productItem->getId(), $product->getWarehouseCode() ); |
|
|
520
|
+ if (!isset($options['stock']) || $options['stock'] != false) { |
|
|
521
|
+ $stocklevel = $this->getStockLevel($productItem->getId(), $product->getWarehouseCode()); |
|
522
|
522
|
} |
|
523
|
523
|
|
|
524
|
|
- $product->setQuantity( ( $stocklevel !== null && $stocklevel > 0 ? min( $stocklevel, $quantity ) : $quantity ) ); |
|
|
524
|
+ $product->setQuantity(($stocklevel !== null && $stocklevel > 0 ? min($stocklevel, $quantity) : $quantity)); |
|
525
|
525
|
|
|
526
|
|
- $this->get()->deleteProduct( $position ); |
|
|
526
|
+ $this->get()->deleteProduct($position); |
|
527
|
527
|
|
|
528
|
|
- if( $stocklevel === null || $stocklevel > 0 ) { |
|
529
|
|
- $this->get()->addProduct( $product, $position ); |
|
|
528
|
+ if ($stocklevel === null || $stocklevel > 0) { |
|
|
529
|
+ $this->get()->addProduct($product, $position); |
|
530
|
530
|
} |
|
531
|
531
|
|
|
532
|
|
- if( $stocklevel !== null && $stocklevel < $quantity ) |
|
|
532
|
+ if ($stocklevel !== null && $stocklevel < $quantity) |
|
533
|
533
|
{ |
|
534
|
|
- $msg = sprintf( 'There are not enough products "%1$s" in stock', $productItem->getName() ); |
|
535
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
|
534
|
+ $msg = sprintf('There are not enough products "%1$s" in stock', $productItem->getName()); |
|
|
535
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
536
|
536
|
} |
|
537
|
537
|
} |
|
538
|
538
|
|
|
@@ -547,23 +547,23 @@ discard block |
|
|
block discarded – undo |
|
547
|
547
|
* @return \Aimeos\MShop\Common\Item\Iface Domain item object |
|
548
|
548
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception |
|
549
|
549
|
*/ |
|
550
|
|
- protected function getDomainItem( $domain, $key, $value, array $ref ) |
|
|
550
|
+ protected function getDomainItem($domain, $key, $value, array $ref) |
|
551
|
551
|
{ |
|
552
|
|
- $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $domain ); |
|
|
552
|
+ $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), $domain); |
|
553
|
553
|
|
|
554
|
|
- $search = $manager->createSearch( true ); |
|
|
554
|
+ $search = $manager->createSearch(true); |
|
555
|
555
|
$expr = array( |
|
556
|
|
- $search->compare( '==', $key, $value ), |
|
|
556
|
+ $search->compare('==', $key, $value), |
|
557
|
557
|
$search->getConditions(), |
|
558
|
558
|
); |
|
559
|
|
- $search->setConditions( $search->combine( '&&', $expr ) ); |
|
|
559
|
+ $search->setConditions($search->combine('&&', $expr)); |
|
560
|
560
|
|
|
561
|
|
- $result = $manager->searchItems( $search, $ref ); |
|
|
561
|
+ $result = $manager->searchItems($search, $ref); |
|
562
|
562
|
|
|
563
|
|
- if( ( $item = reset( $result ) ) === false ) |
|
|
563
|
+ if (($item = reset($result)) === false) |
|
564
|
564
|
{ |
|
565
|
|
- $msg = sprintf( 'No item for "%1$s" (%2$s) found', $value, $key ); |
|
566
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
|
565
|
+ $msg = sprintf('No item for "%1$s" (%2$s) found', $value, $key); |
|
|
566
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
567
|
567
|
} |
|
568
|
568
|
|
|
569
|
569
|
return $item; |
|
@@ -581,44 +581,44 @@ discard block |
|
|
block discarded – undo |
|
581
|
581
|
* @return \Aimeos\MShop\Order\Item\Base\Product\Attribute\Iface[] List of order product attributes |
|
582
|
582
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception If no product variant is found |
|
583
|
583
|
*/ |
|
584
|
|
- protected function getVariantDetails( \Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
585
|
|
- \Aimeos\MShop\Product\Item\Iface &$productItem, array &$prices, array $variantAttributeIds, array $options ) |
|
|
584
|
+ protected function getVariantDetails(\Aimeos\MShop\Order\Item\Base\Product\Iface $orderBaseProductItem, |
|
|
585
|
+ \Aimeos\MShop\Product\Item\Iface & $productItem, array &$prices, array $variantAttributeIds, array $options) |
|
586
|
586
|
{ |
|
587
|
587
|
$attr = array(); |
|
588
|
|
- $productItems = $this->getProductVariants( $productItem, $variantAttributeIds ); |
|
|
588
|
+ $productItems = $this->getProductVariants($productItem, $variantAttributeIds); |
|
589
|
589
|
|
|
590
|
|
- if( count( $productItems ) > 1 ) |
|
|
590
|
+ if (count($productItems) > 1) |
|
591
|
591
|
{ |
|
592
|
|
- $msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() ); |
|
593
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
|
592
|
+ $msg = sprintf('No unique article found for selected attributes and product ID "%1$s"', $productItem->getId()); |
|
|
593
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
594
|
594
|
} |
|
595
|
|
- else if( ( $result = reset( $productItems ) ) !== false ) // count == 1 |
|
|
595
|
+ else if (($result = reset($productItems)) !== false) // count == 1 |
|
596
|
596
|
{ |
|
597
|
597
|
$productItem = $result; |
|
598
|
|
- $orderBaseProductItem->setProductCode( $productItem->getCode() ); |
|
|
598
|
+ $orderBaseProductItem->setProductCode($productItem->getCode()); |
|
599
|
599
|
|
|
600
|
|
- $subprices = $productItem->getRefItems( 'price', 'default', 'default' ); |
|
|
600
|
+ $subprices = $productItem->getRefItems('price', 'default', 'default'); |
|
601
|
601
|
|
|
602
|
|
- if( count( $subprices ) > 0 ) { |
|
|
602
|
+ if (count($subprices) > 0) { |
|
603
|
603
|
$prices = $subprices; |
|
604
|
604
|
} |
|
605
|
605
|
|
|
606
|
|
- $orderProductAttrManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'order/base/product/attribute' ); |
|
607
|
|
- $variantAttributes = $productItem->getRefItems( 'attribute', null, 'variant' ); |
|
|
606
|
+ $orderProductAttrManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'order/base/product/attribute'); |
|
|
607
|
+ $variantAttributes = $productItem->getRefItems('attribute', null, 'variant'); |
|
608
|
608
|
|
|
609
|
|
- foreach( $this->getAttributes( array_keys( $variantAttributes ), array( 'text' ) ) as $attrItem ) |
|
|
609
|
+ foreach ($this->getAttributes(array_keys($variantAttributes), array('text')) as $attrItem) |
|
610
|
610
|
{ |
|
611
|
611
|
$orderAttributeItem = $orderProductAttrManager->createItem(); |
|
612
|
|
- $orderAttributeItem->copyFrom( $attrItem ); |
|
613
|
|
- $orderAttributeItem->setType( 'variant' ); |
|
|
612
|
+ $orderAttributeItem->copyFrom($attrItem); |
|
|
613
|
+ $orderAttributeItem->setType('variant'); |
|
614
|
614
|
|
|
615
|
615
|
$attr[] = $orderAttributeItem; |
|
616
|
616
|
} |
|
617
|
617
|
} |
|
618
|
|
- else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0 |
|
|
618
|
+ else if (!isset($options['variant']) || $options['variant'] != false) // count == 0 |
|
619
|
619
|
{ |
|
620
|
|
- $msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() ); |
|
621
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
|
|
620
|
+ $msg = sprintf('No article found for selected attributes and product ID "%1$s"', $productItem->getId()); |
|
|
621
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg); |
|
622
|
622
|
} |
|
623
|
623
|
|
|
624
|
624
|
return $attr; |
|
@@ -633,18 +633,18 @@ discard block |
|
|
block discarded – undo |
|
633
|
633
|
* an address item. |
|
634
|
634
|
* @throws \Aimeos\Controller\Frontend\Basket\Exception |
|
635
|
635
|
*/ |
|
636
|
|
- protected function setAddressFromArray( \Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map ) |
|
|
636
|
+ protected function setAddressFromArray(\Aimeos\MShop\Order\Item\Base\Address\Iface $address, array $map) |
|
637
|
637
|
{ |
|
638
|
|
- foreach( $map as $key => $value ) { |
|
639
|
|
- $map[$key] = strip_tags( $value ); // prevent XSS |
|
|
638
|
+ foreach ($map as $key => $value) { |
|
|
639
|
+ $map[$key] = strip_tags($value); // prevent XSS |
|
640
|
640
|
} |
|
641
|
641
|
|
|
642
|
|
- $errors = $address->fromArray( $map ); |
|
|
642
|
+ $errors = $address->fromArray($map); |
|
643
|
643
|
|
|
644
|
|
- if( count( $errors ) > 0 ) |
|
|
644
|
+ if (count($errors) > 0) |
|
645
|
645
|
{ |
|
646
|
|
- $msg = sprintf( 'Invalid address properties, please check your input' ); |
|
647
|
|
- throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg, 0, null, $errors ); |
|
|
646
|
+ $msg = sprintf('Invalid address properties, please check your input'); |
|
|
647
|
+ throw new \Aimeos\Controller\Frontend\Basket\Exception($msg, 0, null, $errors); |
|
648
|
648
|
} |
|
649
|
649
|
} |
|
650
|
650
|
} |