@@ -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(); |
@@ -76,9 +76,12 @@ |
||
| 76 | 76 | $context = $this->context(); |
| 77 | 77 | $cntl = \Aimeos\Controller\Frontend::create( $context, 'customer' ); |
| 78 | 78 | |
| 79 | - try { |
|
| 79 | + try |
|
| 80 | + { |
|
| 80 | 81 | $customer = $cntl->find( $addr->getEmail() ); |
| 81 | - } catch( \Exception $e ) { |
|
| 82 | + } |
|
| 83 | + catch( \Exception $e ) |
|
| 84 | + { |
|
| 82 | 85 | $customer = $new ? $cntl->add( $addr->toArray() )->store()->get() : null; |
| 83 | 86 | } |
| 84 | 87 | |
@@ -427,15 +427,16 @@ |
||
| 427 | 427 | $disable = $view->config( 'client/html/checkout/standard/address/payment/disable-new', false ); |
| 428 | 428 | $type = \Aimeos\MShop\Order\Item\Address\Base::TYPE_PAYMENT; |
| 429 | 429 | |
| 430 | - if( ( $option = $view->param( 'ca_paymentoption', 'null' ) ) === 'null' && $disable === false ) // new address |
|
| 430 | + if( ( $option = $view->param( 'ca_paymentoption', 'null' ) ) === 'null' && $disable === false ) { |
|
| 431 | + // new address |
|
| 431 | 432 | { |
| 432 | 433 | $params = $view->param( 'ca_payment', [] ); |
| 434 | + } |
|
| 433 | 435 | |
| 434 | 436 | if( ( $view->addressPaymentError = $this->checkFields( $params ) ) !== [] ) { |
| 435 | 437 | throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one payment address part is missing or invalid' ) ); |
| 436 | 438 | } |
| 437 | - } |
|
| 438 | - else // existing address |
|
| 439 | + } else // existing address |
|
| 439 | 440 | { |
| 440 | 441 | $params = $view->param( 'ca_payment_' . $option, [] ); |
| 441 | 442 | |
@@ -316,19 +316,22 @@ discard block |
||
| 316 | 316 | $disable = $view->config( 'client/html/checkout/standard/address/delivery/disable-new', false ); |
| 317 | 317 | $type = \Aimeos\MShop\Order\Item\Address\Base::TYPE_DELIVERY; |
| 318 | 318 | |
| 319 | - if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) === 'null' && $disable === false ) // new address |
|
| 319 | + if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) === 'null' && $disable === false ) { |
|
| 320 | + // new address |
|
| 320 | 321 | { |
| 321 | 322 | $params = $view->param( 'ca_delivery', [] ); |
| 323 | + } |
|
| 322 | 324 | |
| 323 | 325 | if( ( $view->addressDeliveryError = $this->checkFields( $params ) ) !== [] ) { |
| 324 | 326 | throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one delivery address part is missing or invalid' ) ); |
| 325 | 327 | } |
| 326 | 328 | |
| 327 | 329 | $ctrl->addAddress( $type, $params, 0 ); |
| 328 | - } |
|
| 329 | - else if( ( $option = $view->param( 'ca_deliveryoption' ) ) !== 'like' ) // existing address |
|
| 330 | + } else if( ( $option = $view->param( 'ca_deliveryoption' ) ) !== 'like' ) { |
|
| 331 | + // existing address |
|
| 330 | 332 | { |
| 331 | 333 | $params = $view->param( 'ca_delivery_' . $option, [] ); |
| 334 | + } |
|
| 332 | 335 | |
| 333 | 336 | if( !empty( $params ) && ( $view->addressDeliveryError = $this->checkFields( $params ) ) !== [] ) { |
| 334 | 337 | throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one delivery address part is missing or invalid' ) ); |
@@ -341,13 +344,11 @@ discard block |
||
| 341 | 344 | $params = array_replace( $address->toArray(), $params + ['order.address.addressid' => $option] ); |
| 342 | 345 | $addr = $ctrl->addAddress( $type, $params, 0 )->get()->getAddress( $type, 0 ); // sanitize address first |
| 343 | 346 | $custCntl->addAddressItem( $address->copyFrom( $addr ), $option )->store(); // update existing address |
| 344 | - } |
|
| 345 | - else |
|
| 347 | + } else |
|
| 346 | 348 | { |
| 347 | 349 | $ctrl->addAddress( $type, $params, 0 ); |
| 348 | 350 | } |
| 349 | - } |
|
| 350 | - else |
|
| 351 | + } else |
|
| 351 | 352 | { |
| 352 | 353 | $ctrl->deleteAddress( $type ); |
| 353 | 354 | } |
@@ -159,7 +159,8 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | </ul> |
| 161 | 161 | |
| 162 | - <?php else : ?> |
|
| 162 | + <?php else { |
|
| 163 | + : ?> |
|
| 163 | 164 | |
| 164 | 165 | <input type="hidden" value="1" name="<?= $enc->attr( $this->formparam( ['b_prod', 0, 'attrconfid', 'qty', ''] ) ) ?>"> |
| 165 | 166 | <select id="select-<?= $enc->attr( $key ) ?>" class="form-select select-list" |
@@ -211,7 +212,9 @@ discard block |
||
| 211 | 212 | value="<?= $enc->attr( $price->getValue() ) ?>" |
| 212 | 213 | <?php endif ?> |
| 213 | 214 | > |
| 214 | - <?php break; case 'date': ?> |
|
| 215 | + <?php break; |
|
| 216 | +} |
|
| 217 | +case 'date': ?> |
|
| 215 | 218 | <input id="select-<?= $enc->attr( $key ) ?>" class="form-control" type="date" name="<?= $enc->attr( $this->formparam( ['b_prod', 0, 'attrcustid', $id] ) ) ?>"> |
| 216 | 219 | <?php break; default: ?> |
| 217 | 220 | <input id="select-<?= $enc->attr( $key ) ?>" class="form-control" type="text" name="<?= $enc->attr( $this->formparam( ['b_prod', 0, 'attrcustid', $id] ) ) ?>"> |
@@ -92,7 +92,7 @@ |
||
| 92 | 92 | <?php $attributes = map( $attributes )->uasort( fn( $a, $b ) => $a->getPosition() <=> $b->getPosition() ?: $a->getName() <=> $b->getName() ) ?> |
| 93 | 93 | |
| 94 | 94 | <li class="select-item <?= $enc->attr( $code . ' ' . $this->config( 'client/html/catalog/attribute/type/' . $code, 'select' ) ) ?>"> |
| 95 | - <label for="select-<?= $enc->attr( $key ) ?>" class="select-name"><?= $enc->html( isset($attrTypes[$code]) ? $attrTypes[$code]->getName() : $this->translate( 'client/code', $code ) ) ?></label> |
|
| 95 | + <label for="select-<?= $enc->attr( $key ) ?>" class="select-name"><?= $enc->html( isset( $attrTypes[$code] ) ? $attrTypes[$code]->getName() : $this->translate( 'client/code', $code ) ) ?></label> |
|
| 96 | 96 | |
| 97 | 97 | <?php if( $hint = $this->translate( 'client/code', $code . '-hint', null, 0, false ) ) : ?> |
| 98 | 98 | <div class="select-hint"><?= $enc->html( $hint ) ?></div> |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | public function data( \Aimeos\Base\View\Iface $view, array &$tags = [], ?string &$expire = null ) : \Aimeos\Base\View\Iface |
| 139 | 139 | { |
| 140 | 140 | $tree = \Aimeos\Controller\Frontend::create( $this->context(), 'catalog' )->uses( $this->domains() ) |
| 141 | - ->getTree( \Aimeos\Controller\Frontend\Catalog\Iface::LIST ); |
|
| 141 | + ->getTree( \Aimeos\Controller\Frontend\Catalog\Iface::list ); |
|
| 142 | 142 | |
| 143 | 143 | $products = \Aimeos\Controller\Frontend::create( $this->context(), 'product' )->uses( $this->domains() ) |
| 144 | 144 | ->category( $tree->getChildren()->getId()->all(), 'promotion' )->search(); |
@@ -113,7 +113,7 @@ |
||
| 113 | 113 | <?php $list = map( $list )->uasort( $sortfcn ) ?> |
| 114 | 114 | |
| 115 | 115 | <li class="select-item <?= $enc->attr( $code . ' ' . $this->config( 'client/html/catalog/selection/type/' . $code, 'select' ) ) ?>"> |
| 116 | - <label class="select-name"><?= $enc->html( isset($attrTypes[$code]) ? $attrTypes[$code]->getName() : $this->translate( 'client/code', $code ) ) ?></label> |
|
| 116 | + <label class="select-name"><?= $enc->html( isset( $attrTypes[$code] ) ? $attrTypes[$code]->getName() : $this->translate( 'client/code', $code ) ) ?></label> |
|
| 117 | 117 | |
| 118 | 118 | <?php if( $hint = $this->translate( 'client/code', $code . '-hint', null, 0, false ) ) : ?> |
| 119 | 119 | <div class="select-hint"><?= $enc->html( $hint ) ?></div> |