shoppingflux / shoppingfluxexport

7 stars 7 forks source link

Fatal error with CDiscount fees #348

Closed ghost closed 6 years ago

ghost commented 6 years ago

Expected behaviour

CDiscount fees should be created without errors

Actual behaviour

A fatal error might be triggered when associating CDiscount fees an order and changing its price. Fatal error; Uncaught Unknown column 'original_wholesale_price' in 'field list.' During the insert in ps_order_detail.

Steps to reproduce the behaviour

Version 4.4 / 4.5 . Same behavior for real and virtual FDG product. Reproduced on PS 1.6.0.6 and 1.5.4.1

ghost commented 6 years ago

This seems to vary depending of PrestaShop version and the way the upgrade has been done between versions. It's possible that this column original_wholesale_price was added or removed at one point or might also depends of BO config.

In all cases, we should remove this column from the $fdInsertFields in order to keep the default value instead of specifying it. Therefore if the column doesn't exist it will still be working.

ghost commented 6 years ago

I compared with different versions of PrestaShop and saw the original_wholesale_price only in a 1.6.1. The default value of the column is 0, therefore there is no issue from removing it in the CDiscount fees keys of $fdInsertFields.