@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | { |
68 | 68 | $view = $this->getView(); |
69 | 69 | |
70 | - $this->setData( $view, true ); |
|
70 | + $this->setData($view, true); |
|
71 | 71 | $view->selectionBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->selectionBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/selection/template-item'; |
78 | 78 | $default = 'product/item-selection-default.php'; |
79 | 79 | |
80 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
80 | + return $view->render($view->config($tplconf, $default)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $this->setData( $view ); |
|
93 | + $this->setData($view); |
|
94 | 94 | $view->selectionBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->selectionBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/selection/template-item'; |
101 | 101 | $default = 'product/item-selection-default.php'; |
102 | 102 | |
103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
103 | + return $view->render($view->config($tplconf, $default)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->selectionBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->selectionBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/selection/template-item'; |
124 | 124 | $default = 'product/item-selection-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,32 +137,32 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | - $this->updateItems( $view ); |
|
145 | + $this->updateItems($view); |
|
146 | 146 | $view->selectionBody = ''; |
147 | 147 | |
148 | - foreach( $this->getSubClients() as $client ) { |
|
148 | + foreach ($this->getSubClients() as $client) { |
|
149 | 149 | $view->selectionBody .= $client->save(); |
150 | 150 | } |
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | 154 | } |
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
155 | + catch (\Aimeos\MShop\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'product-item-selection' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
157 | + $error = array('product-item-selection' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
158 | + $view->errors = $view->get('errors', array()) + $error; |
|
159 | 159 | $manager->rollback(); |
160 | 160 | } |
161 | - catch( \Exception $e ) |
|
161 | + catch (\Exception $e) |
|
162 | 162 | { |
163 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
164 | - $error = array( 'product-item-selection' => $e->getMessage() ); |
|
165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
164 | + $error = array('product-item-selection' => $e->getMessage()); |
|
165 | + $view->errors = $view->get('errors', array()) + $error; |
|
166 | 166 | $manager->rollback(); |
167 | 167 | } |
168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param string|null $name Name of the sub-client (Default if null) |
178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
179 | 179 | */ |
180 | - public function getSubClient( $type, $name = null ) |
|
180 | + public function getSubClient($type, $name = null) |
|
181 | 181 | { |
182 | 182 | /** admin/jqadm/product/selection/decorators/excludes |
183 | 183 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @see admin/jqadm/product/selection/decorators/excludes |
253 | 253 | * @see admin/jqadm/product/selection/decorators/global |
254 | 254 | */ |
255 | - return $this->createSubClient( 'product/selection/' . $type, $name ); |
|
255 | + return $this->createSubClient('product/selection/' . $type, $name); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -262,38 +262,38 @@ discard block |
||
262 | 262 | * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
263 | 263 | * @param array $listIds List of IDs of the still used list items |
264 | 264 | */ |
265 | - protected function cleanupItems( array $listItems, array $listIds ) |
|
265 | + protected function cleanupItems(array $listItems, array $listIds) |
|
266 | 266 | { |
267 | 267 | $context = $this->getContext(); |
268 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
269 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
268 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
269 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
270 | 270 | |
271 | 271 | $rmIds = array(); |
272 | - $rmListIds = array_diff( array_keys( $listItems ), $listIds ); |
|
272 | + $rmListIds = array_diff(array_keys($listItems), $listIds); |
|
273 | 273 | |
274 | - foreach( $rmListIds as $rmListId ) { |
|
274 | + foreach ($rmListIds as $rmListId) { |
|
275 | 275 | $rmIds[] = $listItems[$rmListId]->getRefId(); |
276 | 276 | } |
277 | 277 | |
278 | 278 | $search = $listManager->createSearch(); |
279 | 279 | $expr = array( |
280 | - $search->compare( '==', 'product.lists.refid', $rmIds ), |
|
281 | - $search->compare( '==', 'product.lists.domain', 'product' ), |
|
282 | - $search->compare( '==', 'product.lists.type.code', 'default' ), |
|
283 | - $search->compare( '==', 'product.lists.type.domain', 'product' ), |
|
280 | + $search->compare('==', 'product.lists.refid', $rmIds), |
|
281 | + $search->compare('==', 'product.lists.domain', 'product'), |
|
282 | + $search->compare('==', 'product.lists.type.code', 'default'), |
|
283 | + $search->compare('==', 'product.lists.type.domain', 'product'), |
|
284 | 284 | ); |
285 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
286 | - $search->setSlice( 0, 0x7fffffff ); |
|
285 | + $search->setConditions($search->combine('&&', $expr)); |
|
286 | + $search->setSlice(0, 0x7fffffff); |
|
287 | 287 | |
288 | - foreach( $listManager->aggregate( $search, 'product.lists.refid' ) as $key => $count ) |
|
288 | + foreach ($listManager->aggregate($search, 'product.lists.refid') as $key => $count) |
|
289 | 289 | { |
290 | - if( $count > 1 ) { |
|
291 | - unset( $rmIds[$key] ); |
|
290 | + if ($count > 1) { |
|
291 | + unset($rmIds[$key]); |
|
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | - $listManager->deleteItems( $rmListIds ); |
|
296 | - $manager->deleteItems( $rmIds ); |
|
295 | + $listManager->deleteItems($rmListIds); |
|
296 | + $manager->deleteItems($rmIds); |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | |
@@ -305,12 +305,12 @@ discard block |
||
305 | 305 | protected function createItem() |
306 | 306 | { |
307 | 307 | $context = $this->getContext(); |
308 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
309 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/type' ); |
|
308 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
309 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/type'); |
|
310 | 310 | |
311 | 311 | $item = $manager->createItem(); |
312 | - $item->setTypeId( $typeManager->findItem( 'default', array(), 'product' )->getId() ); |
|
313 | - $item->setStatus( 1 ); |
|
312 | + $item->setTypeId($typeManager->findItem('default', array(), 'product')->getId()); |
|
313 | + $item->setStatus(1); |
|
314 | 314 | |
315 | 315 | return $item; |
316 | 316 | } |
@@ -322,17 +322,17 @@ discard block |
||
322 | 322 | * @param string $id Parent ID for the new list item |
323 | 323 | * @return \Aimeos\MShop\Common\Item\Lists\Iface New list item object |
324 | 324 | */ |
325 | - protected function createListItem( $id ) |
|
325 | + protected function createListItem($id) |
|
326 | 326 | { |
327 | 327 | $context = $this->getContext(); |
328 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
329 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
328 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
329 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
330 | 330 | |
331 | 331 | $item = $manager->createItem(); |
332 | - $item->setTypeId( $typeManager->findItem( 'default', array(), 'product' )->getId() ); |
|
333 | - $item->setDomain( 'product' ); |
|
334 | - $item->setParentId( $id ); |
|
335 | - $item->setStatus( 1 ); |
|
332 | + $item->setTypeId($typeManager->findItem('default', array(), 'product')->getId()); |
|
333 | + $item->setDomain('product'); |
|
334 | + $item->setParentId($id); |
|
335 | + $item->setStatus(1); |
|
336 | 336 | |
337 | 337 | return $item; |
338 | 338 | } |
@@ -345,19 +345,19 @@ discard block |
||
345 | 345 | * @param array $ids List of product IDs |
346 | 346 | * @return array List of products with ID as key and items implementing \Aimeos\MShop\Product\Item\Iface as values |
347 | 347 | */ |
348 | - protected function getProductItems( array $codes, array $ids ) |
|
348 | + protected function getProductItems(array $codes, array $ids) |
|
349 | 349 | { |
350 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
350 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
351 | 351 | |
352 | 352 | $search = $manager->createSearch(); |
353 | 353 | $expr = array( |
354 | - $search->compare( '==', 'product.id', $ids ), |
|
355 | - $search->compare( '==', 'product.code', $codes ), |
|
354 | + $search->compare('==', 'product.id', $ids), |
|
355 | + $search->compare('==', 'product.code', $codes), |
|
356 | 356 | ); |
357 | - $search->setConditions( $search->combine( '||', $expr ) ); |
|
358 | - $search->setSlice( 0, 0x7fffffff ); |
|
357 | + $search->setConditions($search->combine('||', $expr)); |
|
358 | + $search->setSlice(0, 0x7fffffff); |
|
359 | 359 | |
360 | - return $manager->searchItems( $search, array( 'attribute' ) ); |
|
360 | + return $manager->searchItems($search, array('attribute')); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
@@ -368,25 +368,25 @@ discard block |
||
368 | 368 | * @param boolean $copy True if items should be copied |
369 | 369 | * @return array Multi-dimensional associative array |
370 | 370 | */ |
371 | - protected function getDataExisting( \Aimeos\MW\View\Iface $view, $copy = false ) |
|
371 | + protected function getDataExisting(\Aimeos\MW\View\Iface $view, $copy = false) |
|
372 | 372 | { |
373 | 373 | $data = array(); |
374 | - $variants = $view->item->getRefItems( 'product', null, 'default' ); |
|
375 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product' ); |
|
374 | + $variants = $view->item->getRefItems('product', null, 'default'); |
|
375 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product'); |
|
376 | 376 | |
377 | 377 | $search = $manager->createSearch(); |
378 | - $search->setConditions( $search->compare( '==', 'product.id', array_keys( $variants ) ) ); |
|
379 | - $search->setSlice( 0, 0x7fffffff ); |
|
378 | + $search->setConditions($search->compare('==', 'product.id', array_keys($variants))); |
|
379 | + $search->setSlice(0, 0x7fffffff); |
|
380 | 380 | |
381 | - $products = $manager->searchItems( $search, array( 'attribute' ) ); |
|
381 | + $products = $manager->searchItems($search, array('attribute')); |
|
382 | 382 | |
383 | - foreach( $view->item->getListItems( 'product', 'default' ) as $listid => $listItem ) |
|
383 | + foreach ($view->item->getListItems('product', 'default') as $listid => $listItem) |
|
384 | 384 | { |
385 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
385 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
386 | 386 | continue; |
387 | 387 | } |
388 | 388 | |
389 | - if( $copy === false ) |
|
389 | + if ($copy === false) |
|
390 | 390 | { |
391 | 391 | $code = $refItem->getCode(); |
392 | 392 | $data[$code]['product.lists.id'] = $listid; |
@@ -401,11 +401,11 @@ discard block |
||
401 | 401 | |
402 | 402 | $data[$code]['product.label'] = $refItem->getLabel(); |
403 | 403 | |
404 | - if( isset( $products[$refItem->getId()] ) ) |
|
404 | + if (isset($products[$refItem->getId()])) |
|
405 | 405 | { |
406 | - $attributes = $products[$refItem->getId()]->getRefItems( 'attribute', null, 'variant' ); |
|
406 | + $attributes = $products[$refItem->getId()]->getRefItems('attribute', null, 'variant'); |
|
407 | 407 | |
408 | - foreach( $attributes as $attrid => $attrItem ) |
|
408 | + foreach ($attributes as $attrid => $attrItem) |
|
409 | 409 | { |
410 | 410 | $data[$code]['attr'][$attrid]['ref'] = $code; |
411 | 411 | $data[$code]['attr'][$attrid]['label'] = $attrItem->getLabel(); |
@@ -423,28 +423,28 @@ discard block |
||
423 | 423 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
424 | 424 | * @return array Multi-dimensional associative array |
425 | 425 | */ |
426 | - protected function getDataParams( \Aimeos\MW\View\Iface $view ) |
|
426 | + protected function getDataParams(\Aimeos\MW\View\Iface $view) |
|
427 | 427 | { |
428 | 428 | $data = array(); |
429 | 429 | |
430 | - foreach( (array) $view->param( 'selection/product.code', array() ) as $pos => $code ) |
|
430 | + foreach ((array) $view->param('selection/product.code', array()) as $pos => $code) |
|
431 | 431 | { |
432 | - if( !empty( $code ) ) |
|
432 | + if (!empty($code)) |
|
433 | 433 | { |
434 | - $data[$code]['product.lists.id'] = $view->param( 'selection/product.lists.id/' . $pos ); |
|
435 | - $data[$code]['product.id'] = $view->param( 'selection/product.id/' . $pos ); |
|
436 | - $data[$code]['product.label'] = $view->param( 'selection/product.label/' . $pos ); |
|
434 | + $data[$code]['product.lists.id'] = $view->param('selection/product.lists.id/' . $pos); |
|
435 | + $data[$code]['product.id'] = $view->param('selection/product.id/' . $pos); |
|
436 | + $data[$code]['product.label'] = $view->param('selection/product.label/' . $pos); |
|
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | - foreach( (array) $view->param( 'selection/attr/ref', array() ) as $pos => $code ) |
|
440 | + foreach ((array) $view->param('selection/attr/ref', array()) as $pos => $code) |
|
441 | 441 | { |
442 | - if( !empty( $code ) ) |
|
442 | + if (!empty($code)) |
|
443 | 443 | { |
444 | - $id = $view->param( 'selection/attr/id/' . $pos ); |
|
444 | + $id = $view->param('selection/attr/id/' . $pos); |
|
445 | 445 | |
446 | 446 | $data[$code]['attr'][$id]['ref'] = $code; |
447 | - $data[$code]['attr'][$id]['label'] = $view->param( 'selection/attr/label/' . $pos ); |
|
447 | + $data[$code]['attr'][$id]['label'] = $view->param('selection/attr/label/' . $pos); |
|
448 | 448 | } |
449 | 449 | } |
450 | 450 | |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | */ |
460 | 460 | protected function getSubClientNames() |
461 | 461 | { |
462 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
462 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
463 | 463 | } |
464 | 464 | |
465 | 465 | |
@@ -469,15 +469,15 @@ discard block |
||
469 | 469 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
470 | 470 | * @param boolean $copy True if items should be copied |
471 | 471 | */ |
472 | - protected function setData( \Aimeos\MW\View\Iface $view, $copy = false ) |
|
472 | + protected function setData(\Aimeos\MW\View\Iface $view, $copy = false) |
|
473 | 473 | { |
474 | - $data = $this->getDataParams( $view ); |
|
474 | + $data = $this->getDataParams($view); |
|
475 | 475 | |
476 | - if( empty( $data ) ) { |
|
477 | - $data = $this->getDataExisting( $view, $copy ); |
|
476 | + if (empty($data)) { |
|
477 | + $data = $this->getDataExisting($view, $copy); |
|
478 | 478 | } |
479 | 479 | |
480 | - if( empty( $data ) ) { // show at least one block |
|
480 | + if (empty($data)) { // show at least one block |
|
481 | 481 | $data['']['product.lists.id'] = ''; |
482 | 482 | } |
483 | 483 | |
@@ -490,39 +490,39 @@ discard block |
||
490 | 490 | * |
491 | 491 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
492 | 492 | */ |
493 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
493 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
494 | 494 | { |
495 | - if( $view->item->getType() !== 'select' ) { |
|
495 | + if ($view->item->getType() !== 'select') { |
|
496 | 496 | return; |
497 | 497 | } |
498 | 498 | |
499 | 499 | $id = $view->item->getId(); |
500 | 500 | $context = $this->getContext(); |
501 | - $data = $this->getDataParams( $view ); |
|
501 | + $data = $this->getDataParams($view); |
|
502 | 502 | |
503 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
504 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
503 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
504 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
505 | 505 | |
506 | - $product = $manager->getItem( $id, array( 'product' ) ); |
|
507 | - $listItems = $product->getListItems( 'product', 'default' ); |
|
508 | - $refItems = $product->getRefItems( 'product', null, 'default' ); |
|
506 | + $product = $manager->getItem($id, array('product')); |
|
507 | + $listItems = $product->getListItems('product', 'default'); |
|
508 | + $refItems = $product->getRefItems('product', null, 'default'); |
|
509 | 509 | |
510 | - $products = $this->getProductItems( array_keys( $data ), array_keys( $refItems ) ); |
|
511 | - $listIds = (array) $view->param( 'selection/product.lists.id', array() ); |
|
510 | + $products = $this->getProductItems(array_keys($data), array_keys($refItems)); |
|
511 | + $listIds = (array) $view->param('selection/product.lists.id', array()); |
|
512 | 512 | |
513 | - $listItem = $this->createListItem( $id ); |
|
513 | + $listItem = $this->createListItem($id); |
|
514 | 514 | $prodItem = $this->createItem(); |
515 | 515 | |
516 | 516 | |
517 | - foreach( $listIds as $idx => $listid ) |
|
517 | + foreach ($listIds as $idx => $listid) |
|
518 | 518 | { |
519 | - if( !isset( $listItems[$listid] ) ) |
|
519 | + if (!isset($listItems[$listid])) |
|
520 | 520 | { |
521 | 521 | $litem = $listItem; |
522 | - $litem->setId( null ); |
|
522 | + $litem->setId(null); |
|
523 | 523 | |
524 | 524 | $item = $prodItem; |
525 | - $item->setId( null ); |
|
525 | + $item->setId(null); |
|
526 | 526 | } |
527 | 527 | else |
528 | 528 | { |
@@ -530,26 +530,26 @@ discard block |
||
530 | 530 | $item = $litem->getRefItem(); |
531 | 531 | } |
532 | 532 | |
533 | - if( ( $code = $view->param( 'selection/product.code/' . $idx ) ) === '' ) { |
|
533 | + if (($code = $view->param('selection/product.code/' . $idx)) === '') { |
|
534 | 534 | continue; |
535 | 535 | } |
536 | 536 | |
537 | - $item->setCode( $code ); |
|
538 | - $item->setLabel( $view->param( 'selection/product.label/' . $idx ) ); |
|
537 | + $item->setCode($code); |
|
538 | + $item->setLabel($view->param('selection/product.label/' . $idx)); |
|
539 | 539 | |
540 | - $manager->saveItem( $item ); |
|
540 | + $manager->saveItem($item); |
|
541 | 541 | |
542 | - $litem->setPosition( $idx ); |
|
543 | - $litem->setRefId( $item->getId() ); |
|
542 | + $litem->setPosition($idx); |
|
543 | + $litem->setRefId($item->getId()); |
|
544 | 544 | |
545 | - $listManager->saveItem( $litem, false ); |
|
545 | + $listManager->saveItem($litem, false); |
|
546 | 546 | |
547 | - $variant = ( isset( $products[$item->getId()] ) ? $products[$item->getId()] : $item ); |
|
548 | - $attr = ( isset( $data[$code]['attr'] ) ? (array) $data[$code]['attr'] : array() ); |
|
547 | + $variant = (isset($products[$item->getId()]) ? $products[$item->getId()] : $item); |
|
548 | + $attr = (isset($data[$code]['attr']) ? (array) $data[$code]['attr'] : array()); |
|
549 | 549 | |
550 | - $manager->updateListItems( $variant, $attr, 'attribute', 'variant' ); |
|
550 | + $manager->updateListItems($variant, $attr, 'attribute', 'variant'); |
|
551 | 551 | } |
552 | 552 | |
553 | - $this->cleanupItems( $listItems, $listIds ); |
|
553 | + $this->cleanupItems($listItems, $listIds); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | \ No newline at end of file |
@@ -151,14 +151,12 @@ discard block |
||
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | - } |
|
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
154 | + } catch( \Aimeos\MShop\Exception $e ) |
|
156 | 155 | { |
157 | 156 | $error = array( 'product-item-selection' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
158 | 157 | $view->errors = $view->get( 'errors', array() ) + $error; |
159 | 158 | $manager->rollback(); |
160 | - } |
|
161 | - catch( \Exception $e ) |
|
159 | + } catch( \Exception $e ) |
|
162 | 160 | { |
163 | 161 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
164 | 162 | $error = array( 'product-item-selection' => $e->getMessage() ); |
@@ -391,8 +389,7 @@ discard block |
||
391 | 389 | $code = $refItem->getCode(); |
392 | 390 | $data[$code]['product.lists.id'] = $listid; |
393 | 391 | $data[$code]['product.id'] = $listItem->getRefId(); |
394 | - } |
|
395 | - else |
|
392 | + } else |
|
396 | 393 | { |
397 | 394 | $code = $refItem->getCode() . '_copy'; |
398 | 395 | $data[$code]['product.lists.id'] = ''; |
@@ -523,8 +520,7 @@ discard block |
||
523 | 520 | |
524 | 521 | $item = $prodItem; |
525 | 522 | $item->setId( null ); |
526 | - } |
|
527 | - else |
|
523 | + } else |
|
528 | 524 | { |
529 | 525 | $litem = $listItems[$listid]; |
530 | 526 | $item = $litem->getRefItem(); |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | { |
68 | 68 | $view = $this->getView(); |
69 | 69 | |
70 | - $view->physicalItems = $this->getItems( $view->item->getId() ); |
|
70 | + $view->physicalItems = $this->getItems($view->item->getId()); |
|
71 | 71 | $view->physicalBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->physicalBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/physical/template-item'; |
78 | 78 | $default = 'product/item-physical-default.php'; |
79 | 79 | |
80 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
80 | + return $view->render($view->config($tplconf, $default)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $view->physicalItems = $this->getItems( $view->item->getId() ); |
|
93 | + $view->physicalItems = $this->getItems($view->item->getId()); |
|
94 | 94 | $view->physicalBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->physicalBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/physical/template-item'; |
101 | 101 | $default = 'product/item-physical-default.php'; |
102 | 102 | |
103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
103 | + return $view->render($view->config($tplconf, $default)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $view->physicalItems = $this->getItems( $view->item->getId() ); |
|
116 | + $view->physicalItems = $this->getItems($view->item->getId()); |
|
117 | 117 | $view->physicalBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->physicalBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/physical/template-item'; |
124 | 124 | $default = 'product/item-physical-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,33 +137,33 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/property' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/property'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | - $this->updateItems( $view ); |
|
145 | + $this->updateItems($view); |
|
146 | 146 | |
147 | 147 | $view->physicalBody = ''; |
148 | 148 | |
149 | - foreach( $this->getSubClients() as $client ) { |
|
149 | + foreach ($this->getSubClients() as $client) { |
|
150 | 150 | $view->physicalBody .= $client->save(); |
151 | 151 | } |
152 | 152 | |
153 | 153 | $manager->commit(); |
154 | 154 | return; |
155 | 155 | } |
156 | - catch( \Aimeos\MShop\Exception $e ) |
|
156 | + catch (\Aimeos\MShop\Exception $e) |
|
157 | 157 | { |
158 | - $error = array( 'product-item-physical' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
159 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
158 | + $error = array('product-item-physical' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
159 | + $view->errors = $view->get('errors', array()) + $error; |
|
160 | 160 | $manager->rollback(); |
161 | 161 | } |
162 | - catch( \Exception $e ) |
|
162 | + catch (\Exception $e) |
|
163 | 163 | { |
164 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
165 | - $error = array( 'product-item-physical' => $e->getMessage() ); |
|
166 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
164 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
165 | + $error = array('product-item-physical' => $e->getMessage()); |
|
166 | + $view->errors = $view->get('errors', array()) + $error; |
|
167 | 167 | $manager->rollback(); |
168 | 168 | } |
169 | 169 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @param string|null $name Name of the sub-client (Default if null) |
179 | 179 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
180 | 180 | */ |
181 | - public function getSubClient( $type, $name = null ) |
|
181 | + public function getSubClient($type, $name = null) |
|
182 | 182 | { |
183 | 183 | /** admin/jqadm/product/physical/decorators/excludes |
184 | 184 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @see admin/jqadm/product/physical/decorators/excludes |
254 | 254 | * @see admin/jqadm/product/physical/decorators/global |
255 | 255 | */ |
256 | - return $this->createSubClient( 'product/physical/' . $type, $name ); |
|
256 | + return $this->createSubClient('product/physical/' . $type, $name); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | */ |
265 | 265 | protected function getSubClientNames() |
266 | 266 | { |
267 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
267 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | |
@@ -274,20 +274,20 @@ discard block |
||
274 | 274 | * @param string $prodid Unique product ID |
275 | 275 | * @return array List of property types as keys and items implementing \Aimeos\MShop\Product\Property\Iface as values |
276 | 276 | */ |
277 | - protected function getItems( $prodid ) |
|
277 | + protected function getItems($prodid) |
|
278 | 278 | { |
279 | 279 | $list = array(); |
280 | - $types = array( 'package-length', 'package-width', 'package-height', 'package-weight' ); |
|
281 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
280 | + $types = array('package-length', 'package-width', 'package-height', 'package-weight'); |
|
281 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property'); |
|
282 | 282 | |
283 | 283 | $search = $manager->createSearch(); |
284 | 284 | $expr = array( |
285 | - $search->compare( '==', 'product.property.parentid', $prodid ), |
|
286 | - $search->compare( '==', 'product.property.type.code', $types ), |
|
285 | + $search->compare('==', 'product.property.parentid', $prodid), |
|
286 | + $search->compare('==', 'product.property.type.code', $types), |
|
287 | 287 | ); |
288 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
288 | + $search->setConditions($search->combine('&&', $expr)); |
|
289 | 289 | |
290 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
290 | + foreach ($manager->searchItems($search) as $item) { |
|
291 | 291 | $list[$item->getType()] = $item; |
292 | 292 | } |
293 | 293 | |
@@ -300,38 +300,38 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
302 | 302 | */ |
303 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
303 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
304 | 304 | { |
305 | 305 | $context = $this->getContext(); |
306 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/property' ); |
|
307 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/property/type' ); |
|
306 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/property'); |
|
307 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/property/type'); |
|
308 | 308 | |
309 | 309 | $ids = array(); |
310 | - $items = $this->getItems( $view->item->getId() ); |
|
310 | + $items = $this->getItems($view->item->getId()); |
|
311 | 311 | |
312 | - foreach( (array) $view->param( 'physical', array() ) as $type => $value ) |
|
312 | + foreach ((array) $view->param('physical', array()) as $type => $value) |
|
313 | 313 | { |
314 | - $value = trim( $value ); |
|
314 | + $value = trim($value); |
|
315 | 315 | |
316 | - if( $value == '' ) |
|
316 | + if ($value == '') |
|
317 | 317 | { |
318 | - if( isset( $items[$type] ) ) { |
|
318 | + if (isset($items[$type])) { |
|
319 | 319 | $ids[] = $items[$type]->getId(); |
320 | 320 | } |
321 | 321 | continue; |
322 | 322 | } |
323 | 323 | |
324 | - if( !isset( $items[$type] ) ) |
|
324 | + if (!isset($items[$type])) |
|
325 | 325 | { |
326 | 326 | $items[$type] = $manager->createItem(); |
327 | - $items[$type]->setParentId( $view->item->getId() ); |
|
328 | - $items[$type]->setTypeId( $typeManager->findItem( $type, array(), 'product' )->getId() ); |
|
327 | + $items[$type]->setParentId($view->item->getId()); |
|
328 | + $items[$type]->setTypeId($typeManager->findItem($type, array(), 'product')->getId()); |
|
329 | 329 | } |
330 | 330 | |
331 | - $items[$type]->setValue( $value ); |
|
332 | - $manager->saveItem( $items[$type] ); |
|
331 | + $items[$type]->setValue($value); |
|
332 | + $manager->saveItem($items[$type]); |
|
333 | 333 | } |
334 | 334 | |
335 | - $manager->deleteItems( $ids ); |
|
335 | + $manager->deleteItems($ids); |
|
336 | 336 | } |
337 | 337 | } |
@@ -152,14 +152,12 @@ |
||
152 | 152 | |
153 | 153 | $manager->commit(); |
154 | 154 | return; |
155 | - } |
|
156 | - catch( \Aimeos\MShop\Exception $e ) |
|
155 | + } catch( \Aimeos\MShop\Exception $e ) |
|
157 | 156 | { |
158 | 157 | $error = array( 'product-item-physical' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
159 | 158 | $view->errors = $view->get( 'errors', array() ) + $error; |
160 | 159 | $manager->rollback(); |
161 | - } |
|
162 | - catch( \Exception $e ) |
|
160 | + } catch( \Exception $e ) |
|
163 | 161 | { |
164 | 162 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
165 | 163 | $error = array( 'product-item-physical' => $e->getMessage() ); |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | { |
68 | 68 | $view = $this->getView(); |
69 | 69 | |
70 | - $this->setData( $view ); |
|
70 | + $this->setData($view); |
|
71 | 71 | $view->imageBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->imageBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/image/template-item'; |
78 | 78 | $default = 'product/item-image-default.php'; |
79 | 79 | |
80 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
80 | + return $view->render($view->config($tplconf, $default)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $this->setData( $view ); |
|
93 | + $this->setData($view); |
|
94 | 94 | $view->imageBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->imageBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/image/template-item'; |
101 | 101 | $default = 'product/item-image-default.php'; |
102 | 102 | |
103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
103 | + return $view->render($view->config($tplconf, $default)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->imageBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->imageBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/image/template-item'; |
124 | 124 | $default = 'product/item-image-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,18 +137,18 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
141 | - $mediaManager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
141 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
142 | 142 | |
143 | 143 | $manager->begin(); |
144 | 144 | $mediaManager->begin(); |
145 | 145 | |
146 | 146 | try |
147 | 147 | { |
148 | - $this->updateItems( $view ); |
|
148 | + $this->updateItems($view); |
|
149 | 149 | $view->imageBody = ''; |
150 | 150 | |
151 | - foreach( $this->getSubClients() as $client ) { |
|
151 | + foreach ($this->getSubClients() as $client) { |
|
152 | 152 | $view->imageBody .= $client->save(); |
153 | 153 | } |
154 | 154 | |
@@ -156,19 +156,19 @@ discard block |
||
156 | 156 | $manager->commit(); |
157 | 157 | return; |
158 | 158 | } |
159 | - catch( \Aimeos\MShop\Exception $e ) |
|
159 | + catch (\Aimeos\MShop\Exception $e) |
|
160 | 160 | { |
161 | - $error = array( 'product-item-image' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
162 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
161 | + $error = array('product-item-image' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
162 | + $view->errors = $view->get('errors', array()) + $error; |
|
163 | 163 | |
164 | 164 | $mediaManager->rollback(); |
165 | 165 | $manager->rollback(); |
166 | 166 | } |
167 | - catch( \Exception $e ) |
|
167 | + catch (\Exception $e) |
|
168 | 168 | { |
169 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
170 | - $error = array( 'product-item-image' => $e->getMessage() ); |
|
171 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
169 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
170 | + $error = array('product-item-image' => $e->getMessage()); |
|
171 | + $view->errors = $view->get('errors', array()) + $error; |
|
172 | 172 | |
173 | 173 | $mediaManager->rollback(); |
174 | 174 | $manager->rollback(); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @param string|null $name Name of the sub-client (Default if null) |
186 | 186 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
187 | 187 | */ |
188 | - public function getSubClient( $type, $name = null ) |
|
188 | + public function getSubClient($type, $name = null) |
|
189 | 189 | { |
190 | 190 | /** admin/jqadm/product/image/decorators/excludes |
191 | 191 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @see admin/jqadm/product/image/decorators/excludes |
261 | 261 | * @see admin/jqadm/product/image/decorators/global |
262 | 262 | */ |
263 | - return $this->createSubClient( 'product/image/' . $type, $name ); |
|
263 | + return $this->createSubClient('product/image/' . $type, $name); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | |
@@ -270,44 +270,44 @@ discard block |
||
270 | 270 | * @param array $listItems List of items implementing \Aimeos\MShop\Common\Item\Lists\Iface |
271 | 271 | * @param array $listIds List of IDs of the still used list items |
272 | 272 | */ |
273 | - protected function cleanupItems( array $listItems, array $listIds ) |
|
273 | + protected function cleanupItems(array $listItems, array $listIds) |
|
274 | 274 | { |
275 | 275 | $context = $this->getContext(); |
276 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
277 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
278 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
276 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
277 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
278 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
279 | 279 | |
280 | 280 | $rmItems = array(); |
281 | - $rmListIds = array_diff( array_keys( $listItems ), $listIds ); |
|
281 | + $rmListIds = array_diff(array_keys($listItems), $listIds); |
|
282 | 282 | |
283 | - foreach( $rmListIds as $rmListId ) |
|
283 | + foreach ($rmListIds as $rmListId) |
|
284 | 284 | { |
285 | - if( ( $item = $listItems[$rmListId]->getRefItem() ) !== null ) { |
|
285 | + if (($item = $listItems[$rmListId]->getRefItem()) !== null) { |
|
286 | 286 | $rmItems[$item->getId()] = $item; |
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
290 | 290 | $search = $listManager->createSearch(); |
291 | 291 | $expr = array( |
292 | - $search->compare( '==', 'product.lists.refid', array_keys( $rmItems ) ), |
|
293 | - $search->compare( '==', 'product.lists.domain', 'media' ), |
|
294 | - $search->compare( '==', 'product.lists.type.code', 'default' ), |
|
295 | - $search->compare( '==', 'product.lists.type.domain', 'media' ), |
|
292 | + $search->compare('==', 'product.lists.refid', array_keys($rmItems)), |
|
293 | + $search->compare('==', 'product.lists.domain', 'media'), |
|
294 | + $search->compare('==', 'product.lists.type.code', 'default'), |
|
295 | + $search->compare('==', 'product.lists.type.domain', 'media'), |
|
296 | 296 | ); |
297 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
298 | - $search->setSlice( 0, 0x7fffffff ); |
|
297 | + $search->setConditions($search->combine('&&', $expr)); |
|
298 | + $search->setSlice(0, 0x7fffffff); |
|
299 | 299 | |
300 | - foreach( $listManager->aggregate( $search, 'product.lists.refid' ) as $key => $count ) |
|
300 | + foreach ($listManager->aggregate($search, 'product.lists.refid') as $key => $count) |
|
301 | 301 | { |
302 | - if( $count > 1 ) { |
|
303 | - unset( $rmItems[$key] ); |
|
302 | + if ($count > 1) { |
|
303 | + unset($rmItems[$key]); |
|
304 | 304 | } else { |
305 | - $cntl->delete( $rmItems[$key] ); |
|
305 | + $cntl->delete($rmItems[$key]); |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | - $listManager->deleteItems( $rmListIds ); |
|
310 | - $manager->deleteItems( array_keys( $rmItems ) ); |
|
309 | + $listManager->deleteItems($rmListIds); |
|
310 | + $manager->deleteItems(array_keys($rmItems)); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | protected function createItem() |
320 | 320 | { |
321 | 321 | $context = $this->getContext(); |
322 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
323 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'media/type' ); |
|
322 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
323 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'media/type'); |
|
324 | 324 | |
325 | 325 | $item = $manager->createItem(); |
326 | - $item->setTypeId( $typeManager->findItem( 'default', array(), 'product' )->getId() ); |
|
327 | - $item->setDomain( 'product' ); |
|
328 | - $item->setStatus( 1 ); |
|
326 | + $item->setTypeId($typeManager->findItem('default', array(), 'product')->getId()); |
|
327 | + $item->setDomain('product'); |
|
328 | + $item->setStatus(1); |
|
329 | 329 | |
330 | 330 | return $item; |
331 | 331 | } |
@@ -337,17 +337,17 @@ discard block |
||
337 | 337 | * @param string $id Parent ID for the new list item |
338 | 338 | * @return \Aimeos\MShop\Common\Item\Lists\Iface New list item object |
339 | 339 | */ |
340 | - protected function createListItem( $id ) |
|
340 | + protected function createListItem($id) |
|
341 | 341 | { |
342 | 342 | $context = $this->getContext(); |
343 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
344 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
343 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
344 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
345 | 345 | |
346 | 346 | $item = $manager->createItem(); |
347 | - $item->setTypeId( $typeManager->findItem( 'default', array(), 'media' )->getId() ); |
|
348 | - $item->setDomain( 'media' ); |
|
349 | - $item->setParentId( $id ); |
|
350 | - $item->setStatus( 1 ); |
|
347 | + $item->setTypeId($typeManager->findItem('default', array(), 'media')->getId()); |
|
348 | + $item->setDomain('media'); |
|
349 | + $item->setParentId($id); |
|
350 | + $item->setStatus(1); |
|
351 | 351 | |
352 | 352 | return $item; |
353 | 353 | } |
@@ -359,15 +359,15 @@ discard block |
||
359 | 359 | * @param array $ids List of media IDs |
360 | 360 | * @return array List of media items with ID as key and items implementing \Aimeos\MShop\Media\Item\Iface as values |
361 | 361 | */ |
362 | - protected function getMediaItems( array $ids ) |
|
362 | + protected function getMediaItems(array $ids) |
|
363 | 363 | { |
364 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'media' ); |
|
364 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media'); |
|
365 | 365 | |
366 | 366 | $search = $manager->createSearch(); |
367 | - $search->setConditions( $search->compare( '==', 'media.id', $ids ) ); |
|
368 | - $search->setSlice( 0, 0x7fffffff ); |
|
367 | + $search->setConditions($search->compare('==', 'media.id', $ids)); |
|
368 | + $search->setSlice(0, 0x7fffffff); |
|
369 | 369 | |
370 | - return $manager->searchItems( $search ); |
|
370 | + return $manager->searchItems($search); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | */ |
379 | 379 | protected function getSubClientNames() |
380 | 380 | { |
381 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
381 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | |
@@ -387,25 +387,25 @@ discard block |
||
387 | 387 | * |
388 | 388 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
389 | 389 | */ |
390 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
390 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
391 | 391 | { |
392 | - $view->imageData = (array) $view->param( 'image', array() ); |
|
392 | + $view->imageData = (array) $view->param('image', array()); |
|
393 | 393 | |
394 | - if( !empty( $view->imageData ) ) { |
|
394 | + if (!empty($view->imageData)) { |
|
395 | 395 | return; |
396 | 396 | } |
397 | 397 | |
398 | 398 | $data = array(); |
399 | 399 | |
400 | - foreach( $view->item->getListItems( 'media', 'default' ) as $id => $listItem ) |
|
400 | + foreach ($view->item->getListItems('media', 'default') as $id => $listItem) |
|
401 | 401 | { |
402 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
402 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
403 | 403 | continue; |
404 | 404 | } |
405 | 405 | |
406 | 406 | $data['product.lists.id'][] = $id; |
407 | 407 | |
408 | - foreach( $refItem->toArray() as $key => $value ) { |
|
408 | + foreach ($refItem->toArray() as $key => $value) { |
|
409 | 409 | $data[$key][] = $value; |
410 | 410 | } |
411 | 411 | } |
@@ -419,50 +419,50 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
421 | 421 | */ |
422 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
422 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
423 | 423 | { |
424 | 424 | $id = $view->item->getId(); |
425 | 425 | $context = $this->getContext(); |
426 | 426 | |
427 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
428 | - $mediaManager = \Aimeos\MShop\Factory::createManager( $context, 'media' ); |
|
429 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
430 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $context ); |
|
427 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
428 | + $mediaManager = \Aimeos\MShop\Factory::createManager($context, 'media'); |
|
429 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
430 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($context); |
|
431 | 431 | |
432 | - $listIds = (array) $view->param( 'image/product.lists.id', array() ); |
|
433 | - $listItems = $manager->getItem( $id, array( 'media' ) )->getListItems( 'media', 'default' ); |
|
434 | - $mediaItems = $this->getMediaItems( $view->param( 'image/media.id', array() ) ); |
|
432 | + $listIds = (array) $view->param('image/product.lists.id', array()); |
|
433 | + $listItems = $manager->getItem($id, array('media'))->getListItems('media', 'default'); |
|
434 | + $mediaItems = $this->getMediaItems($view->param('image/media.id', array())); |
|
435 | 435 | |
436 | 436 | $mediaItem = $this->createItem(); |
437 | - $listItem = $this->createListItem( $id ); |
|
437 | + $listItem = $this->createListItem($id); |
|
438 | 438 | |
439 | - $files = $view->value( (array) $view->request()->getUploadedFiles(), 'image/files', array() ); |
|
439 | + $files = $view->value((array) $view->request()->getUploadedFiles(), 'image/files', array()); |
|
440 | 440 | $num = 0; |
441 | 441 | |
442 | - foreach( $listIds as $idx => $listid ) |
|
442 | + foreach ($listIds as $idx => $listid) |
|
443 | 443 | { |
444 | - if( !isset( $listItems[$listid] ) ) |
|
444 | + if (!isset($listItems[$listid])) |
|
445 | 445 | { |
446 | 446 | $litem = $listItem; |
447 | - $litem->setId( null ); |
|
447 | + $litem->setId(null); |
|
448 | 448 | |
449 | - $mediaId = $view->param( 'image/media.id/' . $idx ); |
|
449 | + $mediaId = $view->param('image/media.id/' . $idx); |
|
450 | 450 | |
451 | - if( $mediaId !== '' && isset( $mediaItems[$mediaId] ) ) |
|
451 | + if ($mediaId !== '' && isset($mediaItems[$mediaId])) |
|
452 | 452 | { |
453 | 453 | $item = $mediaItems[$mediaId]; |
454 | 454 | } |
455 | - else if( ( $file = $view->value( $files, $num ) ) !== null ) |
|
455 | + else if (($file = $view->value($files, $num)) !== null) |
|
456 | 456 | { |
457 | 457 | $item = $mediaItem; |
458 | - $item->setId( null ); |
|
458 | + $item->setId(null); |
|
459 | 459 | |
460 | - $cntl->add( $item, $file ); |
|
460 | + $cntl->add($item, $file); |
|
461 | 461 | $num++; |
462 | 462 | } |
463 | 463 | else |
464 | 464 | { |
465 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'No file uploaded for %1$d. new image', $num+1 ) ); |
|
465 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('No file uploaded for %1$d. new image', $num + 1)); |
|
466 | 466 | } |
467 | 467 | } |
468 | 468 | else |
@@ -471,17 +471,17 @@ discard block |
||
471 | 471 | $item = $litem->getRefItem(); |
472 | 472 | } |
473 | 473 | |
474 | - $item->setLabel( $view->param( 'image/media.label/' . $idx ) ); |
|
475 | - $item->setLanguageId( $view->param( 'image/media.languageid/' . $idx ) ); |
|
474 | + $item->setLabel($view->param('image/media.label/' . $idx)); |
|
475 | + $item->setLanguageId($view->param('image/media.languageid/' . $idx)); |
|
476 | 476 | |
477 | - $mediaManager->saveItem( $item ); |
|
477 | + $mediaManager->saveItem($item); |
|
478 | 478 | |
479 | - $litem->setPosition( $idx ); |
|
480 | - $litem->setRefId( $item->getId() ); |
|
479 | + $litem->setPosition($idx); |
|
480 | + $litem->setRefId($item->getId()); |
|
481 | 481 | |
482 | - $listManager->saveItem( $litem, false ); |
|
482 | + $listManager->saveItem($litem, false); |
|
483 | 483 | } |
484 | 484 | |
485 | - $this->cleanupItems( $listItems, $listIds ); |
|
485 | + $this->cleanupItems($listItems, $listIds); |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | \ No newline at end of file |
@@ -155,16 +155,14 @@ discard block |
||
155 | 155 | $mediaManager->commit(); |
156 | 156 | $manager->commit(); |
157 | 157 | return; |
158 | - } |
|
159 | - catch( \Aimeos\MShop\Exception $e ) |
|
158 | + } catch( \Aimeos\MShop\Exception $e ) |
|
160 | 159 | { |
161 | 160 | $error = array( 'product-item-image' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
162 | 161 | $view->errors = $view->get( 'errors', array() ) + $error; |
163 | 162 | |
164 | 163 | $mediaManager->rollback(); |
165 | 164 | $manager->rollback(); |
166 | - } |
|
167 | - catch( \Exception $e ) |
|
165 | + } catch( \Exception $e ) |
|
168 | 166 | { |
169 | 167 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
170 | 168 | $error = array( 'product-item-image' => $e->getMessage() ); |
@@ -451,21 +449,18 @@ discard block |
||
451 | 449 | if( $mediaId !== '' && isset( $mediaItems[$mediaId] ) ) |
452 | 450 | { |
453 | 451 | $item = $mediaItems[$mediaId]; |
454 | - } |
|
455 | - else if( ( $file = $view->value( $files, $num ) ) !== null ) |
|
452 | + } else if( ( $file = $view->value( $files, $num ) ) !== null ) |
|
456 | 453 | { |
457 | 454 | $item = $mediaItem; |
458 | 455 | $item->setId( null ); |
459 | 456 | |
460 | 457 | $cntl->add( $item, $file ); |
461 | 458 | $num++; |
462 | - } |
|
463 | - else |
|
459 | + } else |
|
464 | 460 | { |
465 | 461 | throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'No file uploaded for %1$d. new image', $num+1 ) ); |
466 | 462 | } |
467 | - } |
|
468 | - else |
|
463 | + } else |
|
469 | 464 | { |
470 | 465 | $litem = $listItems[$listid]; |
471 | 466 | $item = $litem->getRefItem(); |
@@ -27,13 +27,13 @@ |
||
27 | 27 | public function save() |
28 | 28 | { |
29 | 29 | $result = $this->getClient()->save(); |
30 | - $ids = array( 'catalog' ); |
|
30 | + $ids = array('catalog'); |
|
31 | 31 | |
32 | - foreach( $this->getView()->param( 'category/catalog.id', array() ) as $id ) { |
|
32 | + foreach ($this->getView()->param('category/catalog.id', array()) as $id) { |
|
33 | 33 | $ids[] = 'catalog-' . $id; |
34 | 34 | } |
35 | 35 | |
36 | - $this->getContext()->getCache()->deleteByTags( $ids ); |
|
36 | + $this->getContext()->getCache()->deleteByTags($ids); |
|
37 | 37 | |
38 | 38 | return $result; |
39 | 39 | } |
@@ -67,17 +67,17 @@ discard block |
||
67 | 67 | { |
68 | 68 | $view = $this->getView(); |
69 | 69 | |
70 | - $this->setData( $view ); |
|
70 | + $this->setData($view); |
|
71 | 71 | $view->categoryBody = ''; |
72 | 72 | |
73 | - foreach( $this->getSubClients() as $client ) { |
|
73 | + foreach ($this->getSubClients() as $client) { |
|
74 | 74 | $view->categoryBody .= $client->copy(); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $tplconf = 'admin/jqadm/product/category/template-item'; |
78 | 78 | $default = 'product/item-category-default.php'; |
79 | 79 | |
80 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
80 | + return $view->render($view->config($tplconf, $default)); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -90,17 +90,17 @@ discard block |
||
90 | 90 | { |
91 | 91 | $view = $this->getView(); |
92 | 92 | |
93 | - $this->setData( $view ); |
|
93 | + $this->setData($view); |
|
94 | 94 | $view->categoryBody = ''; |
95 | 95 | |
96 | - foreach( $this->getSubClients() as $client ) { |
|
96 | + foreach ($this->getSubClients() as $client) { |
|
97 | 97 | $view->categoryBody .= $client->create(); |
98 | 98 | } |
99 | 99 | |
100 | 100 | $tplconf = 'admin/jqadm/product/category/template-item'; |
101 | 101 | $default = 'product/item-category-default.php'; |
102 | 102 | |
103 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
103 | + return $view->render($view->config($tplconf, $default)); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | { |
114 | 114 | $view = $this->getView(); |
115 | 115 | |
116 | - $this->setData( $view ); |
|
116 | + $this->setData($view); |
|
117 | 117 | $view->categoryBody = ''; |
118 | 118 | |
119 | - foreach( $this->getSubClients() as $client ) { |
|
119 | + foreach ($this->getSubClients() as $client) { |
|
120 | 120 | $view->categoryBody .= $client->get(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $tplconf = 'admin/jqadm/product/category/template-item'; |
124 | 124 | $default = 'product/item-category-default.php'; |
125 | 125 | |
126 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
126 | + return $view->render($view->config($tplconf, $default)); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -137,32 +137,32 @@ discard block |
||
137 | 137 | $view = $this->getView(); |
138 | 138 | $context = $this->getContext(); |
139 | 139 | |
140 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
141 | 141 | $manager->begin(); |
142 | 142 | |
143 | 143 | try |
144 | 144 | { |
145 | - $this->updateItems( $view ); |
|
145 | + $this->updateItems($view); |
|
146 | 146 | $view->categoryBody = ''; |
147 | 147 | |
148 | - foreach( $this->getSubClients() as $client ) { |
|
148 | + foreach ($this->getSubClients() as $client) { |
|
149 | 149 | $view->categoryBody .= $client->save(); |
150 | 150 | } |
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | 154 | } |
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
155 | + catch (\Aimeos\MShop\Exception $e) |
|
156 | 156 | { |
157 | - $error = array( 'product-item-category' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
157 | + $error = array('product-item-category' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
158 | + $view->errors = $view->get('errors', array()) + $error; |
|
159 | 159 | $manager->rollback(); |
160 | 160 | } |
161 | - catch( \Exception $e ) |
|
161 | + catch (\Exception $e) |
|
162 | 162 | { |
163 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
164 | - $error = array( 'product-item-category' => $e->getMessage() ); |
|
165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
164 | + $error = array('product-item-category' => $e->getMessage()); |
|
165 | + $view->errors = $view->get('errors', array()) + $error; |
|
166 | 166 | $manager->rollback(); |
167 | 167 | } |
168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * @param string|null $name Name of the sub-client (Default if null) |
178 | 178 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
179 | 179 | */ |
180 | - public function getSubClient( $type, $name = null ) |
|
180 | + public function getSubClient($type, $name = null) |
|
181 | 181 | { |
182 | 182 | /** admin/jqadm/product/category/decorators/excludes |
183 | 183 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @see admin/jqadm/product/category/decorators/excludes |
253 | 253 | * @see admin/jqadm/product/category/decorators/global |
254 | 254 | */ |
255 | - return $this->createSubClient( 'product/category/' . $type, $name ); |
|
255 | + return $this->createSubClient('product/category/' . $type, $name); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | */ |
264 | 264 | protected function getSubClientNames() |
265 | 265 | { |
266 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
266 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | |
@@ -273,20 +273,20 @@ discard block |
||
273 | 273 | * @param array $listItems List of items implementing \Aimeos\Common\Item\Lists\Iface |
274 | 274 | * @return array Associative list of catalog IDs as keys and items implementing \Aimeos\Catalog\Item\Iface as values |
275 | 275 | */ |
276 | - protected function getCatalogItems( array $listItems ) |
|
276 | + protected function getCatalogItems(array $listItems) |
|
277 | 277 | { |
278 | 278 | $ids = array(); |
279 | 279 | |
280 | - foreach( $listItems as $listItem ) { |
|
280 | + foreach ($listItems as $listItem) { |
|
281 | 281 | $ids[] = $listItem->getParentId(); |
282 | 282 | } |
283 | 283 | |
284 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog' ); |
|
284 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog'); |
|
285 | 285 | |
286 | 286 | $search = $manager->createSearch(); |
287 | - $search->setConditions( $search->compare( '==', 'catalog.id', $ids ) ); |
|
287 | + $search->setConditions($search->compare('==', 'catalog.id', $ids)); |
|
288 | 288 | |
289 | - return $manager->searchItems( $search ); |
|
289 | + return $manager->searchItems($search); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | |
@@ -296,19 +296,19 @@ discard block |
||
296 | 296 | * @param string $prodid Unique product ID |
297 | 297 | * @return array Associative list of category list IDs as keys and list items as values |
298 | 298 | */ |
299 | - protected function getListItems( $prodid ) |
|
299 | + protected function getListItems($prodid) |
|
300 | 300 | { |
301 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' ); |
|
301 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists'); |
|
302 | 302 | |
303 | 303 | $search = $manager->createSearch(); |
304 | 304 | $expr = array( |
305 | - $search->compare( '==', 'catalog.lists.refid', $prodid ), |
|
306 | - $search->compare( '==', 'catalog.lists.domain', 'product' ), |
|
307 | - $search->compare( '==', 'catalog.lists.type.domain', 'product' ), |
|
305 | + $search->compare('==', 'catalog.lists.refid', $prodid), |
|
306 | + $search->compare('==', 'catalog.lists.domain', 'product'), |
|
307 | + $search->compare('==', 'catalog.lists.type.domain', 'product'), |
|
308 | 308 | ); |
309 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
309 | + $search->setConditions($search->combine('&&', $expr)); |
|
310 | 310 | |
311 | - return $manager->searchItems( $search ); |
|
311 | + return $manager->searchItems($search); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -320,13 +320,13 @@ discard block |
||
320 | 320 | protected function getListTypes() |
321 | 321 | { |
322 | 322 | $list = array(); |
323 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists/type' ); |
|
323 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists/type'); |
|
324 | 324 | |
325 | 325 | $search = $manager->createSearch(); |
326 | - $search->setConditions( $search->compare( '==', 'catalog.lists.type.domain', 'product' ) ); |
|
327 | - $search->setSlice( 0, 0x7fffffff ); |
|
326 | + $search->setConditions($search->compare('==', 'catalog.lists.type.domain', 'product')); |
|
327 | + $search->setSlice(0, 0x7fffffff); |
|
328 | 328 | |
329 | - foreach( $manager->searchItems( $search ) as $item ) { |
|
329 | + foreach ($manager->searchItems($search) as $item) { |
|
330 | 330 | $list[$item->getCode()] = $item->getId(); |
331 | 331 | } |
332 | 332 | |
@@ -339,29 +339,29 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
341 | 341 | */ |
342 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
342 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
343 | 343 | { |
344 | - $view->categoryData = (array) $view->param( 'category', array() ); |
|
344 | + $view->categoryData = (array) $view->param('category', array()); |
|
345 | 345 | |
346 | - if( !empty( $view->categoryData ) ) { |
|
346 | + if (!empty($view->categoryData)) { |
|
347 | 347 | return; |
348 | 348 | } |
349 | 349 | |
350 | - $listItems = $this->getListItems( $view->item->getId() ); |
|
351 | - $catItems = $this->getCatalogItems( $listItems ); |
|
350 | + $listItems = $this->getListItems($view->item->getId()); |
|
351 | + $catItems = $this->getCatalogItems($listItems); |
|
352 | 352 | $data = array(); |
353 | 353 | |
354 | - foreach( $listItems as $listItem ) |
|
354 | + foreach ($listItems as $listItem) |
|
355 | 355 | { |
356 | 356 | $catId = $listItem->getParentId(); |
357 | 357 | |
358 | - if( isset( $catItems[$catId] ) ) |
|
358 | + if (isset($catItems[$catId])) |
|
359 | 359 | { |
360 | 360 | $data['catalog.id'][] = $catId; |
361 | 361 | $data['catalog.label'][] = $catItems[$catId]->getLabel(); |
362 | 362 | } |
363 | 363 | |
364 | - foreach( $listItem->toArray() as $key => $value ) { |
|
364 | + foreach ($listItem->toArray() as $key => $value) { |
|
365 | 365 | $data[$key][] = $value; |
366 | 366 | } |
367 | 367 | } |
@@ -376,36 +376,36 @@ discard block |
||
376 | 376 | * |
377 | 377 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
378 | 378 | */ |
379 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
379 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
380 | 380 | { |
381 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'catalog/lists' ); |
|
381 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'catalog/lists'); |
|
382 | 382 | |
383 | 383 | $id = $view->item->getId(); |
384 | - $map = $this->getListItems( $id ); |
|
385 | - $listIds = (array) $view->param( 'category/catalog.lists.id', array() ); |
|
384 | + $map = $this->getListItems($id); |
|
385 | + $listIds = (array) $view->param('category/catalog.lists.id', array()); |
|
386 | 386 | |
387 | 387 | |
388 | - foreach( $listIds as $pos => $listid ) |
|
388 | + foreach ($listIds as $pos => $listid) |
|
389 | 389 | { |
390 | - if( isset( $map[$listid] ) ) { |
|
391 | - unset( $map[$listid], $listIds[$pos] ); |
|
390 | + if (isset($map[$listid])) { |
|
391 | + unset($map[$listid], $listIds[$pos]); |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | - $manager->deleteItems( array_keys( $map ) ); |
|
395 | + $manager->deleteItems(array_keys($map)); |
|
396 | 396 | |
397 | 397 | |
398 | 398 | $item = $manager->createItem(); |
399 | - $item->setDomain( 'product' ); |
|
400 | - $item->setRefId( $id ); |
|
399 | + $item->setDomain('product'); |
|
400 | + $item->setRefId($id); |
|
401 | 401 | |
402 | - foreach( $listIds as $pos => $listid ) |
|
402 | + foreach ($listIds as $pos => $listid) |
|
403 | 403 | { |
404 | - $item->setId( null ); |
|
405 | - $item->setParentId( $view->param( 'category/catalog.id/' . $pos ) ); |
|
406 | - $item->setTypeId( $view->param( 'category/catalog.lists.typeid/' . $pos ) ); |
|
404 | + $item->setId(null); |
|
405 | + $item->setParentId($view->param('category/catalog.id/' . $pos)); |
|
406 | + $item->setTypeId($view->param('category/catalog.lists.typeid/' . $pos)); |
|
407 | 407 | |
408 | - $manager->saveItem( $item, false ); |
|
408 | + $manager->saveItem($item, false); |
|
409 | 409 | } |
410 | 410 | } |
411 | 411 | } |
412 | 412 | \ No newline at end of file |
@@ -151,14 +151,12 @@ |
||
151 | 151 | |
152 | 152 | $manager->commit(); |
153 | 153 | return; |
154 | - } |
|
155 | - catch( \Aimeos\MShop\Exception $e ) |
|
154 | + } catch( \Aimeos\MShop\Exception $e ) |
|
156 | 155 | { |
157 | 156 | $error = array( 'product-item-category' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
158 | 157 | $view->errors = $view->get( 'errors', array() ) + $error; |
159 | 158 | $manager->rollback(); |
160 | - } |
|
161 | - catch( \Exception $e ) |
|
159 | + } catch( \Exception $e ) |
|
162 | 160 | { |
163 | 161 | $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
164 | 162 | $error = array( 'product-item-category' => $e->getMessage() ); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @category Developer |
56 | 56 | */ |
57 | 57 | private $subPartPath = 'admin/jqadm/product/standard/subparts'; |
58 | - private $subPartNames = array( 'selection', 'bundle', 'image', 'text', 'price', 'stock', 'category', 'characteristic', 'physical', 'download' ); |
|
58 | + private $subPartNames = array('selection', 'bundle', 'image', 'text', 'price', 'stock', 'category', 'characteristic', 'physical', 'download'); |
|
59 | 59 | |
60 | 60 | |
61 | 61 | /** |
@@ -70,39 +70,39 @@ discard block |
||
70 | 70 | |
71 | 71 | try |
72 | 72 | { |
73 | - $this->setData( $view ); |
|
73 | + $this->setData($view); |
|
74 | 74 | |
75 | - if( isset( $view->itemData['product.code'] ) ) |
|
75 | + if (isset($view->itemData['product.code'])) |
|
76 | 76 | { |
77 | 77 | $data = $view->itemData; |
78 | 78 | $data['product.id'] = ''; |
79 | 79 | $data['product.code'] = $data['product.code'] . '_copy'; |
80 | 80 | |
81 | - $view->item->setCode( $data['product.code'] ); |
|
81 | + $view->item->setCode($data['product.code']); |
|
82 | 82 | $view->itemData = $data; |
83 | 83 | } |
84 | 84 | |
85 | 85 | $view->itemBody = ''; |
86 | 86 | |
87 | - foreach( $this->getSubClients() as $client ) { |
|
87 | + foreach ($this->getSubClients() as $client) { |
|
88 | 88 | $view->itemBody .= $client->copy(); |
89 | 89 | } |
90 | 90 | } |
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
91 | + catch (\Aimeos\MShop\Exception $e) |
|
92 | 92 | { |
93 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
94 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
93 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
94 | + $view->errors = $view->get('errors', array()) + $error; |
|
95 | 95 | } |
96 | - catch( \Exception $e ) |
|
96 | + catch (\Exception $e) |
|
97 | 97 | { |
98 | - $error = array( 'product-item' => $e->getMessage() ); |
|
99 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
98 | + $error = array('product-item' => $e->getMessage()); |
|
99 | + $view->errors = $view->get('errors', array()) + $error; |
|
100 | 100 | } |
101 | 101 | |
102 | 102 | $tplconf = 'admin/jqadm/product/template-item'; |
103 | 103 | $default = 'product/item-default.php'; |
104 | 104 | |
105 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
105 | + return $view->render($view->config($tplconf, $default)); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -118,28 +118,28 @@ discard block |
||
118 | 118 | |
119 | 119 | try |
120 | 120 | { |
121 | - $this->setData( $view ); |
|
121 | + $this->setData($view); |
|
122 | 122 | $view->itemBody = ''; |
123 | 123 | |
124 | - foreach( $this->getSubClients() as $client ) { |
|
124 | + foreach ($this->getSubClients() as $client) { |
|
125 | 125 | $view->itemBody .= $client->create(); |
126 | 126 | } |
127 | 127 | } |
128 | - catch( \Aimeos\MShop\Exception $e ) |
|
128 | + catch (\Aimeos\MShop\Exception $e) |
|
129 | 129 | { |
130 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
131 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
130 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
131 | + $view->errors = $view->get('errors', array()) + $error; |
|
132 | 132 | } |
133 | - catch( \Exception $e ) |
|
133 | + catch (\Exception $e) |
|
134 | 134 | { |
135 | - $error = array( 'product-item' => $e->getMessage() ); |
|
136 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
135 | + $error = array('product-item' => $e->getMessage()); |
|
136 | + $view->errors = $view->get('errors', array()) + $error; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | $tplconf = 'admin/jqadm/product/template-item'; |
140 | 140 | $default = 'product/item-default.php'; |
141 | 141 | |
142 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
142 | + return $view->render($view->config($tplconf, $default)); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -153,30 +153,30 @@ discard block |
||
153 | 153 | $view = $this->getView(); |
154 | 154 | $context = $this->getContext(); |
155 | 155 | |
156 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
156 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
157 | 157 | $manager->begin(); |
158 | 158 | |
159 | 159 | try |
160 | 160 | { |
161 | - foreach( $this->getSubClients() as $client ) { |
|
161 | + foreach ($this->getSubClients() as $client) { |
|
162 | 162 | $client->delete(); |
163 | 163 | } |
164 | 164 | |
165 | - $manager->deleteItems( (array) $view->param( 'id' ) ); |
|
165 | + $manager->deleteItems((array) $view->param('id')); |
|
166 | 166 | $manager->commit(); |
167 | 167 | |
168 | 168 | return; |
169 | 169 | } |
170 | - catch( \Aimeos\MShop\Exception $e ) |
|
170 | + catch (\Aimeos\MShop\Exception $e) |
|
171 | 171 | { |
172 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
173 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
172 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
173 | + $view->errors = $view->get('errors', array()) + $error; |
|
174 | 174 | $manager->rollback(); |
175 | 175 | } |
176 | - catch( \Exception $e ) |
|
176 | + catch (\Exception $e) |
|
177 | 177 | { |
178 | - $error = array( 'product-item' => $e->getMessage() ); |
|
179 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
178 | + $error = array('product-item' => $e->getMessage()); |
|
179 | + $view->errors = $view->get('errors', array()) + $error; |
|
180 | 180 | $manager->rollback(); |
181 | 181 | } |
182 | 182 | } |
@@ -194,28 +194,28 @@ discard block |
||
194 | 194 | |
195 | 195 | try |
196 | 196 | { |
197 | - $this->setData( $view ); |
|
197 | + $this->setData($view); |
|
198 | 198 | $view->itemBody = ''; |
199 | 199 | |
200 | - foreach( $this->getSubClients() as $client ) { |
|
200 | + foreach ($this->getSubClients() as $client) { |
|
201 | 201 | $view->itemBody .= $client->get(); |
202 | 202 | } |
203 | 203 | } |
204 | - catch( \Aimeos\MShop\Exception $e ) |
|
204 | + catch (\Aimeos\MShop\Exception $e) |
|
205 | 205 | { |
206 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
207 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
206 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
207 | + $view->errors = $view->get('errors', array()) + $error; |
|
208 | 208 | } |
209 | - catch( \Exception $e ) |
|
209 | + catch (\Exception $e) |
|
210 | 210 | { |
211 | - $error = array( 'product-item' => $e->getMessage() ); |
|
212 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
211 | + $error = array('product-item' => $e->getMessage()); |
|
212 | + $view->errors = $view->get('errors', array()) + $error; |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | $tplconf = 'admin/jqadm/product/template-item'; |
216 | 216 | $default = 'product/item-default.php'; |
217 | 217 | |
218 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
218 | + return $view->render($view->config($tplconf, $default)); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -229,41 +229,41 @@ discard block |
||
229 | 229 | $view = $this->getView(); |
230 | 230 | $context = $this->getContext(); |
231 | 231 | |
232 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
232 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
233 | 233 | $manager->begin(); |
234 | 234 | |
235 | 235 | $item = $manager->createItem(); |
236 | 236 | |
237 | 237 | try |
238 | 238 | { |
239 | - $item->fromArray( $view->param( 'item', array() ) ); |
|
240 | - $item->setConfig( $this->getItemConfig( $view ) ); |
|
241 | - $manager->saveItem( $item ); |
|
239 | + $item->fromArray($view->param('item', array())); |
|
240 | + $item->setConfig($this->getItemConfig($view)); |
|
241 | + $manager->saveItem($item); |
|
242 | 242 | |
243 | - $view->item = $manager->getItem( $item->getId() ); // product.type must be available |
|
243 | + $view->item = $manager->getItem($item->getId()); // product.type must be available |
|
244 | 244 | $view->itemBody = ''; |
245 | 245 | |
246 | - foreach( $this->getSubClients() as $client ) { |
|
246 | + foreach ($this->getSubClients() as $client) { |
|
247 | 247 | $view->itemBody .= $client->save(); |
248 | 248 | } |
249 | 249 | |
250 | 250 | $manager->commit(); |
251 | 251 | return; |
252 | 252 | } |
253 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
253 | + catch (\Aimeos\Admin\JQAdm\Exception $e) |
|
254 | 254 | { |
255 | 255 | // fall through to create() |
256 | 256 | } |
257 | - catch( \Aimeos\MShop\Exception $e ) |
|
257 | + catch (\Aimeos\MShop\Exception $e) |
|
258 | 258 | { |
259 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
260 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
259 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
260 | + $view->errors = $view->get('errors', array()) + $error; |
|
261 | 261 | $manager->rollback(); |
262 | 262 | } |
263 | - catch( \Exception $e ) |
|
263 | + catch (\Exception $e) |
|
264 | 264 | { |
265 | - $error = array( 'product-item' => $e->getMessage() ); |
|
266 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
265 | + $error = array('product-item' => $e->getMessage()); |
|
266 | + $view->errors = $view->get('errors', array()) + $error; |
|
267 | 267 | $manager->rollback(); |
268 | 268 | } |
269 | 269 | |
@@ -284,34 +284,34 @@ discard block |
||
284 | 284 | try |
285 | 285 | { |
286 | 286 | $total = 0; |
287 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
288 | - $search = $this->initCriteria( $manager->createSearch(), $view->param() ); |
|
287 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
288 | + $search = $this->initCriteria($manager->createSearch(), $view->param()); |
|
289 | 289 | |
290 | 290 | $view->pageParams = $this->getClientParams(); |
291 | - $view->items = $manager->searchItems( $search, array(), $total ); |
|
291 | + $view->items = $manager->searchItems($search, array(), $total); |
|
292 | 292 | $view->filterOperators = $search->getOperators(); |
293 | 293 | $view->total = $total; |
294 | 294 | $view->itemBody = ''; |
295 | 295 | |
296 | - foreach( $this->getSubClients() as $client ) { |
|
296 | + foreach ($this->getSubClients() as $client) { |
|
297 | 297 | $view->itemBody .= $client->search(); |
298 | 298 | } |
299 | 299 | } |
300 | - catch( \Aimeos\MShop\Exception $e ) |
|
300 | + catch (\Aimeos\MShop\Exception $e) |
|
301 | 301 | { |
302 | - $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
303 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
302 | + $error = array('product-item' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
303 | + $view->errors = $view->get('errors', array()) + $error; |
|
304 | 304 | } |
305 | - catch( \Exception $e ) |
|
305 | + catch (\Exception $e) |
|
306 | 306 | { |
307 | - $error = array( 'product-item' => $e->getMessage() ); |
|
308 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
307 | + $error = array('product-item' => $e->getMessage()); |
|
308 | + $view->errors = $view->get('errors', array()) + $error; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | $tplconf = 'admin/jqadm/product/template-list'; |
312 | 312 | $default = 'product/list-default.php'; |
313 | 313 | |
314 | - return $view->render( $view->config( $tplconf, $default ) ); |
|
314 | + return $view->render($view->config($tplconf, $default)); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @param string|null $name Name of the sub-client (Default if null) |
323 | 323 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
324 | 324 | */ |
325 | - public function getSubClient( $type, $name = null ) |
|
325 | + public function getSubClient($type, $name = null) |
|
326 | 326 | { |
327 | 327 | /** admin/jqadm/product/decorators/excludes |
328 | 328 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | * @see admin/jqadm/product/decorators/excludes |
398 | 398 | * @see admin/jqadm/product/decorators/global |
399 | 399 | */ |
400 | - return $this->createSubClient( 'product/' . $type, $name ); |
|
400 | + return $this->createSubClient('product/' . $type, $name); |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | |
@@ -407,17 +407,17 @@ discard block |
||
407 | 407 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
408 | 408 | * @return array Multi-dimensional associative array |
409 | 409 | */ |
410 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
410 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
411 | 411 | { |
412 | 412 | $context = $this->getContext(); |
413 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
413 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
414 | 414 | |
415 | 415 | $view->pageParams = $this->getClientParams(); |
416 | - $view->itemData = (array) $view->param( 'item', array() ); |
|
416 | + $view->itemData = (array) $view->param('item', array()); |
|
417 | 417 | $view->itemTypes = $this->getTypeItems(); |
418 | 418 | $view->item = $manager->createItem(); |
419 | 419 | |
420 | - if( !empty( $view->itemData ) || ( $id = $view->param( 'id' ) ) === null ) { |
|
420 | + if (!empty($view->itemData) || ($id = $view->param('id')) === null) { |
|
421 | 421 | return; |
422 | 422 | } |
423 | 423 | |
@@ -432,14 +432,14 @@ discard block |
||
432 | 432 | * @since 2016.01 |
433 | 433 | * @category Developer |
434 | 434 | */ |
435 | - $domains = array( 'attribute', 'media', 'price', 'product', 'text' ); |
|
436 | - $domains = $context->getConfig()->get( 'admin/jqadm/product/domains', $domains ); |
|
437 | - $item = $manager->getItem( $id, $domains ); |
|
435 | + $domains = array('attribute', 'media', 'price', 'product', 'text'); |
|
436 | + $domains = $context->getConfig()->get('admin/jqadm/product/domains', $domains); |
|
437 | + $item = $manager->getItem($id, $domains); |
|
438 | 438 | |
439 | 439 | $data = $item->toArray(); |
440 | - $data['config'] = array( 'key' => array(), 'val' => array() ); |
|
440 | + $data['config'] = array('key' => array(), 'val' => array()); |
|
441 | 441 | |
442 | - foreach( $item->getConfig() as $key => $value ) |
|
442 | + foreach ($item->getConfig() as $key => $value) |
|
443 | 443 | { |
444 | 444 | $data['config']['key'][] = $key; |
445 | 445 | $data['config']['val'][] = $value; |
@@ -456,14 +456,14 @@ discard block |
||
456 | 456 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
457 | 457 | * @return array Associative list of key/value pairs |
458 | 458 | */ |
459 | - protected function getItemConfig( \Aimeos\MW\View\Iface $view ) |
|
459 | + protected function getItemConfig(\Aimeos\MW\View\Iface $view) |
|
460 | 460 | { |
461 | 461 | $config = array(); |
462 | 462 | |
463 | - foreach( (array) $view->param( 'item/config/key' ) as $idx => $key ) |
|
463 | + foreach ((array) $view->param('item/config/key') as $idx => $key) |
|
464 | 464 | { |
465 | - if( trim( $key ) !== '' ) { |
|
466 | - $config[$key] = $view->param( 'item/config/val/' . $idx ); |
|
465 | + if (trim($key) !== '') { |
|
466 | + $config[$key] = $view->param('item/config/val/' . $idx); |
|
467 | 467 | } |
468 | 468 | } |
469 | 469 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | */ |
479 | 479 | protected function getSubClientNames() |
480 | 480 | { |
481 | - $result = $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
481 | + $result = $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
482 | 482 | return $result; |
483 | 483 | } |
484 | 484 | |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | */ |
491 | 491 | protected function getTypeItems() |
492 | 492 | { |
493 | - $typeManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/type' ); |
|
493 | + $typeManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/type'); |
|
494 | 494 | |
495 | 495 | $search = $typeManager->createSearch(); |
496 | - $search->setSortations( array( $search->sort( '+', 'product.type.label' ) ) ); |
|
496 | + $search->setSortations(array($search->sort('+', 'product.type.label'))); |
|
497 | 497 | |
498 | - return $typeManager->searchItems( $search ); |
|
498 | + return $typeManager->searchItems($search); |
|
499 | 499 | } |
500 | 500 | } |
@@ -87,13 +87,11 @@ discard block |
||
87 | 87 | foreach( $this->getSubClients() as $client ) { |
88 | 88 | $view->itemBody .= $client->copy(); |
89 | 89 | } |
90 | - } |
|
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
90 | + } catch( \Aimeos\MShop\Exception $e ) |
|
92 | 91 | { |
93 | 92 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
94 | 93 | $view->errors = $view->get( 'errors', array() ) + $error; |
95 | - } |
|
96 | - catch( \Exception $e ) |
|
94 | + } catch( \Exception $e ) |
|
97 | 95 | { |
98 | 96 | $error = array( 'product-item' => $e->getMessage() ); |
99 | 97 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -124,13 +122,11 @@ discard block |
||
124 | 122 | foreach( $this->getSubClients() as $client ) { |
125 | 123 | $view->itemBody .= $client->create(); |
126 | 124 | } |
127 | - } |
|
128 | - catch( \Aimeos\MShop\Exception $e ) |
|
125 | + } catch( \Aimeos\MShop\Exception $e ) |
|
129 | 126 | { |
130 | 127 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
131 | 128 | $view->errors = $view->get( 'errors', array() ) + $error; |
132 | - } |
|
133 | - catch( \Exception $e ) |
|
129 | + } catch( \Exception $e ) |
|
134 | 130 | { |
135 | 131 | $error = array( 'product-item' => $e->getMessage() ); |
136 | 132 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -166,14 +162,12 @@ discard block |
||
166 | 162 | $manager->commit(); |
167 | 163 | |
168 | 164 | return; |
169 | - } |
|
170 | - catch( \Aimeos\MShop\Exception $e ) |
|
165 | + } catch( \Aimeos\MShop\Exception $e ) |
|
171 | 166 | { |
172 | 167 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
173 | 168 | $view->errors = $view->get( 'errors', array() ) + $error; |
174 | 169 | $manager->rollback(); |
175 | - } |
|
176 | - catch( \Exception $e ) |
|
170 | + } catch( \Exception $e ) |
|
177 | 171 | { |
178 | 172 | $error = array( 'product-item' => $e->getMessage() ); |
179 | 173 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -200,13 +194,11 @@ discard block |
||
200 | 194 | foreach( $this->getSubClients() as $client ) { |
201 | 195 | $view->itemBody .= $client->get(); |
202 | 196 | } |
203 | - } |
|
204 | - catch( \Aimeos\MShop\Exception $e ) |
|
197 | + } catch( \Aimeos\MShop\Exception $e ) |
|
205 | 198 | { |
206 | 199 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
207 | 200 | $view->errors = $view->get( 'errors', array() ) + $error; |
208 | - } |
|
209 | - catch( \Exception $e ) |
|
201 | + } catch( \Exception $e ) |
|
210 | 202 | { |
211 | 203 | $error = array( 'product-item' => $e->getMessage() ); |
212 | 204 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -249,18 +241,15 @@ discard block |
||
249 | 241 | |
250 | 242 | $manager->commit(); |
251 | 243 | return; |
252 | - } |
|
253 | - catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
244 | + } catch( \Aimeos\Admin\JQAdm\Exception $e ) |
|
254 | 245 | { |
255 | 246 | // fall through to create() |
256 | - } |
|
257 | - catch( \Aimeos\MShop\Exception $e ) |
|
247 | + } catch( \Aimeos\MShop\Exception $e ) |
|
258 | 248 | { |
259 | 249 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
260 | 250 | $view->errors = $view->get( 'errors', array() ) + $error; |
261 | 251 | $manager->rollback(); |
262 | - } |
|
263 | - catch( \Exception $e ) |
|
252 | + } catch( \Exception $e ) |
|
264 | 253 | { |
265 | 254 | $error = array( 'product-item' => $e->getMessage() ); |
266 | 255 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -296,13 +285,11 @@ discard block |
||
296 | 285 | foreach( $this->getSubClients() as $client ) { |
297 | 286 | $view->itemBody .= $client->search(); |
298 | 287 | } |
299 | - } |
|
300 | - catch( \Aimeos\MShop\Exception $e ) |
|
288 | + } catch( \Aimeos\MShop\Exception $e ) |
|
301 | 289 | { |
302 | 290 | $error = array( 'product-item' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
303 | 291 | $view->errors = $view->get( 'errors', array() ) + $error; |
304 | - } |
|
305 | - catch( \Exception $e ) |
|
292 | + } catch( \Exception $e ) |
|
306 | 293 | { |
307 | 294 | $error = array( 'product-item' => $e->getMessage() ); |
308 | 295 | $view->errors = $view->get( 'errors', array() ) + $error; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @return \Aimeos\Admin\JQAdm\Iface Filter part implementing \Aimeos\Admin\JQAdm\Iface |
31 | 31 | * @throws \Aimeos\Admin\JQAdm\Exception If requested client implementation couldn't be found or initialisation fails |
32 | 32 | */ |
33 | - public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null ) |
|
33 | + public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null) |
|
34 | 34 | { |
35 | 35 | /** admin/jqadm/product/name |
36 | 36 | * Class name of the used account favorite client implementation |
@@ -65,22 +65,22 @@ discard block |
||
65 | 65 | * @since 2016.01 |
66 | 66 | * @category Developer |
67 | 67 | */ |
68 | - if( $name === null ) { |
|
69 | - $name = $context->getConfig()->get( 'admin/jqadm/product/name', 'Standard' ); |
|
68 | + if ($name === null) { |
|
69 | + $name = $context->getConfig()->get('admin/jqadm/product/name', 'Standard'); |
|
70 | 70 | } |
71 | 71 | |
72 | - if( ctype_alnum( $name ) === false ) |
|
72 | + if (ctype_alnum($name) === false) |
|
73 | 73 | { |
74 | - $classname = is_string( $name ) ? '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name : '<not a string>'; |
|
75 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
74 | + $classname = is_string($name) ? '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name : '<not a string>'; |
|
75 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | $iface = '\\Aimeos\\Admin\\JQAdm\\Iface'; |
79 | 79 | $classname = '\\Aimeos\\Admin\\JQAdm\\Product\\' . $name; |
80 | 80 | |
81 | - $client = self::createClientBase( $context, $classname, $iface, $templatePaths ); |
|
81 | + $client = self::createClientBase($context, $classname, $iface, $templatePaths); |
|
82 | 82 | |
83 | - return self::addClientDecorators( $context, $client, $templatePaths, 'product' ); |
|
83 | + return self::addClientDecorators($context, $client, $templatePaths, 'product'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | } |
87 | 87 | \ No newline at end of file |
@@ -28,5 +28,5 @@ |
||
28 | 28 | * and a list of relative paths inside the core or the extension as values |
29 | 29 | * @return void |
30 | 30 | */ |
31 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths ); |
|
31 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths); |
|
32 | 32 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | * @param string $classname Full name of the class for which the object should be returned |
31 | 31 | * @param \Aimeos\Admin\JQAdm\Iface|null $client ExtJS client object |
32 | 32 | */ |
33 | - public static function injectClient( $classname, \Aimeos\Admin\JQAdm\Iface $client = null ) |
|
33 | + public static function injectClient($classname, \Aimeos\Admin\JQAdm\Iface $client = null) |
|
34 | 34 | { |
35 | 35 | self::$objects[$classname] = $client; |
36 | 36 | } |
@@ -46,29 +46,29 @@ discard block |
||
46 | 46 | * @param string $classprefix Decorator class prefix, e.g. "\Aimeos\Admin\JQAdm\Catalog\Decorator\" |
47 | 47 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
48 | 48 | */ |
49 | - protected static function addDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
50 | - \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, array $decorators, $classprefix ) |
|
49 | + protected static function addDecorators(\Aimeos\MShop\Context\Item\Iface $context, |
|
50 | + \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, array $decorators, $classprefix) |
|
51 | 51 | { |
52 | 52 | $iface = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\Iface'; |
53 | 53 | |
54 | - foreach( $decorators as $name ) |
|
54 | + foreach ($decorators as $name) |
|
55 | 55 | { |
56 | - if( ctype_alnum( $name ) === false ) |
|
56 | + if (ctype_alnum($name) === false) |
|
57 | 57 | { |
58 | - $classname = is_string( $name ) ? $classprefix . $name : '<not a string>'; |
|
59 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid class name "%1$s"', $classname ) ); |
|
58 | + $classname = is_string($name) ? $classprefix . $name : '<not a string>'; |
|
59 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid class name "%1$s"', $classname)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | $classname = $classprefix . $name; |
63 | 63 | |
64 | - if( class_exists( $classname ) === false ) { |
|
65 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not found', $classname ) ); |
|
64 | + if (class_exists($classname) === false) { |
|
65 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not found', $classname)); |
|
66 | 66 | } |
67 | 67 | |
68 | - $client = new $classname( $client, $context, $templatePaths ); |
|
68 | + $client = new $classname($client, $context, $templatePaths); |
|
69 | 69 | |
70 | - if( !( $client instanceof $iface ) ) { |
|
71 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement "%2$s"', $classname, $iface ) ); |
|
70 | + if (!($client instanceof $iface)) { |
|
71 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement "%2$s"', $classname, $iface)); |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | * @param string $path Path of the client in lower case, e.g. "catalog/detail" |
86 | 86 | * @return \Aimeos\Admin\JQAdm\Iface Admin object |
87 | 87 | */ |
88 | - protected static function addClientDecorators( \Aimeos\MShop\Context\Item\Iface $context, |
|
89 | - \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path ) |
|
88 | + protected static function addClientDecorators(\Aimeos\MShop\Context\Item\Iface $context, |
|
89 | + \Aimeos\Admin\JQAdm\Iface $client, array $templatePaths, $path) |
|
90 | 90 | { |
91 | - if( !is_string( $path ) || $path === '' ) { |
|
92 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid domain "%1$s"', $path ) ); |
|
91 | + if (!is_string($path) || $path === '') { |
|
92 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid domain "%1$s"', $path)); |
|
93 | 93 | } |
94 | 94 | |
95 | - $localClass = str_replace( ' ', '\\', ucwords( str_replace( '/', ' ', $path ) ) ); |
|
95 | + $localClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $path))); |
|
96 | 96 | $config = $context->getConfig(); |
97 | 97 | |
98 | 98 | /** admin/jqadm/common/decorators/default |
@@ -117,26 +117,26 @@ discard block |
||
117 | 117 | * @since 2014.03 |
118 | 118 | * @category Developer |
119 | 119 | */ |
120 | - $decorators = $config->get( 'admin/jqadm/common/decorators/default', array() ); |
|
121 | - $excludes = $config->get( 'admin/jqadm/' . $path . '/decorators/excludes', array() ); |
|
120 | + $decorators = $config->get('admin/jqadm/common/decorators/default', array()); |
|
121 | + $excludes = $config->get('admin/jqadm/' . $path . '/decorators/excludes', array()); |
|
122 | 122 | |
123 | - foreach( $decorators as $key => $name ) |
|
123 | + foreach ($decorators as $key => $name) |
|
124 | 124 | { |
125 | - if( in_array( $name, $excludes ) ) { |
|
126 | - unset( $decorators[$key] ); |
|
125 | + if (in_array($name, $excludes)) { |
|
126 | + unset($decorators[$key]); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | 130 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
131 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
131 | + $client = self::addDecorators($context, $client, $templatePaths, $decorators, $classprefix); |
|
132 | 132 | |
133 | 133 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\Common\\Decorator\\'; |
134 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/global', array() ); |
|
135 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
134 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/global', array()); |
|
135 | + $client = self::addDecorators($context, $client, $templatePaths, $decorators, $classprefix); |
|
136 | 136 | |
137 | 137 | $classprefix = '\\Aimeos\\Admin\\JQAdm\\' . $localClass . '\\Decorator\\'; |
138 | - $decorators = $config->get( 'admin/jqadm/' . $path . '/decorators/local', array() ); |
|
139 | - $client = self::addDecorators( $context, $client, $templatePaths, $decorators, $classprefix ); |
|
138 | + $decorators = $config->get('admin/jqadm/' . $path . '/decorators/local', array()); |
|
139 | + $client = self::addDecorators($context, $client, $templatePaths, $decorators, $classprefix); |
|
140 | 140 | |
141 | 141 | return $client; |
142 | 142 | } |
@@ -152,20 +152,20 @@ discard block |
||
152 | 152 | * @return \Aimeos\Admin\JQAdm\\Iface Admin object |
153 | 153 | * @throws \Aimeos\Admin\JQAdm\Exception If client couldn't be found or doesn't implement the interface |
154 | 154 | */ |
155 | - protected static function createClientBase( \Aimeos\MShop\Context\Item\Iface $context, $classname, $interface, $templatePaths ) |
|
155 | + protected static function createClientBase(\Aimeos\MShop\Context\Item\Iface $context, $classname, $interface, $templatePaths) |
|
156 | 156 | { |
157 | - if( isset( self::$objects[$classname] ) ) { |
|
157 | + if (isset(self::$objects[$classname])) { |
|
158 | 158 | return self::$objects[$classname]; |
159 | 159 | } |
160 | 160 | |
161 | - if( class_exists( $classname ) === false ) { |
|
162 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not available', $classname ) ); |
|
161 | + if (class_exists($classname) === false) { |
|
162 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not available', $classname)); |
|
163 | 163 | } |
164 | 164 | |
165 | - $client = new $classname( $context, $templatePaths ); |
|
165 | + $client = new $classname($context, $templatePaths); |
|
166 | 166 | |
167 | - if( !( $client instanceof $interface ) ) { |
|
168 | - throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" does not implement interface "%2$s"', $classname, $interface ) ); |
|
167 | + if (!($client instanceof $interface)) { |
|
168 | + throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" does not implement interface "%2$s"', $classname, $interface)); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | return $client; |