v1.6-v1.7-v8x BugFix - ETS Extra Option v1.2.7 corrected version

chibi

Well-known member
Diamond
Elite
XNullUser
Joined
Aug 12, 2021
Messages
149
Reaction score
371
Points
63
NullCash
1,034
Hi there!

There's a really problematic bug in this module, causing inconsistent behaviour in the shopping basket.
It doesn't always happen, but sometimes when an option is added to a basket and the equivalent product without the option is also added, things happen such as an inconsistency in behaviour when deleting/modifying the quantity, which can then delete all the products when the product with the option is deleted from the basket.
And as a result, when this isn't the case, the product without option may even be removed from the basket when it falls below a certain quantity. (For example, if you want to go from 5 to less, it will just be deleted, and if you add 1, it will add 5 again, with same problem, even if user disconnect or clean cookies in webbrowser).

To check whether you have any inconsistencies in the database and correct this behaviour, here are a few SQL queries and file modifications to make, and the modified module is ready to use.

Look if bad is present in database with this SQL Check :

Code:
SELECT cp.*, ec.quantity AS eto_quantity
FROM ps_cart_product cp
LEFT JOIN (
    SELECT id_cart, id_product, id_product_attribute, SUM(quantity) AS quantity
    FROM ps_ets_eto_cart
    GROUP BY id_cart, id_product, id_product_attribute


If there are inconsistencies, correct them :

Code:
DELETE FROM `ps_ets_eto_cart`
WHERE (id_cart, id_product, id_product_attribute) NOT IN (
    SELECT id_cart, id_product, id_product_attribute FROM `ps_cart_product`
);

DELETE FROM ps_cart_product
WHERE (id_cart, id_product, id_product_attribute) NOT IN (
    SELECT id_cart, id_product, id_product_attribute
    FROM ps_ets_eto_cart
);


Edit ./modules/ets_extraoptions/classes/ets_eto_attribute_cart_class.php dans replace with :

(look in file ReadMe.txt with the module for the bugfix, i can not share topic with more than 5000 characters -_- )


I'm not really a dev, so if you have a better fix, share it ! =D
Original php file is still in module with "ets_eto_attribute_cart_class.php.originalfile" name

For people which just want click & go, you can download modded module and test it.
If you have bought this module, please report this bug.

--

Create global extra options & price impact for each option applies to all existing products at ONE time. Add custom product attributes; display by checkbox, radio, or drop-down menu. Faster and easier to manage than PrestaShop default attributes.

 

Attachments

  • v1.2.7-ets_extraoptions-bugfix.zip
    205.9 KB · Views: 10
  • ReadMe.txt
    6.6 KB · Views: 7
Last edited:

cmrcmr

Well-known member
Master
Diamond
Elite
XNullUser
Joined
Sep 6, 2019
Messages
1,020
Reaction score
1,192
Points
113
NullCash
6,319
Muchas gracias por compartir este modulo :D
 

Salvacal

Well-known member
Master
Diamond
Elite
Joined
Mar 21, 2020
Messages
384
Reaction score
1,057
Points
93
Location
Italy
NullCash
7,327
Thank you for sharing ! ;)
 

malaysianen

Member
XNullUser
Joined
May 8, 2024
Messages
124
Reaction score
10
Points
18
Location
US
NullCash
86
thank you for your work .that is great
 

devm

Member
XNullUser
Joined
Jan 19, 2022
Messages
249
Reaction score
0
Points
16
NullCash
4
Thank you very much! This is very useful module!
 

flsh14

Active member
Elite
XNullUser
Joined
Apr 13, 2020
Messages
129
Reaction score
138
Points
43
NullCash
385
Hi there!

There's a really problematic bug in this module, causing inconsistent behaviour in the shopping basket.
It doesn't always happen, but sometimes when an option is added to a basket and the equivalent product without the option is also added, things happen such as an inconsistency in behaviour when deleting/modifying the quantity, which can then delete all the products when the product with the option is deleted from the basket.
And as a result, when this isn't the case, the product without option may even be removed from the basket when it falls below a certain quantity. (For example, if you want to go from 5 to less, it will just be deleted, and if you add 1, it will add 5 again, with same problem, even if user disconnect or clean cookies in webbrowser).

To check whether you have any inconsistencies in the database and correct this behaviour, here are a few SQL queries and file modifications to make, and the modified module is ready to use.

Look if bad is present in database with this SQL Check :

Code:
SELECT cp.*, ec.quantity AS eto_quantity
FROM ps_cart_product cp
LEFT JOIN (
    SELECT id_cart, id_product, id_product_attribute, SUM(quantity) AS quantity
    FROM ps_ets_eto_cart
    GROUP BY id_cart, id_product, id_product_attribute


If there are inconsistencies, correct them :

Code:
DELETE FROM `ps_ets_eto_cart`
WHERE (id_cart, id_product, id_product_attribute) NOT IN (
    SELECT id_cart, id_product, id_product_attribute FROM `ps_cart_product`
);

DELETE FROM ps_cart_product
WHERE (id_cart, id_product, id_product_attribute) NOT IN (
    SELECT id_cart, id_product, id_product_attribute
    FROM ps_ets_eto_cart
);


Edit ./modules/ets_extraoptions/classes/ets_eto_attribute_cart_class.php dans replace with :

(look in file ReadMe.txt with the module for the bugfix, i can not share topic with more than 5000 characters -_- )


I'm not really a dev, so if you have a better fix, share it ! =D
Original php file is still in module with "ets_eto_attribute_cart_class.php.originalfile" name

For people which just want click & go, you can download modded module and test it.
If you have bought this module, please report this bug.

--

Create global extra options & price impact for each option applies to all existing products at ONE time. Add custom product attributes; display by checkbox, radio, or drop-down menu. Faster and easier to manage than PrestaShop default attributes.

thank you so much, i will test it
 

hegBIT

Well-known member
Master
Diamond
Elite
XNullUser
Joined
Mar 30, 2021
Messages
942
Reaction score
824
Points
93
NullCash
23
Thanks for your work and for improving this module
 
Top