@@ -471,19 +471,22 @@ discard block |
||
471 | 471 | $disable = $view->config( 'client/html/checkout/standard/address/delivery/disable-new', false ); |
472 | 472 | $type = \Aimeos\MShop\Order\Item\Base\Address\Base::TYPE_DELIVERY; |
473 | 473 | |
474 | - if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) === 'null' && $disable === false ) // new address |
|
474 | + if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) === 'null' && $disable === false ) { |
|
475 | + // new address |
|
475 | 476 | { |
476 | 477 | $params = $view->param( 'ca_delivery', [] ); |
478 | + } |
|
477 | 479 | |
478 | 480 | if( ( $view->deliveryError = $this->checkFields( $params ) ) !== [] ) { |
479 | 481 | throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one delivery address part is missing or invalid' ) ); |
480 | 482 | } |
481 | 483 | |
482 | 484 | $ctrl->addAddress( $type, $params, 0 ); |
483 | - } |
|
484 | - else if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) !== '-1' ) // existing address |
|
485 | + } else if( ( $option = $view->param( 'ca_deliveryoption', 'null' ) ) !== '-1' ) { |
|
486 | + // existing address |
|
485 | 487 | { |
486 | 488 | $params = $view->param( 'ca_delivery_' . $option, [] ); |
489 | + } |
|
487 | 490 | |
488 | 491 | if( !empty( $params ) && ( $view->deliveryError = $this->checkFields( $params ) ) !== [] ) { |
489 | 492 | throw new \Aimeos\Client\Html\Exception( sprintf( 'At least one delivery address part is missing or invalid' ) ); |
@@ -496,13 +499,11 @@ discard block |
||
496 | 499 | $params = array_replace( $address->toArray(), $params ); |
497 | 500 | $addr = $ctrl->addAddress( $type, $params, 0 )->get()->getAddress( $type, 0 )->setAddressId( $option ); |
498 | 501 | $custCntl->addAddressItem( $address->copyFrom( $addr ), $option )->store(); |
499 | - } |
|
500 | - else |
|
502 | + } else |
|
501 | 503 | { |
502 | 504 | $ctrl->addAddress( $type, $params, 0 ); |
503 | 505 | } |
504 | - } |
|
505 | - else |
|
506 | + } else |
|
506 | 507 | { |
507 | 508 | $ctrl->deleteAddress( $type ); |
508 | 509 | } |
@@ -704,8 +705,7 @@ discard block |
||
704 | 705 | $invalid[$key] = $name; |
705 | 706 | unset( $params[$key] ); |
706 | 707 | } |
707 | - } |
|
708 | - else |
|
708 | + } else |
|
709 | 709 | { |
710 | 710 | unset( $params[$key] ); |
711 | 711 | } |