News:

Support the VirtueMart project and become a member

Main Menu

Checkout Calculation of Payment Metods error.

Started by jimmyisthebest, June 27, 2014, 14:31:59 PM

Previous topic - Next topic

jimmyisthebest

Hello there! My name is Sergio, I'm new and came with the following question:
When you set a minimum price on a method of payment in VM2, the minimum setting is applied to the product price, not the total purchase.
ie my idea: I have to make a 100% coupon discount, 0 € and with that value method 'Free' pay out.

Adjusted PayPal and Bank transfer (which are the two I have) to display from 0.01 cent.

And "Free" from 0 to 0.01 cent.

So far so simple that does not meet except for that in the code, which makes the calculation detects the price before the coupon, ie the price of the article, if this article is 10 € and PayPal Transfer out. that are more than 0.01 cent, though € coupon of 0 is applied.

We are in the total purchase is 0 € and all methods of payment is.

That play code for the calculation methods AFTER payment is made to apply the coupon.

I would do a big favor because I have not gotten out, that's all I have left.

thank you


SPANISH

Hola! me llamo Sergio, soy nuevo y venia con la siguiente pregunta:
Cuando ajustas un precio mínimo a un método de pago en VM2 , este ajuste mínimo se aplica al precio del producto, no al total de la compra.
es decir, mi idea: tengo que hacer un cupón de 100% de descuento, 0€ y que con ese valor salga un método de pago 'Gratis'.

Ajusto PayPal y transferencia bancaría (que son los dos que tengo) para que se muestren a partir de 0,01cent.

Y "Gratis" de 0 a 0,01cent.

Hasta aquí todo sencillo salvo que no cumple, por que en el código, el cálculo que hace detecta el precio antes de aplicar el coupon, es decir el precio del articulo, si este articulo son 10€ salen PayPal y Transf. por que son mas de 0,01cent, aunque se aplique el cupon de 0€.

Estamos en que el total de la compra es 0€ y se muestran todos los metodos de pago.

Que tocar en código para que el calculo de los métodos de pago se realice DESPUÉS de aplicar el cupón.

Me haríais un gran favor por que no he conseguido sacarlo, es lo único que me queda.

gracias

seyi

Hello,

I believe this problem got fixed in virtuemart 2.0.24.  This code below is taken directly from vm 2600.  You would need to add the code for each payment method you what it to apply to.

in www/plugins/vmpayment/[PAYMENT_METHOD_NAME]/[PAYMENT_METHOD_NAME].php, within the class you can add the function

<?php
function 
getCartAmount($cart_prices){
if(empty($cart_prices['salesPrice'])) $cart_prices['salesPrice'] = 0.0;
$cartPrice = !empty($cart_prices['withTax'])? $cart_prices['withTax']:$cart_prices['salesPrice'];
if(empty($cart_prices['salesPriceShipment'])) $cart_prices['salesPriceShipment'] = 0.0;
if(empty($cart_prices['salesPriceCoupon'])) $cart_prices['salesPriceCoupon'] = 0.0;
$amount$cartPrice $cart_prices['salesPriceShipment'] + $cart_prices['salesPriceCoupon'] ;
if ($amount <= 0$amount=0;
return $amount;

}

?>



and in the function checkconditions, your test should look like this

<?php
$amount $this->getCartAmount($cart_prices);
 
$amount_cond = ($amount >= $method->min_amount AND $amount <= $method->max_amount
OR
($method->min_amount <= $amount AND ($method->max_amount == 0)));
if (!$amount_cond) {
return FALSE;
}
?>

Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate