@@ -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 | } |