From b58ee1752973ca36cbf7c7772b8b2d4f242dddcf Mon Sep 17 00:00:00 2001 From: Daniela Puetz Date: Tue, 4 May 2021 13:22:50 +0200 Subject: [PATCH] Check that variant is active when it is exportet as an attribute --- .../Connect/Modifier/Common/AttributeModifier.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Makaira/Connect/Modifier/Common/AttributeModifier.php b/src/Makaira/Connect/Modifier/Common/AttributeModifier.php index d25a215..1d539cb 100644 --- a/src/Makaira/Connect/Modifier/Common/AttributeModifier.php +++ b/src/Makaira/Connect/Modifier/Common/AttributeModifier.php @@ -36,9 +36,8 @@ class AttributeModifier extends Modifier variant.oxvarselect as `value` FROM oxarticles parent - JOIN oxarticles variant ON parent.oxid = variant.oxparentid - WHERE - variant.oxparentid = :productId + JOIN (SELECT * from oxarticles WHERE + oxparentid = :productId AND {{activeSnippet}}) variant ON parent.oxid = variant.oxparentid '; public $selectVariantsNameQuery = ' @@ -204,8 +203,10 @@ public function apply(Type $product) ], false ); + $variantsQuery = + str_replace('{{activeSnippet}}', $this->activeSnippet, $this->selectVariantsQuery); $variants = $this->database->query( - $this->selectVariantsQuery, + $variantsQuery, [ 'productId' => $product->id, ]