Wrong display for coupon discount??

Please post your issues and questions about One Page Checkout for Virtuemart 2 to this forum.

Wrong display for coupon discount??

Postby atrus80 » Sun Jan 06, 2013 8:05 pm

Hi Stan,

Hope u are doing well, wishing all the best for the 2013! We have noted the following with the latest opc and VM2.10.16:

There is some issue with the discount coupon value at checkout. More specifically it is always calculated after tax, while we have set it to awocoupon to calculate it before tax.

See the attached image. (Prices include 17% tax, and the discount coupon is 10%). All finals are calculated correctly. However, please note that the discount amount shown is 33.83. This is wrong and misleading. The 33.83 is wrongly calculated from the price after tax (338.34 * 0.10). The correct discount amount before tax should be 289.1795 * 0.10 = 28.92.

Initially, we though it was a problem with awocoupon, but we were advised by seyi that it is most probably a matter of the opc template because all calculations by awocoupon are done correctly. He advised that the opc is showing the salespricecoupon, which shows the overall discount including tax savings instead of couponvalue, which shows no tax amount.

The interesting thing is that in the order confirmation email, the coupon discount value is still wrong (calculated after tax and not before tax)

Would appreciate your comments and advice!

Rgrds,
Chris
Attachments
ea4gtg.png
ea4gtg.png (22.5 KiB) Viewed 9270 times
atrus80
 
Posts: 85
Joined: Mon Feb 06, 2012 6:22 pm

Re: Wrong display for coupon discount??

Postby admin » Sat Jan 12, 2013 3:01 pm

Hello, this must be set up with the price tab of OPC backend (test all of the options for coupons). If none of the results give you a proper value, we can debug this and check if the value that you are looking for is there generated properly by AWO. OPC only shows one type of price which can be configured by the shop owner and depending on your type of shop/taxes it can be set to basePrice (usually US) or salePrice (usually EU).

The value that is indeed shown is generated by ajaxhelper.php by:
\components\com_onepage\helpers\ajaxhelper.php
Code: Select all
   if (empty($coupon_price_display)) $coupon_price_display = 'discountAmount';
   if (!empty($prices[$coupon_price_display]))
   $coupon_discount = $prices[$coupon_price_display];
   else $coupon_discount = 0;
   
   $coupon_discount = $currencyDisplay->convertCurrencyTo( $cart->paymentCurrency, $coupon_discount,false);
   


where $coupon_price_display is from the configuration of OPC in the backend and $prices are generated by default VM plugins + awo.

Best Regards,
Stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: Wrong display for coupon discount??

Postby atrus80 » Sun Jan 13, 2013 10:19 am

Hi Stan,

I tried billDiscountAmount and amountDiscount with .107 but when i choose any of them, the coupon discount field in the opc is not shown anymore. The coupon discount field is shown only if i select salespricecoupon. Is the couponvalue the same as billDiscountAmount or amountDiscount?

Using VM2.0.18a

Rgrds,
Chris
atrus80
 
Posts: 85
Joined: Mon Feb 06, 2012 6:22 pm

Re: Wrong display for coupon discount??

Postby admin » Mon Jan 14, 2013 7:05 pm

Hello Chris, in that case, i should check it over ftp as the VM adds new types of price almost by each update of VM.

As described above:
The value that is indeed shown is generated by ajaxhelper.php by:
\components\com_onepage\helpers\ajaxhelper.php

i'd like to try
Code: Select all
var_dump($prices); die();


And see which value of the $prices array is the right one for you - i will add it to the backend config. Remove this code after testing.

Best Regards,
Stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: Wrong display for coupon discount??

Postby atrus80 » Tue Jan 15, 2013 9:37 am

Hi Stan,

When i uncomment

Code: Select all
var_dump($coupon_discount); die();
in ajaxhelper.php, i just get:

float(0)

When i uncomment
Code: Select all
var_dump($coupon_price_display);
i get:

string(16) "salesPriceCoupon"

I can send you the ftp details in your gmail so that you can take a look also, if possible.

Rgrds,
Chris
atrus80
 
Posts: 85
Joined: Mon Feb 06, 2012 6:22 pm

Re: Wrong display for coupon discount??

Postby admin » Tue Jan 15, 2013 1:45 pm

Hello Chris, i added:

$coupon_price_display = 'couponValue';

\components\com_onepage\helpers\ajaxhelper.php

line 867 in your OPC version.


I also added a new type of coupon price display 'couponValue' so this can be selected with the backend configurator if needed from the next version 2.0.108. It will show the calculated coupon as set in AWO coupons.

Best Regards,
Stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: Wrong display for coupon discount??

Postby atrus80 » Wed Jan 16, 2013 9:18 am

Thanks Stan, i confirm that now the discount amount is calculated correctly ;)

Rgrds,
Chris
atrus80
 
Posts: 85
Joined: Mon Feb 06, 2012 6:22 pm


Return to One Page Checkout for Virtuemart 2