Skip to content

Commit

Permalink
Set component only if there is more than one detail-component
Browse files Browse the repository at this point in the history
If there is only one detail component in a shop, kwc_shop_products is not allowed
to have a column 'component'. So we need to check if there is only one detail component
before we ask for the column 'component'.
  • Loading branch information
lllHuber committed Feb 15, 2018
1 parent 6f1b896 commit 469910d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions KwcShop/Kwc/Shop/AddToCart/OrderProductData.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ public function alterBackendOrderForm(KwcShop_Kwc_Shop_AddToCartAbstract_Fronten
foreach (Kwc_Abstract::getComponentClasses() as $c) {
if (is_instance_of($c, 'KwcShop_Kwc_Shop_Products_Directory_Component')) {
$detailClasses = Kwc_Abstract::getChildComponentClasses($c, 'detail');
foreach ($detailClasses as $key=>$class) {
if (Kwc_Abstract::getChildComponentClass($class, 'addToCart') == $this->_class) {
$component = $key;
if (count($detailClasses) > 1) {
foreach ($detailClasses as $key=>$class) {
if (Kwc_Abstract::getChildComponentClass($class, 'addToCart') == $this->_class) {
$component = $key;
}
}
}
}
Expand Down

0 comments on commit 469910d

Please sign in to comment.