@@ -464,15 +464,16 @@ discard block |
||
464 | 464 | $disable = $view->config( 'client/html/checkout/standard/address/billing/disable-new', false ); |
465 | 465 | $type = \Aimeos\MShop\Order\Item\Address\Base::TYPE_PAYMENT; |
466 | 466 | |
467 | - if( ( $option = $view->param( 'ca_billingoption', 'null' ) ) === 'null' && $disable === false ) // new address |
|
467 | + if( ( $option = $view->param( 'ca_billingoption', 'null' ) ) === 'null' && $disable === false ) { |
|
468 | + // new address |
|
468 | 469 | { |
469 | 470 | $params = $view->param( 'ca_billing', [] ); |
471 | + } |
|
470 | 472 | |
471 | 473 | if( ( $view->addressBillingError = $this->checkFields( $params ) ) !== [] ) { |
472 | 474 | throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one billing address part is missing or invalid' ) ); |
473 | 475 | } |
474 | - } |
|
475 | - else // existing address |
|
476 | + } else // existing address |
|
476 | 477 | { |
477 | 478 | $params = $view->param( 'ca_billing_' . $option, [] ) + $view->param( 'ca_extra', [] ); |
478 | 479 | |
@@ -616,8 +617,7 @@ discard block |
||
616 | 617 | $invalid[$key] = $name; |
617 | 618 | unset( $params[$key] ); |
618 | 619 | } |
619 | - } |
|
620 | - else |
|
620 | + } else |
|
621 | 621 | { |
622 | 622 | unset( $params[$key] ); |
623 | 623 | } |
@@ -337,19 +337,22 @@ discard block |
||
337 | 337 | $disable = $view->config( 'client/html/checkout/standard/address/delivery/disable-new', false ); |
338 | 338 | $type = \Aimeos\MShop\Order\Item\Address\Base::TYPE_DELIVERY; |
339 | 339 | |
340 | - if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) === 'null' && $disable === false ) // new address |
|
340 | + if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) === 'null' && $disable === false ) { |
|
341 | + // new address |
|
341 | 342 | { |
342 | 343 | $params = $view->param( 'ca_delivery', [] ); |
344 | + } |
|
343 | 345 | |
344 | 346 | if( ( $view->addressDeliveryError = $this->checkFields( $params ) ) !== [] ) { |
345 | 347 | throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one delivery address part is missing or invalid' ) ); |
346 | 348 | } |
347 | 349 | |
348 | 350 | $ctrl->addAddress( $type, $params, 0 ); |
349 | - } |
|
350 | - else if( ( $option = $view->param( 'ca_deliveryoption' ) ) !== 'like' ) // existing address |
|
351 | + } else if( ( $option = $view->param( 'ca_deliveryoption' ) ) !== 'like' ) { |
|
352 | + // existing address |
|
351 | 353 | { |
352 | 354 | $params = $view->param( 'ca_delivery_' . $option, [] ); |
355 | + } |
|
353 | 356 | |
354 | 357 | if( !empty( $params ) && ( $view->addressDeliveryError = $this->checkFields( $params ) ) !== [] ) { |
355 | 358 | throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one delivery address part is missing or invalid' ) ); |
@@ -362,13 +365,11 @@ discard block |
||
362 | 365 | $params = array_replace( $address->toArray(), $params + ['order.address.addressid' => $option] ); |
363 | 366 | $addr = $ctrl->addAddress( $type, $params, 0 )->get()->getAddress( $type, 0 ); // sanitize address first |
364 | 367 | $custCntl->addAddressItem( $address->copyFrom( $addr ), $option )->store(); // update existing address |
365 | - } |
|
366 | - else |
|
368 | + } else |
|
367 | 369 | { |
368 | 370 | $ctrl->addAddress( $type, $params, 0 ); |
369 | 371 | } |
370 | - } |
|
371 | - else |
|
372 | + } else |
|
372 | 373 | { |
373 | 374 | $ctrl->deleteAddress( $type ); |
374 | 375 | } |
@@ -597,8 +598,7 @@ discard block |
||
597 | 598 | $invalid[$key] = $name; |
598 | 599 | unset( $params[$key] ); |
599 | 600 | } |
600 | - } |
|
601 | - else |
|
601 | + } else |
|
602 | 602 | { |
603 | 603 | unset( $params[$key] ); |
604 | 604 | } |
@@ -79,8 +79,7 @@ |
||
79 | 79 | { |
80 | 80 | $serviceCntl = \Aimeos\Controller\Frontend::create( $context, 'service' ); |
81 | 81 | $orderItem = $serviceCntl->updateSync( $view->request(), $code, $orderid ); |
82 | - } |
|
83 | - else |
|
82 | + } else |
|
84 | 83 | { |
85 | 84 | $orderItem = $orderCntl->get( $orderid, false ); |
86 | 85 | } |
@@ -211,27 +211,26 @@ |
||
211 | 211 | $order = $basketCntl->store(); |
212 | 212 | |
213 | 213 | $context->session()->set( 'aimeos/orderid', $order->getId() ); |
214 | - } |
|
215 | - elseif( ( $orderid = $context->session()->get( 'aimeos/orderid' ) ) !== null ) |
|
214 | + } elseif( ( $orderid = $context->session()->get( 'aimeos/orderid' ) ) !== null ) |
|
216 | 215 | { |
217 | 216 | $refs = $context->config()->get( 'mshop/order/manager/subdomains', [] ); |
218 | 217 | $order = $orderCntl->uses( $refs )->get( $orderid, false ); |
219 | - } |
|
220 | - else |
|
218 | + } else |
|
221 | 219 | { |
222 | 220 | return; |
223 | 221 | } |
224 | 222 | |
225 | - if( ( $form = $this->processPayment( $order ) ) === null ) // no payment service available |
|
223 | + if( ( $form = $this->processPayment( $order ) ) === null ) { |
|
224 | + // no payment service available |
|
226 | 225 | { |
227 | 226 | $services = $order->getService( \Aimeos\MShop\Order\Item\Service\Base::TYPE_PAYMENT ); |
227 | + } |
|
228 | 228 | $args = ( $service = reset( $services ) ) ? ['code' => $service->getCode()] : []; |
229 | 229 | |
230 | 230 | $orderCntl->save( $order->setStatusPayment( \Aimeos\MShop\Order\Item\Base::PAY_AUTHORIZED ) ); |
231 | 231 | $view->standardUrlNext = $this->getUrlConfirm( $view, $args, ['absoluteUri' => true] ); |
232 | 232 | $view->standardMethod = 'POST'; |
233 | - } |
|
234 | - else |
|
233 | + } else |
|
235 | 234 | { |
236 | 235 | $this->addFormData( $view, $form ); |
237 | 236 | } |
@@ -213,8 +213,7 @@ |
||
213 | 213 | (string) $view->param( 'b_stocktype', 'default' ), |
214 | 214 | $view->param( 'b_siteid' ) |
215 | 215 | ); |
216 | - } |
|
217 | - else |
|
216 | + } else |
|
218 | 217 | { |
219 | 218 | foreach( (array) $view->param( 'b_prod', [] ) as $values ) |
220 | 219 | { |
@@ -149,8 +149,7 @@ |
||
149 | 149 | $value = $oservice->getAttribute( $key ) ?: $value; |
150 | 150 | $item->value = $oservice->getAttribute( $key, 'hidden' ) ?: $value; |
151 | 151 | } |
152 | - } |
|
153 | - else |
|
152 | + } else |
|
154 | 153 | { |
155 | 154 | foreach( $attr as $key => $item ) { |
156 | 155 | $item->value = is_array( $item->getDefault() ) ? key( $item->getDefault() ) : $item->getDefault(); |
@@ -72,30 +72,30 @@ |
||
72 | 72 | $starsAmount = 0; |
73 | 73 | $IDs = []; |
74 | 74 | if (isset( $this->detailProductItem )) { |
75 | - $IDs[] = $this->detailProductItem->getId(); |
|
76 | - $amountOfStarred = 0; |
|
77 | - if ($this->detailProductItem->getRatings()) { |
|
78 | - $reviewsAmount += $this->detailProductItem->getRatings(); |
|
79 | - if($this->detailProductItem->getRating() > 0) { |
|
80 | - $amountOfStarred++; |
|
81 | - $starsAmount += $this->detailProductItem->getRating(); |
|
82 | - } |
|
83 | - } |
|
84 | - $refs = $this->detailProductItem->getRefItems(); |
|
85 | - if(isset($refs['product'])) { |
|
86 | - |
|
87 | - foreach ($refs['product'] as $variant_id => $variant){ |
|
88 | - $IDs[] = $variant_id; |
|
89 | - if($variant->getRatings()){ |
|
90 | - $reviewsAmount += $variant->getRatings(); |
|
91 | - if ($variant->getRating() > 0) { |
|
92 | - $amountOfStarred++; |
|
93 | - $starsAmount += $variant->getRating(); |
|
94 | - } |
|
95 | - } |
|
96 | - } |
|
97 | - $starsAmount = $starsAmount / $amountOfStarred; |
|
98 | - } |
|
75 | + $IDs[] = $this->detailProductItem->getId(); |
|
76 | + $amountOfStarred = 0; |
|
77 | + if ($this->detailProductItem->getRatings()) { |
|
78 | + $reviewsAmount += $this->detailProductItem->getRatings(); |
|
79 | + if($this->detailProductItem->getRating() > 0) { |
|
80 | + $amountOfStarred++; |
|
81 | + $starsAmount += $this->detailProductItem->getRating(); |
|
82 | + } |
|
83 | + } |
|
84 | + $refs = $this->detailProductItem->getRefItems(); |
|
85 | + if(isset($refs['product'])) { |
|
86 | + |
|
87 | + foreach ($refs['product'] as $variant_id => $variant){ |
|
88 | + $IDs[] = $variant_id; |
|
89 | + if($variant->getRatings()){ |
|
90 | + $reviewsAmount += $variant->getRatings(); |
|
91 | + if ($variant->getRating() > 0) { |
|
92 | + $amountOfStarred++; |
|
93 | + $starsAmount += $variant->getRating(); |
|
94 | + } |
|
95 | + } |
|
96 | + } |
|
97 | + $starsAmount = $starsAmount / $amountOfStarred; |
|
98 | + } |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | ?> |
@@ -71,24 +71,24 @@ discard block |
||
71 | 71 | $reviewsAmount = 0; |
72 | 72 | $starsAmount = 0; |
73 | 73 | $IDs = []; |
74 | -if (isset( $this->detailProductItem )) { |
|
74 | +if( isset( $this->detailProductItem ) ) { |
|
75 | 75 | $IDs[] = $this->detailProductItem->getId(); |
76 | 76 | $amountOfStarred = 0; |
77 | - if ($this->detailProductItem->getRatings()) { |
|
77 | + if( $this->detailProductItem->getRatings() ) { |
|
78 | 78 | $reviewsAmount += $this->detailProductItem->getRatings(); |
79 | - if($this->detailProductItem->getRating() > 0) { |
|
79 | + if( $this->detailProductItem->getRating() > 0 ) { |
|
80 | 80 | $amountOfStarred++; |
81 | 81 | $starsAmount += $this->detailProductItem->getRating(); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | $refs = $this->detailProductItem->getRefItems(); |
85 | - if(isset($refs['product'])) { |
|
85 | + if( isset( $refs['product'] ) ) { |
|
86 | 86 | |
87 | - foreach ($refs['product'] as $variant_id => $variant){ |
|
87 | + foreach( $refs['product'] as $variant_id => $variant ) { |
|
88 | 88 | $IDs[] = $variant_id; |
89 | - if($variant->getRatings()){ |
|
89 | + if( $variant->getRatings() ) { |
|
90 | 90 | $reviewsAmount += $variant->getRatings(); |
91 | - if ($variant->getRating() > 0) { |
|
91 | + if( $variant->getRating() > 0 ) { |
|
92 | 92 | $amountOfStarred++; |
93 | 93 | $starsAmount += $variant->getRating(); |
94 | 94 | } |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | |
156 | 156 | <?php if( $this->detailProductItem->getRating() > 0 ) : ?> |
157 | 157 | <div class="rating" itemscope itemprop="aggregateRating" itemtype="http://schema.org/AggregateRating"> |
158 | - <span class="stars"><?= str_repeat( '★', (int) round( $starsAmount) ?></span> |
|
159 | - <span class="rating-value" itemprop="ratingValue"><?= $enc->html( (int) round( $starsAmount) ) ?></span> |
|
158 | + <span class="stars"><?= str_repeat( '★', (int) round( $starsAmount ) ?></span> |
|
159 | + <span class="rating-value" itemprop="ratingValue"><?= $enc->html( (int) round( $starsAmount ) ) ?></span> |
|
160 | 160 | <span class="ratings" itemprop="reviewCount"><?= $reviewsAmount ?></span> |
161 | 161 | </div> |
162 | 162 | <?php endif ?> |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | <div class="tab-pane fade" id="nav-review" role="tabpanel" aria-labelledby="nav-review-tab" |
511 | 511 | aria-label="<?= $enc->attr( $this->translate( 'client', 'Product reviews' ) ) ?>"> |
512 | 512 | |
513 | - <div class="reviews container-fluid block" data-productid="<?= $enc->attr( implode(',', $IDs) ) ?>"> |
|
513 | + <div class="reviews container-fluid block" data-productid="<?= $enc->attr( implode( ',', $IDs ) ) ?>"> |
|
514 | 514 | <div class="row"> |
515 | 515 | <div class="col-md-4 rating-list"> |
516 | 516 | <div class="rating-numbers"> |