Closed mlocati closed 1 year ago
I managed to replicate the issue: it occurs when we have a Product List block with the "Display Quickview Link (Modal Window)" option turned on:
In this case, when users click on the product image, we have the error above.
I tried to fix it by adding this line rather top in the elements/product_modal.php
file:
$variationLookup = $product->getVariationLookup();
and then the error changed to:
Undefined array key 2 at line
$variation = $variationLookup[$optionItem->getID()];
So I changed that line to
$variation = isset($variationLookup[$optionItem->getID()]) ? $variationLookup[$optionItem->getID()] : null;
Then the error became
Undefined variable $availableOptionsids
So, rather on top, I added these lines:
$variationData = $product->getVariationData();
$availableOptionsids = isset($variationData['availableOptionsids']) ? $variationData['availableOptionsids'] : null;
Then the error became
Undefined variable $btnText
So, I changed code
<?= ($btnText ? h($btnText) : t("Add to Cart")); ?>
to
<?= empty($btnText) ? t('Add to Cart') : h($btnText) ?>
And finally the modal appeared withour errors
but
Whereas in the product list I can choose the quantity and the variations, in the modal I see the Out of Stock
message (so, I can't add it to the cart).
...and my knowledge of Community Store stops here...
I'll take a look and see what I can find.
I've personally never used the quick look feature, I'm just not a fan of it. So it's something I've neglected to be honest. I was even tempted to remove it, but I just don't know if people are using it.
...and my knowledge of Community Store stops here...
Here's the point I can't solve:
$product->isSellable()
It returns false
here:
And I don't know how to proceed.
I've personally never used the quick look feature, I'm just not a fan of it.
I've disabled it for now (I also find it rather ugly, but ya now, it's not a website for me :wink:)
I'll take a look and see what I can find.
Thanks ❤️!
I created the issue #792 that replaces this pull request.
I don't know when this occurs, but I have the following error in the logs:
The easy fix is cffdfbd7e55bc4b3ede8023e9ab76d1a39ba7dd7 (included in this PR), but I'm wondering if instead we should move the definition of
$variationLookup
currently at line 205 before line 123