News:

Looking for documentation? Take a look on our wiki

Main Menu

Coupon value especially for 3rd party invoicing/billing

Started by GJC Web Design, December 14, 2013, 12:10:27 PM

Previous topic - Next topic

GJC Web Design

Had this problem:

after a VM upgrade to 2.0.24c the clients 3rd party billing system started adding coupon value instead of subtracting.

Traced to after version 2.0.22a the coupon calc code in administrator\components\com_virtuemart\helpers\calculationh.php changed from

v2.0.22a
$this->_cartPrices['salesPriceCoupon'] = ($_value_is_total ? $_data->coupon_value : ($this->_cartPrices['salesPrice'] * ($_data->coupon_value / 100))

to

$this->_cartPrices['salesPriceCoupon'] = ($_value_is_total ? $_data->coupon_value * -1 : ($this->_cartPrices['salesPrice'] * ($_data->coupon_value / 100)) * -1

so the figure stored in the order tables then becomes negative where as before it was positive..

the billTotal var changes as well from 2.0.22a

$this->_cartPrices['billTotal'] = $this->_cartPrices['salesPriceShipment'] + $this->_cartPrices['salesPricePayment'] + $this->_cartPrices['withTax'] - $this->_cartPrices['salesPriceCoupon'];

to

$this->_cartPrices['billTotal'] = $this->_cartPrices['salesPriceShipment'] + $this->_cartPrices['salesPricePayment'] + $this->_cartPrices['withTax'] + $this->_cartPrices['salesPriceCoupon'];

so either hack this code back or you need to change the way the 3rd party billing script handles it

If changed back you can still show the value as negative in the cart display by

<td class="coupondetail" align="right">-<?php echo $this->currencyDisplay->createPriceDiv('salesPriceCoupon',''$this->cart->pricesUnformatted['salesPriceCoupon'],false); ?> </td>

and

.PricesalesPriceCoupon {
display:inline !important;
}


which gives -$50.00   instead of the very odd   $-50.00
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

lindapowers

Seems something was changed in this version also refering to the coupon,  the coupon here is finally subtracted from the base price instead of the total?