@@ -67,8 +67,7 @@ |
||
| 67 | 67 | } else { |
| 68 | 68 | unset( $this->items[$type][$id] ); |
| 69 | 69 | } |
| 70 | - } |
|
| 71 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 70 | + } catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 72 | 71 | { |
| 73 | 72 | $msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id ); |
| 74 | 73 | $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN ); |
@@ -288,17 +288,14 @@ discard block |
||
| 288 | 288 | { |
| 289 | 289 | $address->copyFrom( $value ); |
| 290 | 290 | $this->basket->setAddress( $address, $type ); |
| 291 | - } |
|
| 292 | - else if( is_array( $value ) ) |
|
| 291 | + } else if( is_array( $value ) ) |
|
| 293 | 292 | { |
| 294 | 293 | $this->setAddressFromArray( $address, $value ); |
| 295 | 294 | $this->basket->setAddress( $address, $type ); |
| 296 | - } |
|
| 297 | - else if( $value === null ) |
|
| 295 | + } else if( $value === null ) |
|
| 298 | 296 | { |
| 299 | 297 | $this->basket->deleteAddress( $type ); |
| 300 | - } |
|
| 301 | - else |
|
| 298 | + } else |
|
| 302 | 299 | { |
| 303 | 300 | throw new \Aimeos\Controller\Frontend\Basket\Exception( sprintf( 'Invalid value for address type "%1$s"', $type ) ); |
| 304 | 301 | } |
@@ -564,8 +561,7 @@ discard block |
||
| 564 | 561 | { |
| 565 | 562 | $this->setAddress( $type, $item->toArray() ); |
| 566 | 563 | $basket->deleteAddress( $type ); |
| 567 | - } |
|
| 568 | - catch( \Exception $e ) |
|
| 564 | + } catch( \Exception $e ) |
|
| 569 | 565 | { |
| 570 | 566 | $logger = $this->getContext()->getLogger(); |
| 571 | 567 | $str = 'Error migrating address with type "%1$s" in basket to locale "%2$s": %3$s'; |
@@ -594,8 +590,7 @@ discard block |
||
| 594 | 590 | { |
| 595 | 591 | $this->addCoupon( $code ); |
| 596 | 592 | $basket->deleteCoupon( $code, true ); |
| 597 | - } |
|
| 598 | - catch( \Exception $e ) |
|
| 593 | + } catch( \Exception $e ) |
|
| 599 | 594 | { |
| 600 | 595 | $logger = $this->getContext()->getLogger(); |
| 601 | 596 | $str = 'Error migrating coupon with code "%1$s" in basket to locale "%2$s": %3$s'; |
@@ -644,8 +639,7 @@ discard block |
||
| 644 | 639 | ); |
| 645 | 640 | |
| 646 | 641 | $basket->deleteProduct( $pos ); |
| 647 | - } |
|
| 648 | - catch( \Exception $e ) |
|
| 642 | + } catch( \Exception $e ) |
|
| 649 | 643 | { |
| 650 | 644 | $code = $product->getProductCode(); |
| 651 | 645 | $logger = $this->getContext()->getLogger(); |
@@ -680,8 +674,7 @@ discard block |
||
| 680 | 674 | |
| 681 | 675 | $this->setService( $type, $item->getServiceId(), $attributes ); |
| 682 | 676 | $basket->deleteService( $type ); |
| 683 | - } |
|
| 684 | - catch( \Exception $e ) {; } // Don't notify the user as appropriate services can be added automatically |
|
| 677 | + } catch( \Exception $e ) {; } // Don't notify the user as appropriate services can be added automatically |
|
| 685 | 678 | } |
| 686 | 679 | |
| 687 | 680 | return $errors; |
@@ -1087,10 +1080,11 @@ discard block |
||
| 1087 | 1080 | { |
| 1088 | 1081 | $msg = sprintf( 'No unique article found for selected attributes and product ID "%1$s"', $productItem->getId() ); |
| 1089 | 1082 | throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
| 1090 | - } |
|
| 1091 | - else if( ( $result = reset( $productItems ) ) !== false ) // count == 1 |
|
| 1083 | + } else if( ( $result = reset( $productItems ) ) !== false ) { |
|
| 1084 | + // count == 1 |
|
| 1092 | 1085 | { |
| 1093 | 1086 | $productItem = $result; |
| 1087 | + } |
|
| 1094 | 1088 | $orderBaseProductItem->setProductCode( $productItem->getCode() ); |
| 1095 | 1089 | |
| 1096 | 1090 | $subprices = $productItem->getRefItems( 'price', 'default', 'default' ); |
@@ -1110,10 +1104,11 @@ discard block |
||
| 1110 | 1104 | |
| 1111 | 1105 | $attr[] = $orderAttributeItem; |
| 1112 | 1106 | } |
| 1113 | - } |
|
| 1114 | - else if( !isset( $options['variant'] ) || $options['variant'] != false ) // count == 0 |
|
| 1107 | + } else if( !isset( $options['variant'] ) || $options['variant'] != false ) { |
|
| 1108 | + // count == 0 |
|
| 1115 | 1109 | { |
| 1116 | 1110 | $msg = sprintf( 'No article found for selected attributes and product ID "%1$s"', $productItem->getId() ); |
| 1111 | + } |
|
| 1117 | 1112 | throw new \Aimeos\Controller\Frontend\Basket\Exception( $msg ); |
| 1118 | 1113 | } |
| 1119 | 1114 | |
@@ -359,8 +359,7 @@ discard block |
||
| 359 | 359 | { |
| 360 | 360 | $this->object->addProduct( $item->getId(), 5, array(), array(), array(), array(), array(), 'unit_warehouse3' ); |
| 361 | 361 | throw new \Exception( 'Expected exception not thrown' ); |
| 362 | - } |
|
| 363 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
| 362 | + } catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
| 364 | 363 | { |
| 365 | 364 | $item = $this->object->get()->getProduct( 0 ); |
| 366 | 365 | $this->assertEquals( 3, $item->getQuantity() ); |
@@ -385,8 +384,7 @@ discard block |
||
| 385 | 384 | { |
| 386 | 385 | $this->object->addProduct( $item->getId(), 5, array(), array(), array(), array(), array(), 'unit_warehouse2' ); |
| 387 | 386 | throw new \Exception( 'Expected exception not thrown' ); |
| 388 | - } |
|
| 389 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
| 387 | + } catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
| 390 | 388 | { |
| 391 | 389 | $this->assertEquals( array(), $this->object->get()->getProducts() ); |
| 392 | 390 | } |
@@ -619,8 +617,7 @@ discard block |
||
| 619 | 617 | { |
| 620 | 618 | $this->object->editProduct( 0, 5 ); |
| 621 | 619 | throw new \Exception( 'Expected exception not thrown' ); |
| 622 | - } |
|
| 623 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
| 620 | + } catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
| 624 | 621 | { |
| 625 | 622 | $item = $this->object->get()->getProduct( 0 ); |
| 626 | 623 | $this->assertEquals( 3, $item->getQuantity() ); |
@@ -657,8 +654,7 @@ discard block |
||
| 657 | 654 | { |
| 658 | 655 | $this->object->editProduct( $pos, 5 ); |
| 659 | 656 | throw new \Exception( 'Expected exception not thrown' ); |
| 660 | - } |
|
| 661 | - catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
| 657 | + } catch( \Aimeos\Controller\Frontend\Basket\Exception $e ) |
|
| 662 | 658 | { |
| 663 | 659 | $this->assertEquals( 3, $this->object->get()->getProduct( $pos )->getQuantity() ); |
| 664 | 660 | } |