We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Error, Shop

Miscalculated discounts

Hi

I am seeing miscalculated percentage discounts in Perch Shop orders with as per this thread by Mike Harrison.

25% off example below:

Order: EP61

Item Options Quantity Unit Price Total
Tentacled Island A4 portrait print (210x297mm) 1 15.00 15.00
Hassel 11 A4 landscape print (297x210mm) 1 15.00 15.00
Space Girl A4 portrait print (210x297mm) 2 15.00 30.00
Discount (EP25) -15.02
Subtotal 44.98
Delivery: Second Class Delivery (FREE!) 0.00
Total £44.98
Perch Runway: 3.0.10, PHP: 7.0.1, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: 7e72f9690b1498a1bead7a637c33a831c0d2f655 $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.10), assets (3.0.10), categories (3.0.10), perch_forms (1.9.1), perch_shop_orders (1.2.5), perch_shop_products (1.2.5), perch_shop (1.2.5), perch_members (1.6.2), perch_mailchimp (3.1)
App runtimes: <?php $apps_list = [ 'perch_mailchimp', 'perch_members', 'perch_shop', 'perch_forms', ];
PERCH_LOGINPATH: /perch
PERCH_PATH: /var/sites/e/ellipress.co.uk/public_html/perch
PERCH_CORE: /var/sites/e/ellipress.co.uk/public_html/perch/core
PERCH_RESFILEPATH: /var/sites/e/ellipress.co.uk/public_html/perch/resources
Image manipulation: GD
PHP limits: Max upload 100M, Max POST 100M, Memory: 128M, Total max file upload: 100M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
DOCUMENT_ROOT: /var/sites/e/ellipress.co.uk/public_html
HTTP_HOST: ellipress.co.uk
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Jonathan Elliman

Jonathan Elliman 27 points

  • 2 years ago

Further investigation shows that it's not applying this rounding error (I assume it's that) to the actual amount the customer pays.

This is just from the confirmation email that goes to the client. Am I doing something wrong in the template? Here's the section that's displaying the wrong figure:


<perch:if id="total_discounts" match="gt" value="0.00"> <tr> <td colspan="4" align="right"> Discount (<perch:shop id="discount_code" type="hidden" />) </td> <td align="right" colspan="2"> -<perch:shop id="total_discounts_with_tax" type="hidden" format="$:%.2n" /> </td> </tr> <tr> <td colspan="4" align="right"> Subtotal </td> <td align="right" colspan="2"> <perch:shop id="total_items_discounted_with_tax" type="hidden" format="$:%.2n" /> </td> </tr> <perch:else /> <tr> <td colspan="4" align="right"> Subtotal </td> <td align="right" colspan="2"> <perch:shop id="total_items_discounted_with_tax" type="hidden" format="$:%.2n" /> </td> </tr> </perch:if>
Drew McLellan

Drew McLellan 2638 points
Perch Support

I believe that's been fixed in the latest version of Shop.

Hi Drew

Thanks for the reply. Do you mean it's fixed in a new version that isn't out yet? I'm on the latest: v1.2.5

Kind regards

Jon

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, I think it's been fixed internally.

Thanks Drew