@@ -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 | } |
@@ -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 | |
@@ -215,8 +215,7 @@ |
||
| 215 | 215 | $msg = $view->translate( 'client', "At least one product couldn't be added to the basket." ); |
| 216 | 216 | $view->errors = array_merge( $view->get( 'errors', [] ), [$msg] ); |
| 217 | 217 | } |
| 218 | - } |
|
| 219 | - else |
|
| 218 | + } else |
|
| 220 | 219 | { |
| 221 | 220 | foreach( (array) $view->param( 'b_prod', [] ) as $values ) |
| 222 | 221 | { |
@@ -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 | } |