@@ -19,45 +19,45 @@ |
||
| 19 | 19 | |
| 20 | 20 | protected function setUp() |
| 21 | 21 | { |
| 22 | - $this->cache = $this->getMockBuilder( 'Aimeos\MW\Cache\None' ) |
|
| 23 | - ->setMethods( array( 'deleteByTags' ) ) |
|
| 22 | + $this->cache = $this->getMockBuilder('Aimeos\MW\Cache\None') |
|
| 23 | + ->setMethods(array('deleteByTags')) |
|
| 24 | 24 | ->disableOriginalConstructor() |
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Category\Standard' ) |
|
| 28 | - ->setMethods( array( 'save' ) ) |
|
| 27 | + $this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Category\Standard') |
|
| 28 | + ->setMethods(array('save')) |
|
| 29 | 29 | ->disableOriginalConstructor() |
| 30 | 30 | ->getMock(); |
| 31 | 31 | |
| 32 | 32 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
| 33 | 33 | $this->context = \TestHelperJqadm::getContext(); |
| 34 | - $this->context->setCache( $this->cache ); |
|
| 34 | + $this->context->setCache($this->cache); |
|
| 35 | 35 | |
| 36 | - $this->object = new \Aimeos\Admin\JQAdm\Product\Category\Decorator\Cache( $this->mock, $this->context, $templatePaths ); |
|
| 36 | + $this->object = new \Aimeos\Admin\JQAdm\Product\Category\Decorator\Cache($this->mock, $this->context, $templatePaths); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | protected function tearDown() |
| 41 | 41 | { |
| 42 | - unset( $this->object, $this->mock, $this->context, $this->cache ); |
|
| 42 | + unset($this->object, $this->mock, $this->context, $this->cache); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | public function testSave() |
| 47 | 47 | { |
| 48 | 48 | $view = \TestHelperJqadm::getView(); |
| 49 | - $tags = array( 'catalog', 'catalog-1', 'catalog-2' ); |
|
| 49 | + $tags = array('catalog', 'catalog-1', 'catalog-2'); |
|
| 50 | 50 | |
| 51 | - $param = array( 'category' => array( 'catalog.id' => array( '1', '2' ) ) ); |
|
| 52 | - $helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param ); |
|
| 53 | - $view->addHelper( 'param', $helper ); |
|
| 51 | + $param = array('category' => array('catalog.id' => array('1', '2'))); |
|
| 52 | + $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $param); |
|
| 53 | + $view->addHelper('param', $helper); |
|
| 54 | 54 | |
| 55 | - $this->cache->expects( $this->once() )->method( 'deleteByTags' )->with( $this->equalTo( $tags ) ); |
|
| 56 | - $this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) ); |
|
| 55 | + $this->cache->expects($this->once())->method('deleteByTags')->with($this->equalTo($tags)); |
|
| 56 | + $this->mock->expects($this->once())->method('save')->will($this->returnValue('test')); |
|
| 57 | 57 | |
| 58 | - $this->object->setView( $view ); |
|
| 58 | + $this->object->setView($view); |
|
| 59 | 59 | $result = $this->object->save(); |
| 60 | 60 | |
| 61 | - $this->assertEquals( 'test', $result ); |
|
| 61 | + $this->assertEquals('test', $result); |
|
| 62 | 62 | } |
| 63 | 63 | } |
@@ -19,44 +19,44 @@ |
||
| 19 | 19 | |
| 20 | 20 | protected function setUp() |
| 21 | 21 | { |
| 22 | - $this->cache = $this->getMockBuilder( 'Aimeos\MW\Cache\None' ) |
|
| 23 | - ->setMethods( array( 'deleteByTags' ) ) |
|
| 22 | + $this->cache = $this->getMockBuilder('Aimeos\MW\Cache\None') |
|
| 23 | + ->setMethods(array('deleteByTags')) |
|
| 24 | 24 | ->disableOriginalConstructor() |
| 25 | 25 | ->getMock(); |
| 26 | 26 | |
| 27 | - $this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Standard' ) |
|
| 28 | - ->setMethods( array( 'save' ) ) |
|
| 27 | + $this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Standard') |
|
| 28 | + ->setMethods(array('save')) |
|
| 29 | 29 | ->disableOriginalConstructor() |
| 30 | 30 | ->getMock(); |
| 31 | 31 | |
| 32 | 32 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
| 33 | 33 | $this->context = \TestHelperJqadm::getContext(); |
| 34 | - $this->context->setCache( $this->cache ); |
|
| 34 | + $this->context->setCache($this->cache); |
|
| 35 | 35 | |
| 36 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Cache( $this->mock, $this->context, $templatePaths ); |
|
| 36 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Cache($this->mock, $this->context, $templatePaths); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | protected function tearDown() |
| 41 | 41 | { |
| 42 | - unset( $this->object, $this->mock, $this->context, $this->cache ); |
|
| 42 | + unset($this->object, $this->mock, $this->context, $this->cache); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | public function testSave() |
| 47 | 47 | { |
| 48 | - $item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
| 48 | + $item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
| 49 | 49 | |
| 50 | - $tags = array( 'product', 'product-' . $item->getId() ); |
|
| 50 | + $tags = array('product', 'product-' . $item->getId()); |
|
| 51 | 51 | $view = \TestHelperJqadm::getView(); |
| 52 | 52 | $view->item = $item; |
| 53 | 53 | |
| 54 | - $this->cache->expects( $this->once() )->method( 'deleteByTags' )->with( $this->equalTo( $tags ) ); |
|
| 55 | - $this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) ); |
|
| 54 | + $this->cache->expects($this->once())->method('deleteByTags')->with($this->equalTo($tags)); |
|
| 55 | + $this->mock->expects($this->once())->method('save')->will($this->returnValue('test')); |
|
| 56 | 56 | |
| 57 | - $this->object->setView( $view ); |
|
| 57 | + $this->object->setView($view); |
|
| 58 | 58 | $result = $this->object->save(); |
| 59 | 59 | |
| 60 | - $this->assertEquals( 'test', $result ); |
|
| 60 | + $this->assertEquals('test', $result); |
|
| 61 | 61 | } |
| 62 | 62 | } |
@@ -20,14 +20,14 @@ discard block |
||
| 20 | 20 | $this->context = \TestHelperJqadm::getContext(); |
| 21 | 21 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
| 22 | 22 | |
| 23 | - $client = new \Aimeos\Admin\JQAdm\Product\Standard( $this->context, $templatePaths ); |
|
| 24 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $client, $this->context, $templatePaths ); |
|
| 23 | + $client = new \Aimeos\Admin\JQAdm\Product\Standard($this->context, $templatePaths); |
|
| 24 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page($client, $this->context, $templatePaths); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | protected function tearDown() |
| 29 | 29 | { |
| 30 | - unset( $this->object, $this->context ); |
|
| 30 | + unset($this->object, $this->context); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | { |
| 36 | 36 | $view = \TestHelperJqadm::getView(); |
| 37 | 37 | |
| 38 | - $this->object->setView( $view ); |
|
| 38 | + $this->object->setView($view); |
|
| 39 | 39 | |
| 40 | - $this->assertInternalType( 'array', $view->pageSites ); |
|
| 41 | - $this->assertInternalType( 'array', $view->pageLanguages ); |
|
| 40 | + $this->assertInternalType('array', $view->pageSites); |
|
| 41 | + $this->assertInternalType('array', $view->pageLanguages); |
|
| 42 | 42 | } |
| 43 | 43 | } |
@@ -21,31 +21,31 @@ |
||
| 21 | 21 | $this->context = \TestHelperJqadm::getContext(); |
| 22 | 22 | $templatePaths = \TestHelperJqadm::getTemplatePaths(); |
| 23 | 23 | |
| 24 | - $this->mock = $this->getMockBuilder( 'Aimeos\Admin\JQAdm\Product\Standard' ) |
|
| 25 | - ->setMethods( array( 'save' ) ) |
|
| 24 | + $this->mock = $this->getMockBuilder('Aimeos\Admin\JQAdm\Product\Standard') |
|
| 25 | + ->setMethods(array('save')) |
|
| 26 | 26 | ->disableOriginalConstructor() |
| 27 | 27 | ->getMock(); |
| 28 | 28 | |
| 29 | - $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Index( $this->mock, $this->context, $templatePaths ); |
|
| 29 | + $this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Index($this->mock, $this->context, $templatePaths); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | protected function tearDown() |
| 34 | 34 | { |
| 35 | - unset( $this->object, $this->mock, $this->context ); |
|
| 35 | + unset($this->object, $this->mock, $this->context); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testSave() |
| 40 | 40 | { |
| 41 | 41 | $view = \TestHelperJqadm::getView(); |
| 42 | - $view->item = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( 'CNC' ); |
|
| 42 | + $view->item = \Aimeos\MShop\Factory::createManager($this->context, 'product')->findItem('CNC'); |
|
| 43 | 43 | |
| 44 | - $this->mock->expects( $this->once() )->method( 'save' )->will( $this->returnValue( 'test' ) ); |
|
| 45 | - $this->object->setView( $view ); |
|
| 44 | + $this->mock->expects($this->once())->method('save')->will($this->returnValue('test')); |
|
| 45 | + $this->object->setView($view); |
|
| 46 | 46 | |
| 47 | 47 | $result = $this->object->save(); |
| 48 | 48 | |
| 49 | - $this->assertEquals( 'test', $result ); |
|
| 49 | + $this->assertEquals('test', $result); |
|
| 50 | 50 | } |
| 51 | 51 | } |
@@ -11,17 +11,17 @@ |
||
| 11 | 11 | * Set error reporting to maximum |
| 12 | 12 | */ |
| 13 | 13 | error_reporting( -1 ); |
| 14 | -ini_set( 'display_errors', '1' ); |
|
| 14 | +ini_set('display_errors', '1'); |
|
| 15 | 15 | |
| 16 | -date_default_timezone_set( 'UTC' ); |
|
| 16 | +date_default_timezone_set('UTC'); |
|
| 17 | 17 | |
| 18 | 18 | /* |
| 19 | 19 | * Set locale settings to reasonable defaults |
| 20 | 20 | */ |
| 21 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
| 22 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
| 23 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
| 24 | -setlocale( LC_TIME, 'POSIX' ); |
|
| 21 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 22 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
| 23 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
| 24 | +setlocale(LC_TIME, 'POSIX'); |
|
| 25 | 25 | |
| 26 | 26 | |
| 27 | 27 | require_once 'TestHelperJqadm.php'; |
@@ -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->attributeBody = ''; |
| 72 | 72 | |
| 73 | - foreach( $this->getSubClients() as $client ) { |
|
| 73 | + foreach ($this->getSubClients() as $client) { |
|
| 74 | 74 | $view->attributeBody .= $client->copy(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $tplconf = 'admin/jqadm/product/characteristic/attribute/template-item'; |
| 78 | 78 | $default = 'product/item-characteristic-attribute-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->attributeBody = ''; |
| 95 | 95 | |
| 96 | - foreach( $this->getSubClients() as $client ) { |
|
| 96 | + foreach ($this->getSubClients() as $client) { |
|
| 97 | 97 | $view->attributeBody .= $client->create(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $tplconf = 'admin/jqadm/product/characteristic/attribute/template-item'; |
| 101 | 101 | $default = 'product/item-characteristic-attribute-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->attributeBody = ''; |
| 118 | 118 | |
| 119 | - foreach( $this->getSubClients() as $client ) { |
|
| 119 | + foreach ($this->getSubClients() as $client) { |
|
| 120 | 120 | $view->attributeBody .= $client->get(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $tplconf = 'admin/jqadm/product/characteristic/attribute/template-item'; |
| 124 | 124 | $default = 'product/item-characteristic-attribute-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->attributeBody = ''; |
| 147 | 147 | |
| 148 | - foreach( $this->getSubClients() as $client ) { |
|
| 148 | + foreach ($this->getSubClients() as $client) { |
|
| 149 | 149 | $view->attributeBody .= $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-characteristic-attribute' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 157 | + $error = array('product-item-characteristic-attribute' => $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-characteristic-attribute' => $e->getMessage() ); |
|
| 165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
| 164 | + $error = array('product-item-characteristic-attribute' => $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/characteristic/attribute/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/characteristic/attribute/decorators/excludes |
| 253 | 253 | * @see admin/jqadm/product/characteristic/attribute/decorators/global |
| 254 | 254 | */ |
| 255 | - return $this->createSubClient( 'product/characteristic/attribute/' . $type, $name ); |
|
| 255 | + return $this->createSubClient('product/characteristic/attribute/' . $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 string $prodid Unique product ID |
| 274 | 274 | * @return array Associative list of attribute product IDs as keys and list items as values |
| 275 | 275 | */ |
| 276 | - protected function getListItems( $prodid ) |
|
| 276 | + protected function getListItems($prodid) |
|
| 277 | 277 | { |
| 278 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/lists' ); |
|
| 278 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/lists'); |
|
| 279 | 279 | |
| 280 | 280 | $search = $manager->createSearch(); |
| 281 | 281 | $expr = array( |
| 282 | - $search->compare( '==', 'product.lists.parentid', $prodid ), |
|
| 283 | - $search->compare( '==', 'product.lists.domain', 'attribute' ), |
|
| 284 | - $search->compare( '==', 'product.lists.type.domain', 'attribute' ), |
|
| 285 | - $search->compare( '==', 'product.lists.type.code', 'default' ), |
|
| 282 | + $search->compare('==', 'product.lists.parentid', $prodid), |
|
| 283 | + $search->compare('==', 'product.lists.domain', 'attribute'), |
|
| 284 | + $search->compare('==', 'product.lists.type.domain', 'attribute'), |
|
| 285 | + $search->compare('==', 'product.lists.type.code', 'default'), |
|
| 286 | 286 | ); |
| 287 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 287 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 288 | 288 | |
| 289 | - return $manager->searchItems( $search ); |
|
| 289 | + return $manager->searchItems($search); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
@@ -295,18 +295,18 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 297 | 297 | */ |
| 298 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
| 298 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
| 299 | 299 | { |
| 300 | - $data = (array) $view->param( 'characteristic/attribute', array() ); |
|
| 300 | + $data = (array) $view->param('characteristic/attribute', array()); |
|
| 301 | 301 | |
| 302 | - if( empty( $data ) ) |
|
| 302 | + if (empty($data)) |
|
| 303 | 303 | { |
| 304 | - foreach( $view->item->getListItems( 'attribute', 'default' ) as $listItem ) |
|
| 304 | + foreach ($view->item->getListItems('attribute', 'default') as $listItem) |
|
| 305 | 305 | { |
| 306 | 306 | $refItem = $listItem->getRefItem(); |
| 307 | - $data['attribute.label'][] = ( $refItem ? $refItem->getLabel() : '' ); |
|
| 307 | + $data['attribute.label'][] = ($refItem ? $refItem->getLabel() : ''); |
|
| 308 | 308 | |
| 309 | - foreach( $listItem->toArray() as $key => $value ) { |
|
| 309 | + foreach ($listItem->toArray() as $key => $value) { |
|
| 310 | 310 | $data[$key][] = $value; |
| 311 | 311 | } |
| 312 | 312 | } |
@@ -321,39 +321,39 @@ discard block |
||
| 321 | 321 | * |
| 322 | 322 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 323 | 323 | */ |
| 324 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
| 324 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
| 325 | 325 | { |
| 326 | 326 | $context = $this->getContext(); |
| 327 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
| 328 | - $typeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
| 327 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
| 328 | + $typeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
| 329 | 329 | |
| 330 | 330 | $id = $view->item->getId(); |
| 331 | - $map = $this->getListItems( $id ); |
|
| 332 | - $listIds = (array) $view->param( 'characteristic/attribute/product.lists.id', array() ); |
|
| 331 | + $map = $this->getListItems($id); |
|
| 332 | + $listIds = (array) $view->param('characteristic/attribute/product.lists.id', array()); |
|
| 333 | 333 | |
| 334 | 334 | |
| 335 | - foreach( $listIds as $pos => $listid ) |
|
| 335 | + foreach ($listIds as $pos => $listid) |
|
| 336 | 336 | { |
| 337 | - if( isset( $map[$listid] ) ) { |
|
| 338 | - unset( $map[$listid], $listIds[$pos] ); |
|
| 337 | + if (isset($map[$listid])) { |
|
| 338 | + unset($map[$listid], $listIds[$pos]); |
|
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - $manager->deleteItems( array_keys( $map ) ); |
|
| 342 | + $manager->deleteItems(array_keys($map)); |
|
| 343 | 343 | |
| 344 | 344 | |
| 345 | 345 | $item = $manager->createItem(); |
| 346 | - $item->setTypeId( $typeManager->findItem( 'default', array(), 'attribute' )->getId() ); |
|
| 347 | - $item->setDomain( 'attribute' ); |
|
| 348 | - $item->setParentId( $id ); |
|
| 346 | + $item->setTypeId($typeManager->findItem('default', array(), 'attribute')->getId()); |
|
| 347 | + $item->setDomain('attribute'); |
|
| 348 | + $item->setParentId($id); |
|
| 349 | 349 | |
| 350 | - foreach( $listIds as $pos => $listid ) |
|
| 350 | + foreach ($listIds as $pos => $listid) |
|
| 351 | 351 | { |
| 352 | - $item->setId( null ); |
|
| 353 | - $item->setRefId( $view->param( 'characteristic/attribute/product.lists.refid/' . $pos ) ); |
|
| 354 | - $item->setPosition( $pos ); |
|
| 352 | + $item->setId(null); |
|
| 353 | + $item->setRefId($view->param('characteristic/attribute/product.lists.refid/' . $pos)); |
|
| 354 | + $item->setPosition($pos); |
|
| 355 | 355 | |
| 356 | - $manager->saveItem( $item, false ); |
|
| 356 | + $manager->saveItem($item, false); |
|
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | } |
| 360 | 360 | \ 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() ); |
@@ -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->propertyBody = ''; |
| 72 | 72 | |
| 73 | - foreach( $this->getSubClients() as $client ) { |
|
| 73 | + foreach ($this->getSubClients() as $client) { |
|
| 74 | 74 | $view->propertyBody .= $client->copy(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $tplconf = 'admin/jqadm/product/characteristic/property/template-item'; |
| 78 | 78 | $default = 'product/item-characteristic-property-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->propertyBody = ''; |
| 95 | 95 | |
| 96 | - foreach( $this->getSubClients() as $client ) { |
|
| 96 | + foreach ($this->getSubClients() as $client) { |
|
| 97 | 97 | $view->propertyBody .= $client->create(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $tplconf = 'admin/jqadm/product/characteristic/property/template-item'; |
| 101 | 101 | $default = 'product/item-characteristic-property-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->propertyBody = ''; |
| 118 | 118 | |
| 119 | - foreach( $this->getSubClients() as $client ) { |
|
| 119 | + foreach ($this->getSubClients() as $client) { |
|
| 120 | 120 | $view->propertyBody .= $client->get(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $tplconf = 'admin/jqadm/product/characteristic/property/template-item'; |
| 124 | 124 | $default = 'product/item-characteristic-property-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->propertyBody = ''; |
| 147 | 147 | |
| 148 | - foreach( $this->getSubClients() as $client ) { |
|
| 148 | + foreach ($this->getSubClients() as $client) { |
|
| 149 | 149 | $view->propertyBody .= $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-characteristic-property' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 158 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 157 | + $error = array('product-item-characteristic-property' => $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-characteristic-property' => $e->getMessage() ); |
|
| 165 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 163 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
| 164 | + $error = array('product-item-characteristic-property' => $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/characteristic/property/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/characteristic/property/decorators/excludes |
| 253 | 253 | * @see admin/jqadm/product/characteristic/property/decorators/global |
| 254 | 254 | */ |
| 255 | - return $this->createSubClient( 'product/characteristic/property/' . $type, $name ); |
|
| 255 | + return $this->createSubClient('product/characteristic/property/' . $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 string $prodid Unique product ID |
| 274 | 274 | * @return array Associative list of property IDs as keys and property items as values |
| 275 | 275 | */ |
| 276 | - protected function getProperties( $prodid ) |
|
| 276 | + protected function getProperties($prodid) |
|
| 277 | 277 | { |
| 278 | - $excludes = array( 'package-length', 'package-height', 'package-width', 'package-weight' ); |
|
| 279 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
| 278 | + $excludes = array('package-length', 'package-height', 'package-width', 'package-weight'); |
|
| 279 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property'); |
|
| 280 | 280 | |
| 281 | 281 | $search = $manager->createSearch(); |
| 282 | 282 | $expr = array( |
| 283 | - $search->compare( '==', 'product.property.parentid', $prodid ), |
|
| 284 | - $search->compare( '!=', 'product.property.type.code', $excludes ), |
|
| 283 | + $search->compare('==', 'product.property.parentid', $prodid), |
|
| 284 | + $search->compare('!=', 'product.property.type.code', $excludes), |
|
| 285 | 285 | ); |
| 286 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 287 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 286 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 287 | + $search->setSlice(0, 0x7fffffff); |
|
| 288 | 288 | |
| 289 | - return $manager->searchItems( $search ); |
|
| 289 | + return $manager->searchItems($search); |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | |
@@ -297,14 +297,14 @@ discard block |
||
| 297 | 297 | */ |
| 298 | 298 | protected function getPropertyTypes() |
| 299 | 299 | { |
| 300 | - $excludes = array( 'package-length', 'package-height', 'package-width', 'package-weight' ); |
|
| 301 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property/type' ); |
|
| 300 | + $excludes = array('package-length', 'package-height', 'package-width', 'package-weight'); |
|
| 301 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property/type'); |
|
| 302 | 302 | |
| 303 | 303 | $search = $manager->createSearch(); |
| 304 | - $search->setConditions( $search->compare( '!=', 'product.property.type.code', $excludes ) ); |
|
| 305 | - $search->setSlice( 0, 0x7fffffff ); |
|
| 304 | + $search->setConditions($search->compare('!=', 'product.property.type.code', $excludes)); |
|
| 305 | + $search->setSlice(0, 0x7fffffff); |
|
| 306 | 306 | |
| 307 | - return $manager->searchItems( $search ); |
|
| 307 | + return $manager->searchItems($search); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | |
@@ -313,15 +313,15 @@ discard block |
||
| 313 | 313 | * |
| 314 | 314 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 315 | 315 | */ |
| 316 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
| 316 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
| 317 | 317 | { |
| 318 | - $data = (array) $view->param( 'characteristic/property', array() ); |
|
| 318 | + $data = (array) $view->param('characteristic/property', array()); |
|
| 319 | 319 | |
| 320 | - if( empty( $data ) ) |
|
| 320 | + if (empty($data)) |
|
| 321 | 321 | { |
| 322 | - foreach( $this->getProperties( $view->item->getId() ) as $item ) |
|
| 322 | + foreach ($this->getProperties($view->item->getId()) as $item) |
|
| 323 | 323 | { |
| 324 | - foreach( $item->toArray() as $key => $value ) { |
|
| 324 | + foreach ($item->toArray() as $key => $value) { |
|
| 325 | 325 | $data[$key][] = $value; |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -337,38 +337,38 @@ discard block |
||
| 337 | 337 | * |
| 338 | 338 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 339 | 339 | */ |
| 340 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
| 340 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
| 341 | 341 | { |
| 342 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'product/property' ); |
|
| 342 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'product/property'); |
|
| 343 | 343 | |
| 344 | 344 | $id = $view->item->getId(); |
| 345 | - $map = $this->getProperties( $id ); |
|
| 346 | - $ids = (array) $view->param( 'characteristic/property/product.property.id', array() ); |
|
| 345 | + $map = $this->getProperties($id); |
|
| 346 | + $ids = (array) $view->param('characteristic/property/product.property.id', array()); |
|
| 347 | 347 | |
| 348 | 348 | $item = $manager->createItem(); |
| 349 | 349 | |
| 350 | - foreach( $ids as $pos => $propertyId ) |
|
| 350 | + foreach ($ids as $pos => $propertyId) |
|
| 351 | 351 | { |
| 352 | - if( isset( $map[$propertyId] ) ) |
|
| 352 | + if (isset($map[$propertyId])) |
|
| 353 | 353 | { |
| 354 | 354 | $item = $map[$propertyId]; |
| 355 | - unset( $map[$propertyId] ); |
|
| 355 | + unset($map[$propertyId]); |
|
| 356 | 356 | } |
| 357 | 357 | else |
| 358 | 358 | { |
| 359 | - $item->setId( null ); |
|
| 360 | - $item->setParentId( $id ); |
|
| 359 | + $item->setId(null); |
|
| 360 | + $item->setParentId($id); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | - $lang = $view->param( 'characteristic/property/product.property.languageid/' . $pos, null ); |
|
| 363 | + $lang = $view->param('characteristic/property/product.property.languageid/' . $pos, null); |
|
| 364 | 364 | |
| 365 | - $item->setLanguageId( ( $lang ? $lang : null ) ); |
|
| 366 | - $item->setTypeId( $view->param( 'characteristic/property/product.property.typeid/' . $pos, null ) ); |
|
| 367 | - $item->setValue( $view->param( 'characteristic/property/product.property.value/' . $pos, '' ) ); |
|
| 365 | + $item->setLanguageId(($lang ? $lang : null)); |
|
| 366 | + $item->setTypeId($view->param('characteristic/property/product.property.typeid/' . $pos, null)); |
|
| 367 | + $item->setValue($view->param('characteristic/property/product.property.value/' . $pos, '')); |
|
| 368 | 368 | |
| 369 | - $manager->saveItem( $item, false ); |
|
| 369 | + $manager->saveItem($item, false); |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - $manager->deleteItems( array_keys( $map ) ); |
|
| 372 | + $manager->deleteItems(array_keys($map)); |
|
| 373 | 373 | } |
| 374 | 374 | } |
@@ -155,16 +155,14 @@ discard block |
||
| 155 | 155 | $textManager->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-price' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 162 | 161 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 163 | 162 | |
| 164 | 163 | $textManager->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-price' => $e->getMessage() ); |
@@ -365,8 +363,7 @@ discard block |
||
| 365 | 363 | |
| 366 | 364 | $item = $priceItem; |
| 367 | 365 | $item->setId( null ); |
| 368 | - } |
|
| 369 | - else |
|
| 366 | + } else |
|
| 370 | 367 | { |
| 371 | 368 | $litem = $listItems[$listid]; |
| 372 | 369 | $item = $litem->getRefItem(); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @category Developer |
| 56 | 56 | */ |
| 57 | 57 | private $subPartPath = 'admin/jqadm/product/characteristic/standard/subparts'; |
| 58 | - private $subPartNames = array( 'attribute', 'property' ); |
|
| 58 | + private $subPartNames = array('attribute', 'property'); |
|
| 59 | 59 | |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -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->characteristicBody = ''; |
| 72 | 72 | |
| 73 | - foreach( $this->getSubClients() as $client ) { |
|
| 73 | + foreach ($this->getSubClients() as $client) { |
|
| 74 | 74 | $view->characteristicBody .= $client->copy(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $tplconf = 'admin/jqadm/product/characteristic/template-item'; |
| 78 | 78 | $default = 'product/item-characteristic-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->characteristicBody = ''; |
| 95 | 95 | |
| 96 | - foreach( $this->getSubClients() as $client ) { |
|
| 96 | + foreach ($this->getSubClients() as $client) { |
|
| 97 | 97 | $view->characteristicBody .= $client->create(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $tplconf = 'admin/jqadm/product/characteristic/template-item'; |
| 101 | 101 | $default = 'product/item-characteristic-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->characteristicBody = ''; |
| 118 | 118 | |
| 119 | - foreach( $this->getSubClients() as $client ) { |
|
| 119 | + foreach ($this->getSubClients() as $client) { |
|
| 120 | 120 | $view->characteristicBody .= $client->get(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $tplconf = 'admin/jqadm/product/characteristic/template-item'; |
| 124 | 124 | $default = 'product/item-characteristic-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,31 +137,31 @@ 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 | 145 | $view->characteristicBody = ''; |
| 146 | 146 | |
| 147 | - foreach( $this->getSubClients() as $client ) { |
|
| 147 | + foreach ($this->getSubClients() as $client) { |
|
| 148 | 148 | $view->characteristicBody .= $client->save(); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $manager->commit(); |
| 152 | 152 | return; |
| 153 | 153 | } |
| 154 | - catch( \Aimeos\MShop\Exception $e ) |
|
| 154 | + catch (\Aimeos\MShop\Exception $e) |
|
| 155 | 155 | { |
| 156 | - $error = array( 'product-item-characteristic' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 157 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 156 | + $error = array('product-item-characteristic' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 157 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 158 | 158 | $manager->rollback(); |
| 159 | 159 | } |
| 160 | - catch( \Exception $e ) |
|
| 160 | + catch (\Exception $e) |
|
| 161 | 161 | { |
| 162 | - $context->getLogger()->log( $e->getMessage() . ' - ' . $e->getTraceAsString() ); |
|
| 163 | - $error = array( 'product-item-characteristic' => $e->getMessage() ); |
|
| 164 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 162 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
| 163 | + $error = array('product-item-characteristic' => $e->getMessage()); |
|
| 164 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 165 | 165 | $manager->rollback(); |
| 166 | 166 | } |
| 167 | 167 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @param string|null $name Name of the sub-client (Default if null) |
| 177 | 177 | * @return \Aimeos\Admin\JQAdm\Iface Sub-client object |
| 178 | 178 | */ |
| 179 | - public function getSubClient( $type, $name = null ) |
|
| 179 | + public function getSubClient($type, $name = null) |
|
| 180 | 180 | { |
| 181 | 181 | /** admin/jqadm/product/characteristic/decorators/excludes |
| 182 | 182 | * Excludes decorators added by the "common" option from the product JQAdm client |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | * @see admin/jqadm/product/characteristic/decorators/excludes |
| 252 | 252 | * @see admin/jqadm/product/characteristic/decorators/global |
| 253 | 253 | */ |
| 254 | - return $this->createSubClient( 'product/characteristic/' . $type, $name ); |
|
| 254 | + return $this->createSubClient('product/characteristic/' . $type, $name); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | protected function getSubClientNames() |
| 264 | 264 | { |
| 265 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 265 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
@@ -271,8 +271,8 @@ discard block |
||
| 271 | 271 | * |
| 272 | 272 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 273 | 273 | */ |
| 274 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
| 274 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
| 275 | 275 | { |
| 276 | - $view->characteristicData = (array) $view->param( 'characteristic', array() );; |
|
| 276 | + $view->characteristicData = (array) $view->param('characteristic', array()); ; |
|
| 277 | 277 | } |
| 278 | 278 | } |
| 279 | 279 | \ 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() ); |
@@ -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->priceBody = ''; |
| 72 | 72 | |
| 73 | - foreach( $this->getSubClients() as $client ) { |
|
| 73 | + foreach ($this->getSubClients() as $client) { |
|
| 74 | 74 | $view->priceBody .= $client->copy(); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $tplconf = 'admin/jqadm/product/price/template-item'; |
| 78 | 78 | $default = 'product/item-price-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->priceBody = ''; |
| 95 | 95 | |
| 96 | - foreach( $this->getSubClients() as $client ) { |
|
| 96 | + foreach ($this->getSubClients() as $client) { |
|
| 97 | 97 | $view->priceBody .= $client->create(); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $tplconf = 'admin/jqadm/product/price/template-item'; |
| 101 | 101 | $default = 'product/item-price-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->priceBody = ''; |
| 118 | 118 | |
| 119 | - foreach( $this->getSubClients() as $client ) { |
|
| 119 | + foreach ($this->getSubClients() as $client) { |
|
| 120 | 120 | $view->priceBody .= $client->get(); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | $tplconf = 'admin/jqadm/product/price/template-item'; |
| 124 | 124 | $default = 'product/item-price-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 | - $textManager = \Aimeos\MShop\Factory::createManager( $context, 'text' ); |
|
| 140 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
| 141 | + $textManager = \Aimeos\MShop\Factory::createManager($context, 'text'); |
|
| 142 | 142 | |
| 143 | 143 | $manager->begin(); |
| 144 | 144 | $textManager->begin(); |
| 145 | 145 | |
| 146 | 146 | try |
| 147 | 147 | { |
| 148 | - $this->updateItems( $view ); |
|
| 148 | + $this->updateItems($view); |
|
| 149 | 149 | $view->priceBody = ''; |
| 150 | 150 | |
| 151 | - foreach( $this->getSubClients() as $client ) { |
|
| 151 | + foreach ($this->getSubClients() as $client) { |
|
| 152 | 152 | $view->priceBody .= $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-price' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
|
| 162 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 161 | + $error = array('product-item-price' => $context->getI18n()->dt('mshop', $e->getMessage())); |
|
| 162 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 163 | 163 | |
| 164 | 164 | $textManager->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-price' => $e->getMessage() ); |
|
| 171 | - $view->errors = $view->get( 'errors', array() ) + $error; |
|
| 169 | + $context->getLogger()->log($e->getMessage() . ' - ' . $e->getTraceAsString()); |
|
| 170 | + $error = array('product-item-price' => $e->getMessage()); |
|
| 171 | + $view->errors = $view->get('errors', array()) + $error; |
|
| 172 | 172 | |
| 173 | 173 | $textManager->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/price/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/price/decorators/excludes |
| 261 | 261 | * @see admin/jqadm/product/price/decorators/global |
| 262 | 262 | */ |
| 263 | - return $this->createSubClient( 'product/price/' . $type, $name ); |
|
| 263 | + return $this->createSubClient('product/price/' . $type, $name); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | protected function getSubClientNames() |
| 273 | 273 | { |
| 274 | - return $this->getContext()->getConfig()->get( $this->subPartPath, $this->subPartNames ); |
|
| 274 | + return $this->getContext()->getConfig()->get($this->subPartPath, $this->subPartNames); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -282,13 +282,13 @@ discard block |
||
| 282 | 282 | */ |
| 283 | 283 | protected function getPriceTypes() |
| 284 | 284 | { |
| 285 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'price/type' ); |
|
| 285 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'price/type'); |
|
| 286 | 286 | |
| 287 | 287 | $search = $manager->createSearch(); |
| 288 | - $search->setConditions( $search->compare( '==', 'price.type.domain', 'product' ) ); |
|
| 289 | - $search->setSortations( array( $search->sort( '+', 'price.type.label' ) ) ); |
|
| 288 | + $search->setConditions($search->compare('==', 'price.type.domain', 'product')); |
|
| 289 | + $search->setSortations(array($search->sort('+', 'price.type.label'))); |
|
| 290 | 290 | |
| 291 | - return $manager->searchItems( $search ); |
|
| 291 | + return $manager->searchItems($search); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
@@ -297,27 +297,27 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 299 | 299 | */ |
| 300 | - protected function setData( \Aimeos\MW\View\Iface $view ) |
|
| 300 | + protected function setData(\Aimeos\MW\View\Iface $view) |
|
| 301 | 301 | { |
| 302 | - $data = (array) $view->param( 'price', array() ); |
|
| 302 | + $data = (array) $view->param('price', array()); |
|
| 303 | 303 | |
| 304 | - if( empty( $view->priceData ) && ( $id = $view->item->getId() ) !== null ) |
|
| 304 | + if (empty($view->priceData) && ($id = $view->item->getId()) !== null) |
|
| 305 | 305 | { |
| 306 | - foreach( $view->item->getListItems( 'price' ) as $id => $listItem ) |
|
| 306 | + foreach ($view->item->getListItems('price') as $id => $listItem) |
|
| 307 | 307 | { |
| 308 | - if( ( $refItem = $listItem->getRefItem() ) === null ) { |
|
| 308 | + if (($refItem = $listItem->getRefItem()) === null) { |
|
| 309 | 309 | continue; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $data['product.lists.id'][] = $id; |
| 313 | 313 | |
| 314 | - foreach( $refItem->toArray() as $key => $value ) { |
|
| 314 | + foreach ($refItem->toArray() as $key => $value) { |
|
| 315 | 315 | $data[$key][] = $value; |
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if( !isset( $data['price.currencyid'] ) ) { // show at least one block |
|
| 320 | + if (!isset($data['price.currencyid'])) { // show at least one block |
|
| 321 | 321 | $data['price.currencyid'][] = $this->getContext()->getLocale()->getCurrencyId(); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -331,40 +331,40 @@ discard block |
||
| 331 | 331 | * |
| 332 | 332 | * @param \Aimeos\MW\View\Iface $view View object with helpers and assigned parameters |
| 333 | 333 | */ |
| 334 | - protected function updateItems( \Aimeos\MW\View\Iface $view ) |
|
| 334 | + protected function updateItems(\Aimeos\MW\View\Iface $view) |
|
| 335 | 335 | { |
| 336 | 336 | $id = $view->item->getId(); |
| 337 | 337 | $context = $this->getContext(); |
| 338 | 338 | |
| 339 | - $manager = \Aimeos\MShop\Factory::createManager( $context, 'product' ); |
|
| 340 | - $priceManager = \Aimeos\MShop\Factory::createManager( $context, 'price' ); |
|
| 341 | - $listManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists' ); |
|
| 342 | - $listTypeManager = \Aimeos\MShop\Factory::createManager( $context, 'product/lists/type' ); |
|
| 339 | + $manager = \Aimeos\MShop\Factory::createManager($context, 'product'); |
|
| 340 | + $priceManager = \Aimeos\MShop\Factory::createManager($context, 'price'); |
|
| 341 | + $listManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists'); |
|
| 342 | + $listTypeManager = \Aimeos\MShop\Factory::createManager($context, 'product/lists/type'); |
|
| 343 | 343 | |
| 344 | - $listIds = (array) $view->param( 'price/product.lists.id', array() ); |
|
| 345 | - $listItems = $manager->getItem( $id, array( 'price' ) )->getListItems( 'price' ); |
|
| 344 | + $listIds = (array) $view->param('price/product.lists.id', array()); |
|
| 345 | + $listItems = $manager->getItem($id, array('price'))->getListItems('price'); |
|
| 346 | 346 | |
| 347 | 347 | |
| 348 | 348 | $listItem = $listManager->createItem(); |
| 349 | - $listItem->setTypeId( $listTypeManager->findItem( 'default', array(), 'price' )->getId() ); |
|
| 350 | - $listItem->setDomain( 'price' ); |
|
| 351 | - $listItem->setParentId( $id ); |
|
| 352 | - $listItem->setStatus( 1 ); |
|
| 349 | + $listItem->setTypeId($listTypeManager->findItem('default', array(), 'price')->getId()); |
|
| 350 | + $listItem->setDomain('price'); |
|
| 351 | + $listItem->setParentId($id); |
|
| 352 | + $listItem->setStatus(1); |
|
| 353 | 353 | |
| 354 | 354 | $priceItem = $priceManager->createItem(); |
| 355 | - $priceItem->setDomain( 'product' ); |
|
| 356 | - $priceItem->setStatus( 1 ); |
|
| 355 | + $priceItem->setDomain('product'); |
|
| 356 | + $priceItem->setStatus(1); |
|
| 357 | 357 | |
| 358 | 358 | |
| 359 | - foreach( $listIds as $idx => $listid ) |
|
| 359 | + foreach ($listIds as $idx => $listid) |
|
| 360 | 360 | { |
| 361 | - if( !isset( $listItems[$listid] ) ) |
|
| 361 | + if (!isset($listItems[$listid])) |
|
| 362 | 362 | { |
| 363 | 363 | $litem = $listItem; |
| 364 | - $litem->setId( null ); |
|
| 364 | + $litem->setId(null); |
|
| 365 | 365 | |
| 366 | 366 | $item = $priceItem; |
| 367 | - $item->setId( null ); |
|
| 367 | + $item->setId(null); |
|
| 368 | 368 | } |
| 369 | 369 | else |
| 370 | 370 | { |
@@ -372,32 +372,32 @@ discard block |
||
| 372 | 372 | $item = $litem->getRefItem(); |
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - $item->setLabel( $view->param( 'price/price.label/' . $idx ) ); |
|
| 376 | - $item->setTypeId( $view->param( 'price/price.typeid/' . $idx ) ); |
|
| 377 | - $item->setCurrencyId( $view->param( 'price/price.currencyid/' . $idx ) ); |
|
| 378 | - $item->setQuantity( $view->param( 'price/price.quantity/' . $idx ) ); |
|
| 379 | - $item->setValue( $view->param( 'price/price.value/' . $idx ) ); |
|
| 380 | - $item->setCosts( $view->param( 'price/price.costs/' . $idx ) ); |
|
| 381 | - $item->setRebate( $view->param( 'price/price.rebate/' . $idx ) ); |
|
| 382 | - $item->setTaxRate( $view->param( 'price/price.taxrate/' . $idx ) ); |
|
| 375 | + $item->setLabel($view->param('price/price.label/' . $idx)); |
|
| 376 | + $item->setTypeId($view->param('price/price.typeid/' . $idx)); |
|
| 377 | + $item->setCurrencyId($view->param('price/price.currencyid/' . $idx)); |
|
| 378 | + $item->setQuantity($view->param('price/price.quantity/' . $idx)); |
|
| 379 | + $item->setValue($view->param('price/price.value/' . $idx)); |
|
| 380 | + $item->setCosts($view->param('price/price.costs/' . $idx)); |
|
| 381 | + $item->setRebate($view->param('price/price.rebate/' . $idx)); |
|
| 382 | + $item->setTaxRate($view->param('price/price.taxrate/' . $idx)); |
|
| 383 | 383 | |
| 384 | - $priceManager->saveItem( $item ); |
|
| 384 | + $priceManager->saveItem($item); |
|
| 385 | 385 | |
| 386 | - $litem->setPosition( $idx ); |
|
| 387 | - $litem->setRefId( $item->getId() ); |
|
| 386 | + $litem->setPosition($idx); |
|
| 387 | + $litem->setRefId($item->getId()); |
|
| 388 | 388 | |
| 389 | - $listManager->saveItem( $litem, false ); |
|
| 389 | + $listManager->saveItem($litem, false); |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | |
| 393 | 393 | $rmIds = array(); |
| 394 | - $rmListIds = array_diff( array_keys( $listItems ), $listIds ); |
|
| 394 | + $rmListIds = array_diff(array_keys($listItems), $listIds); |
|
| 395 | 395 | |
| 396 | - foreach( $rmListIds as $id ) { |
|
| 396 | + foreach ($rmListIds as $id) { |
|
| 397 | 397 | $rmIds[] = $listItems[$id]->getRefId(); |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - $listManager->deleteItems( $rmListIds ); |
|
| 401 | - $priceManager->deleteItems( $rmIds ); |
|
| 400 | + $listManager->deleteItems($rmListIds); |
|
| 401 | + $priceManager->deleteItems($rmIds); |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | \ No newline at end of file |
@@ -155,16 +155,14 @@ discard block |
||
| 155 | 155 | $textManager->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-price' => $context->getI18n()->dt( 'mshop', $e->getMessage() ) ); |
| 162 | 161 | $view->errors = $view->get( 'errors', array() ) + $error; |
| 163 | 162 | |
| 164 | 163 | $textManager->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-price' => $e->getMessage() ); |
@@ -365,8 +363,7 @@ discard block |
||
| 365 | 363 | |
| 366 | 364 | $item = $priceItem; |
| 367 | 365 | $item->setId( null ); |
| 368 | - } |
|
| 369 | - else |
|
| 366 | + } else |
|
| 370 | 367 | { |
| 371 | 368 | $litem = $listItems[$listid]; |
| 372 | 369 | $item = $litem->getRefItem(); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | /** |
| 64 | 64 | * Copies a resource |
| 65 | 65 | * |
| 66 | - * @return string|null admin output to display or null for redirecting to the list |
|
| 66 | + * @return string admin output to display or null for redirecting to the list |
|
| 67 | 67 | */ |
| 68 | 68 | public function copy() |
| 69 | 69 | { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | /** |
| 87 | 87 | * Creates a new resource |
| 88 | 88 | * |
| 89 | - * @return string|null admin output to display or null for redirecting to the list |
|
| 89 | + * @return string admin output to display or null for redirecting to the list |
|
| 90 | 90 | */ |
| 91 | 91 | public function create() |
| 92 | 92 | { |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | /** |
| 110 | 110 | * Returns a single resource |
| 111 | 111 | * |
| 112 | - * @return string|null admin output to display or null for redirecting to the list |
|
| 112 | + * @return string admin output to display or null for redirecting to the list |
|
| 113 | 113 | */ |
| 114 | 114 | public function get() |
| 115 | 115 | { |