Saturday, October 2, 2010

PrestaShop Tips - How to fix PDF Invoice problem with shipping fee displayed wrong

By default at PrestaShop, the price shown at front store is tax included. I have it run for a while and changed to show price exclude tax at front store. Since then, the invoice (PDF) does not display correctly. The shipping charge is missing, it displays $0 even it is not. See below:



If I change back to show price include tax at front store again, the invoice will also become normal. I guess it is a bug of PrestaShop.

Here I found a way to fix the problem. After this fix, it displays correctly no matter you set to display price include tax or exclude tax.

Changed file: ./classes/PDF.php
Changed line: 791 (this is ver 1.3.1, line # may be different for other version)
Changes made: replace the same line with below line.

$priceBreakDown['shippingCostWithoutTax'] = ($carrierTax->rate AND $carrierTax->rate != '0.00' AND self::$order->total_shipping != '0.00' AND Tax::zoneHasTax(intval($carrier->id_tax), intval($id_zone))) ? (self::$order->total_shipping / (1 + ($carrierTax->rate / 100))) : self::$order->total_shipping;

1 comment:

Antoni said...

Thank you! I had the same problem and the fix works perfect!