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
145
Reaction score
333
Points
63
NullCash
956
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: 7
  • ReadMe.txt
    6.6 KB · Views: 6
Last edited:

cmrcmr

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

Salvacal

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