PrestaShop icon indicating copy to clipboard operation
PrestaShop copied to clipboard

Customization value lost after combination change, leading to customization mess

Open obelisk-services opened this issue 3 years ago • 2 comments

Prerequisites

Describe the bug and add screenshots

If our store has a product with customization and combination options and a customer, in the product page, first adds a customization and then changes the combination, the ID of the combination changes to "0" ("product_customization_id" input) and some weird stuff can be done, like having in the cart a product that has a mandatory combination without it, or having a product with two customizations. In the steps to reproduce, I show some examples of this behavior and if you read that section you will understand the problem.

Expected behavior

When we add the same product twice but with two different customizations, two products should appear in the cart with one customization each, and when we delete one product, only one should remain with it's customization.

Steps to reproduce

Create a customizable product and add some combinations (we used sample "Customizable mug" product, and added some size combinations). Product should look like this: image First, add a product customization (write some text and click "save customization") and then change the combination (order is the key). image

If you inspect the input id="product_customization_id" you will see that value after the combination change has changed to "0", but customization is still shown to the user in the form above. If you refresh the page, product_customization_id value will be back to normal. But it is not only that, we can manage to do some weird stuff:

Let's start again: Access the product page, add some customization, change the combination and add the product to cart. Everything should look fine. Then repeat the process again. Add to the cart the same product with other customization and size (remember, first we have to select the customization and then change the combination).

Now the cart looks weird. We have two mugs but with two customizations each:

image

If we try to delete one mug from the cart, we see that customizations dissapear, or even we can't remove one mug (at least in the interface, if we refresh the page, the cart is empty). This way we can manage to buy a customizable mug that has a mandatory customization without it.

image

Probably, more weird things can be done this way.

PrestaShop version(s) where the bug happened

1.7.8.7 and 8.0.0

PHP version(s) where the bug happened

7.4.29 and 8.1.7

If your bug is related to a module, specify its name and its version

No response

obelisk-services avatar Jul 27 '22 14:07 obelisk-services

Hello @obelisk-services,

I reproduce the issue with PrestaShop with develop branch. No error on 8.0.x branch

develop-custom-product-combinations

On 1.7.7.8 and 1.7.8.7 there is no error:

  • 1.7.7.8

1778-custom-product-combinations-1

1778-custom-product-combinations-2

  • 1.7.8.7

1787-custom-product-combinations-1

1787-custom-product-combinations-2

It's a regression.

Please be aware that some issues might take a very long time to be resolved. If this one is important to you and you cannot wait for it to be fixed on the project’s own time, we strongly suggest you consider contacting a professional to help you.

Well done and thank you for the PR 🚀

Thank you

sLorenzini avatar Jul 27 '22 15:07 sLorenzini

Hi,

I have tried on a fresh Prestashop installation (1.7.8.7) on a new docker container and I was able to reproduce de issue. Even more, the line that causes the issue is in the version code (https://github.com/PrestaShop/PrestaShop/blob/1.7.8.7/themes/_core/js/product.js#L231). Maybe you miss one step? Can you please try again?

image

obelisk-services avatar Jul 27 '22 16:07 obelisk-services

PR https://github.com/PrestaShop/PrestaShop/pull/29635 on 1.7.8.x

matks avatar Sep 16 '22 14:09 matks

In order to fix this issue, we need to merge 1.7.8.x into 8.0.x

matks avatar Sep 16 '22 14:09 matks

Merge PR is here https://github.com/PrestaShop/PrestaShop/pull/29682

matks avatar Sep 19 '22 09:09 matks

Closed as it has been fixed with this PR #29635

hibatallahAouadni avatar Sep 19 '22 17:09 hibatallahAouadni

This issue initially targeted the 8.0 so we should check this issue on 8.0.x branch after https://github.com/PrestaShop/PrestaShop/pull/29682 has been merged

jolelievre avatar Sep 19 '22 18:09 jolelievre

Delivered in 8.0.x

matks avatar Sep 20 '22 13:09 matks