[SOLVED] Where did the Discount class go?



  • Hi,

    I’ve installed MyPresta’s Voucher generator module, but get an exception when I try to mass generate vouchers through the module.

    The exception starts with the following:

    Class ‘Discount’ not found
    at line 652 in file modules/vouchers/lib/voucherengine/engine.php

    After examining the classes folder, I can see that the Discount class found in Prestashop 1.6, has been removed from Thirty Bees.

    Does anyone know the reason behind this (I guess a lot of 3rd party modules rely on this class) or what it will take to modify my module in order to get it to work in Thirty Bees?



  • If you look at the file classes/discount.php in Prestashop you will see that in its header it displays the comment " * @deprecated 1.5.0.1". It has been replaced by classes/specificPrice.php. As TB has thrown out some old stuff it has been discarded.

    So you will need either to contact the author of the module or experiment yourself with using the specificPrice or specificPriceRule class instead of the Discount class.



  • Ahh… Thank you so much for the clarification.

    As the module is already compatible with PS1.7 (which also uses the specificPrice class), all I had to to do in order to fix the module, was to change line 646 in modules/vouchers/lib/voucherengine/engine.php from

    if (parent::psversion()== 7)
    

    to

    if (parent::psversion() > 5)
    

    It now works flawlessly with Thirty Bees 🙂


 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.