Skip to content

Commit

Permalink
fix: Add fallback for variants
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminJoerger committed Nov 21, 2023
1 parent 001a3bc commit 0395642
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,22 @@ public function apply(Type $product)
);
$single = ($variantName[0]['oxvarname'] === '');

$variants = [['id' => '']];

if (!$single) {
$titleArray = array_map('trim', explode('|', $variantName[0]['oxvarname']));
$hashArray = array_map('md5', $titleArray);

$query = str_replace('{{activeSnippet}}', $this->activeSnippet, $this->selectVariantDataQuery);
$variants = $this->database->query(
$dbvariants = $this->database->query(
$query,
[
'productId' => $product->id,
]
);
} else {
$variants = [['id' => '']];
if ($dbvariants) {
$variants = $dbvariants;
}
}

foreach ($variants as $variant) {
Expand Down

0 comments on commit 0395642

Please sign in to comment.