Issue
wonderful community. I need to add an extra fee to the orders in prestashop. I have developed a custom payment module that's working as expected. I just can't find any information on how to add this extra fee (that's configurable in the payment module itself), to the cart, invoice and wherever is needed. All the information I have found, the answers link to buy a module on the marketplace. I can't afford to buy it. So, I'll appreciate if you can shed some light on this issue.
I'm using PS 1.6 and 1.7.x.
Solution
The best way to achieve would be to:
- Add a new product to your Catalog, called 'Extra fee'
- Select 'Nowhere' for its visibility, and set a price matching the extra fee you are trying to charge
- Override the getOrderTotal() method in the Cart class, to add a new condition stating that if the specific payment module has been selected, the 'Extra fee' product should be automatically added to the cart (using $this->updateQty(1, $id_product_extra_fee);)
- Make sure to handle the case where the buyer decides to switch to another payment method (then remove this product from their cart)
This will automatically populate the invoice, the confirmation e-mail, the order detail in the admin panel, etc.
Answered By - Bruno Leveque Answer Checked By - Marilyn (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.