@@ -50,23 +50,23 @@ |
||
50 | 50 | ?> |
51 | 51 | <?php if( isset( $this->detailProductItem ) ) : |
52 | 52 | |
53 | - // preselection of a variant product in a selection article |
|
54 | - $preSelectVariantAttributes = []; |
|
55 | - if ($_GET['productId'] && is_numeric($_GET['productId'])): |
|
53 | + // preselection of a variant product in a selection article |
|
54 | + $preSelectVariantAttributes = []; |
|
55 | + if ($_GET['productId'] && is_numeric($_GET['productId'])): |
|
56 | 56 | |
57 | - if(($listItem = $this->detailProductItem->getListItem( 'product', 'default', (int) $_GET['productId'] ) ) && ( $product = $listItem->getRefItem() ) ) |
|
57 | + if(($listItem = $this->detailProductItem->getListItem( 'product', 'default', (int) $_GET['productId'] ) ) && ( $product = $listItem->getRefItem() ) ) |
|
58 | 58 | |
59 | - $attributes = $product->getRefItems('attribute',null,'variant'); |
|
59 | + $attributes = $product->getRefItems('attribute',null,'variant'); |
|
60 | 60 | |
61 | - foreach($attributes as $attribId => $attribute): |
|
62 | - $preSelectVariantAttributes[$attribute->getType()] = $attribute->getId(); |
|
63 | - endforeach; |
|
61 | + foreach($attributes as $attribId => $attribute): |
|
62 | + $preSelectVariantAttributes[$attribute->getType()] = $attribute->getId(); |
|
63 | + endforeach; |
|
64 | 64 | |
65 | - if (!empty($preSelectVariantAttributes)): |
|
66 | - $preSelectVariantAttributes = htmlspecialchars(json_encode(['attributes' => $preSelectVariantAttributes, 'prodId' => $this->detailProductItem->getId()]), ENT_QUOTES, 'UTF-8'); |
|
67 | - endif; |
|
65 | + if (!empty($preSelectVariantAttributes)): |
|
66 | + $preSelectVariantAttributes = htmlspecialchars(json_encode(['attributes' => $preSelectVariantAttributes, 'prodId' => $this->detailProductItem->getId()]), ENT_QUOTES, 'UTF-8'); |
|
67 | + endif; |
|
68 | 68 | |
69 | - endif; |
|
69 | + endif; |
|
70 | 70 | |
71 | 71 | ?> |
72 | 72 |
@@ -52,18 +52,18 @@ discard block |
||
52 | 52 | |
53 | 53 | // preselection of a variant product in a selection article |
54 | 54 | $preSelectVariantAttributes = []; |
55 | - if ($_GET['productId'] && is_numeric($_GET['productId'])): |
|
55 | + if( $_GET['productId'] && is_numeric( $_GET['productId'] ) ): |
|
56 | 56 | |
57 | - if(($listItem = $this->detailProductItem->getListItem( 'product', 'default', (int) $_GET['productId'] ) ) && ( $product = $listItem->getRefItem() ) ) |
|
57 | + if( ( $listItem = $this->detailProductItem->getListItem( 'product', 'default', (int) $_GET['productId'] ) ) && ( $product = $listItem->getRefItem() ) ) |
|
58 | 58 | |
59 | - $attributes = $product->getRefItems('attribute',null,'variant'); |
|
59 | + $attributes = $product->getRefItems( 'attribute', null, 'variant' ); |
|
60 | 60 | |
61 | - foreach($attributes as $attribId => $attribute): |
|
62 | - $preSelectVariantAttributes[$attribute->getType()] = $attribute->getId(); |
|
61 | + foreach( $attributes as $attribId => $attribute ): |
|
62 | + $preSelectVariantAttributes[$attribute->getType()] = $attribute->getId(); |
|
63 | 63 | endforeach; |
64 | 64 | |
65 | - if (!empty($preSelectVariantAttributes)): |
|
66 | - $preSelectVariantAttributes = htmlspecialchars(json_encode(['attributes' => $preSelectVariantAttributes, 'prodId' => $this->detailProductItem->getId()]), ENT_QUOTES, 'UTF-8'); |
|
65 | + if( !empty( $preSelectVariantAttributes ) ): |
|
66 | + $preSelectVariantAttributes = htmlspecialchars( json_encode( ['attributes' => $preSelectVariantAttributes, 'prodId' => $this->detailProductItem->getId()] ), ENT_QUOTES, 'UTF-8' ); |
|
67 | 67 | endif; |
68 | 68 | |
69 | 69 | endif; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | <article class="product row <?= $this->detailProductItem->getConfigValue( 'css-class' ) ?>" |
81 | 81 | data-id="<?= $this->detailProductItem->getId() ?>" data-reqstock="<?= $reqstock ?>" |
82 | - <?= !empty($preSelectVariantAttributes) ? 'data-preselectvariant="' . $preSelectVariantAttributes . '"' : '' ?>> |
|
82 | + <?= !empty( $preSelectVariantAttributes ) ? 'data-preselectvariant="' . $preSelectVariantAttributes . '"' : '' ?>> |
|
83 | 83 | |
84 | 84 | <div class="col-sm-6"> |
85 | 85 |
@@ -54,9 +54,10 @@ |
||
54 | 54 | $preSelectVariantAttributes = []; |
55 | 55 | if ($_GET['productId'] && is_numeric($_GET['productId'])): |
56 | 56 | |
57 | - if(($listItem = $this->detailProductItem->getListItem( 'product', 'default', (int) $_GET['productId'] ) ) && ( $product = $listItem->getRefItem() ) ) |
|
58 | - |
|
57 | + if(($listItem = $this->detailProductItem->getListItem( 'product', 'default', (int) $_GET['productId'] ) ) && ( $product = $listItem->getRefItem() ) ) { |
|
58 | + |
|
59 | 59 | $attributes = $product->getRefItems('attribute',null,'variant'); |
60 | + } |
|
60 | 61 | |
61 | 62 | foreach($attributes as $attribId => $attribute): |
62 | 63 | $preSelectVariantAttributes[$attribute->getType()] = $attribute->getId(); |