Prestashop: Product attributes combination not working in 1.7.6.3

Created on 24 Jan 2020  路  11Comments  路  Source: PrestaShop/PrestaShop

Hi,
Found HUGE bug in product attribute combination... :(
Fresh install 1.7.6.3,
PHP 7.2.11,
Classic theme

1) Setup Hummingbird printed t-shirt product as below
1

2) Setup - do not show unavailable product attributes on product page

3) Go to product and notice that black color in S size should't be available below
2

4) Then change size to M and notice that nothing happend color not changed to Black and White is still available as combination. Also links are the same place
3

5) And boom! Add product to cart...
4

OMFG :(

1.7.6.3 Bug Combinations FO Fixed Major PM 鉁旓笍 Products Regression

Most helpful comment

I found the problem.
Open themes/core.js

Search for
(".quickview .product-variants .page-product:not(.modal-open) .row .product-variants").replaceWith(e.product_variants),

And replace it with:
(".product-variants").replaceWith(e.product_variants),

I think this change is about quick view mode that must be check in the previous PRs for a fix.
It seems there is the same issue for product details and info in this file.

All 11 comments

Hi @PrestaShark,

Thanks for your report.
In fact, this issue is similar to this: https://github.com/PrestaShop/PrestaShop/issues/9948
But there is a difference between PS1.7.6.2 & PS1.7.6.3
PS1.7.6.2 => behavior as reported here: https://github.com/PrestaShop/PrestaShop/issues/9948 => Unable to select product combination, because you need to go via a combination that is out of stock
Size: M - Color: white => out of stock => when we select it => redirection to Size: S - Color: Wight
https://drive.google.com/file/d/1OAPLsm6as9RO6vx7C-TlXNOcCWDD-xPH/view

PS1.7.6.3 => other behavior
`Size: M - Color: white => out of stock => when we select it => no redirection => the URL is not changed => Add to cart button is enabled => regression => NOK
https://drive.google.com/file/d/1ybU7EVxWEcsg9ntIGt7QaMBmIAunbMNB/view

PHP7.2 => Click on add to cart => there is no pop up displayed=> https://drive.google.com/file/d/1q6oEparN6NGdqJrTBd5hPKVpj9DHAM_T/view)

PHP7.1 => click on add to cart => a pop up displayed =>
https://drive.google.com/file/d/1b83jCtjseh1xyGJWZxVBw0wBMzAKYQ6f/view
image => regression => NOK

I鈥檒l add this to the debug roadmap so that it鈥檚 fixed. If you have already fixed it on your end or if you think you can do it, please do send us a pull request!
Thanks!

I found the problem.
Open themes/core.js

Search for
(".quickview .product-variants .page-product:not(.modal-open) .row .product-variants").replaceWith(e.product_variants),

And replace it with:
(".product-variants").replaceWith(e.product_variants),

I think this change is about quick view mode that must be check in the previous PRs for a fix.
It seems there is the same issue for product details and info in this file.

@Danoosh work better but only with option "Display unavailable product attributes on product page -> YES". When NO then nothing better.

Hiding product combination that is not available will lead to not be able to access to some product, as explained on the issue #9948
It doesn't make sense to hide some combination because at some point some products will disappear.

The feature could work only if there is one type of combination or when there is no more combination possible for one combination value.
Ex:
t-shirt Black - size M
t-shirt White - size M
t-shirt Black - size S
t-shirt White - size S
If there are no more stocks for S white and S black, the S size combination will be hidden.

That why we should restrain it for only one combination and if it has more the feature won't work.
Thank @khouloudbelguith @PrestaShark for the report and the investigation :smile:

Ok. Let's work with point 4 and 5 of my request.

Ok,
The feature show unavailable product attributes on product page is misunderstood
The behaviour is when an attribute doesn't have any product in all possible combinations, it will be hidden or not

For example
S - White => 0
S - Black => 1
M - White => 0
M - Black => 1

In this case, if you select "DO NOT show unavailable product attributes on product page", the white color will be hidden

This feature works well in 1.7.6.3

For the add-to-cart button clickable when an combination doesn't have available product, the proposition is to fix it by disabling the button

For Example
S - White => 0
S - Black => 1
M - White => 1
M - Black => 0

If I choose
S-White => disabled
S-Black => enabled
M-White => enabled
M-Black => disabled

Does it fit your expectations ?

Hi ,

(".quickview .product-variants .page-product:not(.modal-open) .row .product-variants").replaceWith(e.product_variants),

if you check this code above in core.js you can see that there is a typo...a coma is missing after .product-variants

so it should be

(".quickview .product-variants, .page-product:not(.modal-open) .row .product-variants").replaceWith(e.product_variants),

I am using ps 1.7.6.3 I have the same problem. but when I updated my core.js file it is working fine.

(".quickview .product-variants .page-product:not(.modal-open) .row .product-variants").replaceWith(e.product_variants),
if you check this code above in core.js you can see that there is a typo...a coma is missing after .product-variants

so it should be

(".quickview .product-variants, .page-product:not(.modal-open) .row .product-variants").replaceWith(e.product_variants),

Thanks Support team .

Best Regards
Maneesh Tiwari

Sorry "comma" solution with disabled option to not show unavailable product combinations works like below

https://drive.google.com/file/d/1WdxLjbqnQoZ5E8MfIxFkkWxGWdQ7fmo3/view?usp=sharing

(Size: S, Color: White) and (Size: M, Color: Black) are available in that case.

Can't choose size M, can't choose color Black.

Case need more investigation. Thanks!

It's working for me.
check this link

https://www.loom.com/share/8de02a51b17642d4b9076aa7cce3e92b

Best Regards
Maneesh Tiwari

Do You have exact setup as below?
presta1

Preferences -> Produtcts -> Product page
(Display unavailable product attributes on product page set as NO)
presta2

Was this page helpful?
0 / 5 - 0 ratings