Extra Options - Custom Product Attributes For PrestaShop 1.2.7

No permission to download
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 :


SQL:
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 :

SQL:
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