@@ -199,6 +199,9 @@ |
||
199 | 199 | } |
200 | 200 | |
201 | 201 | |
202 | + /** |
|
203 | + * @param string $code |
|
204 | + */ |
|
202 | 205 | protected function addProduct( $code ) |
203 | 206 | { |
204 | 207 | $prodId = \Aimeos\MShop\Factory::createManager( $this->context, 'product' )->findItem( $code )->getId(); |
@@ -78,8 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $this->controller->setAddress( $entry->id, null ); |
80 | 80 | } |
81 | - } |
|
82 | - else |
|
81 | + } else |
|
83 | 82 | { |
84 | 83 | $this->controller->setAddress( $relId, null ); |
85 | 84 | } |
@@ -87,16 +86,14 @@ discard block |
||
87 | 86 | |
88 | 87 | $view->item = $this->controller->get(); |
89 | 88 | $status = 200; |
90 | - } |
|
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
89 | + } catch( \Aimeos\MShop\Exception $e ) |
|
92 | 90 | { |
93 | 91 | $status = 404; |
94 | 92 | $view->errors = array( array( |
95 | 93 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
96 | 94 | 'detail' => $e->getTraceAsString(), |
97 | 95 | ) ); |
98 | - } |
|
99 | - catch( \Exception $e ) |
|
96 | + } catch( \Exception $e ) |
|
100 | 97 | { |
101 | 98 | $status = 500; |
102 | 99 | $view->errors = array( array( |
@@ -145,16 +142,14 @@ discard block |
||
145 | 142 | |
146 | 143 | $view->item = $this->controller->get(); |
147 | 144 | $status = 201; |
148 | - } |
|
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
145 | + } catch( \Aimeos\MShop\Exception $e ) |
|
150 | 146 | { |
151 | 147 | $status = 404; |
152 | 148 | $view->errors = array( array( |
153 | 149 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
154 | 150 | 'detail' => $e->getTraceAsString(), |
155 | 151 | ) ); |
156 | - } |
|
157 | - catch( \Exception $e ) |
|
152 | + } catch( \Exception $e ) |
|
158 | 153 | { |
159 | 154 | $status = 500; |
160 | 155 | $view->errors = array( array( |
@@ -78,8 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $this->controller->deleteProduct( $entry->id ); |
80 | 80 | } |
81 | - } |
|
82 | - else |
|
81 | + } else |
|
83 | 82 | { |
84 | 83 | $this->controller->deleteProduct( $relId ); |
85 | 84 | } |
@@ -87,16 +86,14 @@ discard block |
||
87 | 86 | |
88 | 87 | $view->item = $this->controller->get(); |
89 | 88 | $status = 200; |
90 | - } |
|
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
89 | + } catch( \Aimeos\MShop\Exception $e ) |
|
92 | 90 | { |
93 | 91 | $status = 404; |
94 | 92 | $view->errors = array( array( |
95 | 93 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
96 | 94 | 'detail' => $e->getTraceAsString(), |
97 | 95 | ) ); |
98 | - } |
|
99 | - catch( \Exception $e ) |
|
96 | + } catch( \Exception $e ) |
|
100 | 97 | { |
101 | 98 | $status = 500; |
102 | 99 | $view->errors = array( array( |
@@ -152,16 +149,14 @@ discard block |
||
152 | 149 | |
153 | 150 | $view->item = $this->controller->get(); |
154 | 151 | $status = 200; |
155 | - } |
|
156 | - catch( \Aimeos\MShop\Exception $e ) |
|
152 | + } catch( \Aimeos\MShop\Exception $e ) |
|
157 | 153 | { |
158 | 154 | $status = 404; |
159 | 155 | $view->errors = array( array( |
160 | 156 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
161 | 157 | 'detail' => $e->getTraceAsString(), |
162 | 158 | ) ); |
163 | - } |
|
164 | - catch( \Exception $e ) |
|
159 | + } catch( \Exception $e ) |
|
165 | 160 | { |
166 | 161 | $status = 500; |
167 | 162 | $view->errors = array( array( |
@@ -218,16 +213,14 @@ discard block |
||
218 | 213 | |
219 | 214 | $view->item = $this->controller->get(); |
220 | 215 | $status = 201; |
221 | - } |
|
222 | - catch( \Aimeos\MShop\Exception $e ) |
|
216 | + } catch( \Aimeos\MShop\Exception $e ) |
|
223 | 217 | { |
224 | 218 | $status = 404; |
225 | 219 | $view->errors = array( array( |
226 | 220 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
227 | 221 | 'detail' => $e->getTraceAsString(), |
228 | 222 | ) ); |
229 | - } |
|
230 | - catch( \Exception $e ) |
|
223 | + } catch( \Exception $e ) |
|
231 | 224 | { |
232 | 225 | $status = 500; |
233 | 226 | $view->errors = array( array( |
@@ -78,8 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $this->controller->setService( $entry->id, null ); |
80 | 80 | } |
81 | - } |
|
82 | - else |
|
81 | + } else |
|
83 | 82 | { |
84 | 83 | $this->controller->setService( $relId, null ); |
85 | 84 | } |
@@ -87,16 +86,14 @@ discard block |
||
87 | 86 | |
88 | 87 | $view->item = $this->controller->get(); |
89 | 88 | $status = 200; |
90 | - } |
|
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
89 | + } catch( \Aimeos\MShop\Exception $e ) |
|
92 | 90 | { |
93 | 91 | $status = 404; |
94 | 92 | $view->errors = array( array( |
95 | 93 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
96 | 94 | 'detail' => $e->getTraceAsString(), |
97 | 95 | ) ); |
98 | - } |
|
99 | - catch( \Exception $e ) |
|
96 | + } catch( \Exception $e ) |
|
100 | 97 | { |
101 | 98 | $status = 500; |
102 | 99 | $view->errors = array( array( |
@@ -156,16 +153,14 @@ discard block |
||
156 | 153 | |
157 | 154 | $view->item = $this->controller->get(); |
158 | 155 | $status = 201; |
159 | - } |
|
160 | - catch( \Aimeos\MShop\Exception $e ) |
|
156 | + } catch( \Aimeos\MShop\Exception $e ) |
|
161 | 157 | { |
162 | 158 | $status = 404; |
163 | 159 | $view->errors = array( array( |
164 | 160 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
165 | 161 | 'detail' => $e->getTraceAsString(), |
166 | 162 | ) ); |
167 | - } |
|
168 | - catch( \Exception $e ) |
|
163 | + } catch( \Exception $e ) |
|
169 | 164 | { |
170 | 165 | $status = 500; |
171 | 166 | $view->errors = array( array( |
@@ -78,8 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $this->controller->deleteCoupon( $entry->id ); |
80 | 80 | } |
81 | - } |
|
82 | - else |
|
81 | + } else |
|
83 | 82 | { |
84 | 83 | $this->controller->deleteCoupon( $relId ); |
85 | 84 | } |
@@ -87,16 +86,14 @@ discard block |
||
87 | 86 | |
88 | 87 | $view->item = $this->controller->get(); |
89 | 88 | $status = 200; |
90 | - } |
|
91 | - catch( \Aimeos\MShop\Exception $e ) |
|
89 | + } catch( \Aimeos\MShop\Exception $e ) |
|
92 | 90 | { |
93 | 91 | $status = 404; |
94 | 92 | $view->errors = array( array( |
95 | 93 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
96 | 94 | 'detail' => $e->getTraceAsString(), |
97 | 95 | ) ); |
98 | - } |
|
99 | - catch( \Exception $e ) |
|
96 | + } catch( \Exception $e ) |
|
100 | 97 | { |
101 | 98 | $status = 500; |
102 | 99 | $view->errors = array( array( |
@@ -145,16 +142,14 @@ discard block |
||
145 | 142 | |
146 | 143 | $view->item = $this->controller->get(); |
147 | 144 | $status = 201; |
148 | - } |
|
149 | - catch( \Aimeos\MShop\Exception $e ) |
|
145 | + } catch( \Aimeos\MShop\Exception $e ) |
|
150 | 146 | { |
151 | 147 | $status = 404; |
152 | 148 | $view->errors = array( array( |
153 | 149 | 'title' => $this->getContext()->getI18n()->dt( 'mshop', $e->getMessage() ), |
154 | 150 | 'detail' => $e->getTraceAsString(), |
155 | 151 | ) ); |
156 | - } |
|
157 | - catch( \Exception $e ) |
|
152 | + } catch( \Exception $e ) |
|
158 | 153 | { |
159 | 154 | $status = 500; |
160 | 155 | $view->errors = array( array( |
@@ -20,9 +20,12 @@ |
||
20 | 20 | |
21 | 21 | "errors": <?php echo json_encode( $this->errors, JSON_PRETTY_PRINT ); ?> |
22 | 22 | |
23 | - <?php else : ?> |
|
23 | + <?php else { |
|
24 | + : ?> |
|
24 | 25 | |
25 | - "data": <?php echo json_encode( $entries ); ?> |
|
26 | + "data": <?php echo json_encode( $entries ); |
|
27 | +} |
|
28 | +?> |
|
26 | 29 | |
27 | 30 | <?php endif; ?> |
28 | 31 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $first = ( $offset > 0 ? 0 : null ); |
34 | 34 | $prev = ( $offset - $limit >= 0 ? $offset - $limit : null ); |
35 | 35 | $next = ( $offset + $limit < $total ? $offset + $limit : null ); |
36 | -$last = ( ((int) ($total / $limit)) * $limit > $offset ? ((int) ($total / $limit)) * $limit : null ); |
|
36 | +$last = ( ( (int) ( $total / $limit ) ) * $limit > $offset ? ( (int) ( $total / $limit ) ) * $limit : null ); |
|
37 | 37 | |
38 | 38 | |
39 | 39 | $fields = $this->param( 'fields', array() ); |
@@ -152,8 +152,7 @@ |
||
152 | 152 | $data[] = $entryFcn( $attrItem ); |
153 | 153 | $included = array_merge( $included, $refFcn( $attrItem, 0 ) ); |
154 | 154 | } |
155 | - } |
|
156 | - else |
|
155 | + } else |
|
157 | 156 | { |
158 | 157 | $data = $entryFcn( $items ); |
159 | 158 | $included = $refFcn( $items, 0 ); |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $first = ( $offset > 0 ? 0 : null ); |
34 | 34 | $prev = ( $offset - $limit >= 0 ? $offset - $limit : null ); |
35 | 35 | $next = ( $offset + $limit < $total ? $offset + $limit : null ); |
36 | -$last = ( ((int) ($total / $limit)) * $limit > $offset ? ((int) ($total / $limit)) * $limit : null ); |
|
36 | +$last = ( ( (int) ( $total / $limit ) ) * $limit > $offset ? ( (int) ( $total / $limit ) ) * $limit : null ); |
|
37 | 37 | |
38 | 38 | |
39 | 39 | $fields = $this->param( 'fields', array() ); |
@@ -105,8 +105,7 @@ |
||
105 | 105 | foreach( $items as $stockId => $stockItem ) { |
106 | 106 | $data[] = $entryFcn( $stockItem ); |
107 | 107 | } |
108 | - } |
|
109 | - else |
|
108 | + } else |
|
110 | 109 | { |
111 | 110 | $data = $entryFcn( $items ); |
112 | 111 | } |
@@ -83,8 +83,7 @@ |
||
83 | 83 | foreach( $items as $localeItem ) { |
84 | 84 | $data[] = $entryFcn( $localeItem ); |
85 | 85 | } |
86 | - } |
|
87 | - else |
|
86 | + } else |
|
88 | 87 | { |
89 | 88 | $data = $entryFcn( $items ); |
90 | 89 | } |