News:

Support the VirtueMart project and become a member

Main Menu

When the amount is $0 is asking for payment

Started by batboiko, October 02, 2012, 19:45:48 PM

Previous topic - Next topic

batboiko

I have VM2.0.10 on Joomla 2.5.7. Is there any way when the amount is $0 VM to not ask people to choose payment ?

And if this can't be done my second question is that : 

When someone order something with coupon code for 100 % off and his amount is $0 his order to be approved automatically because now this order is going directly to Pending ?

I have the third option too : When someone have 100 % off coupon code and choose to pay with PayPal he see this error : Info: Payment Amount not valid for Paypal.  How can i fix this ?

Thank you

batboiko

I change the code in paypal.php from

if ($totalInPaymentCurrency <= 0) {
vmInfo (JText::_ ('VMPAYMENT_PAYPAL_PAYMENT_AMOUNT_INCORRECT'));
return FALSE;
}


to

if ($totalInPaymentCurrency <= 0) {
        //vmInfo(JText::_('VMPAYMENT_PAYPAL_PAYMENT_AMOUNT_INCORRECT'));
   
           
        $html = '<table>' . "\n";
        $html .= $this->getHtmlRow('STANDARD_PAYMENT_INFO', $dbValues['payment_name']);
        if (!empty($payment_info)) {
            $lang = & JFactory::getLanguage();
            if ($lang->hasKey($method->payment_info)) {
            $payment_info = JText::_($method->payment_info);
            } else {
            $payment_info = $method->payment_info;
            }
            $html .= $this->getHtmlRow('STANDARD_PAYMENTINFO', $payment_info);
        }
        if (!class_exists('VirtueMartModelCurrency'))
            require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php');
        $currency = CurrencyDisplay::getInstance('', $order['details']['BT']->virtuemart_vendor_id);
        $html .= $this->getHtmlRow('STANDARD_ORDER_NUMBER', $order['details']['BT']->order_number);
        $html .= $this->getHtmlRow('STANDARD_AMOUNT', $currency->priceDisplay($order['details']['BT']->order_total));
        $html .= '</table>' . "\n";
           
        //return $this->processConfirmedOrderPaymentResponse(true, $cart, $order, $html, $dbValues['payment_name'],'C');
        $modelOrder = VmModel::getModel('orders');
        $order['order_status'] = 'C';
        $order['customer_notified'] = 1;
        $order['comments'] = '';
        $modelOrder->updateStatusForOneOrder($order['details']['BT']->virtuemart_order_id, $order, true);
        $order['paymentName']= $dbValues['payment_name'];
        //We delete the old stuff
        $cart->emptyCart();
        JRequest::setVar('html', $html);
        return false;
}


and is working . Can someone tell me if this can cost me problems ?

Thanks

alatak

Hello

Just set up a payment method for order amount=0 and another one for order amount >0.1

batboiko

Hi ,

This not going to help me with PayPal . You can't proceed if the amount is $0.


concap

Quote from: alatak on October 04, 2012, 08:13:31 AM
Hello

Just set up a payment method for order amount=0 and another one for order amount >0.1

Hi alatak, I've tried your suggestion.  I've set
- 1 payment method min amount 0, max amount 0.9
- 2 payment method min amount 1

However order amount on payment method is not working with Coupon discount. Which means if Product costs 20$ and coupon is 20$ then payment method 1 is not selected for VM payment amount is still $20

Can you advise how to fix it?

alatak

Hello

QuoteHowever order amount on payment method is not working with Coupon discount. Which means if Product costs 20$ and coupon is 20$ then payment method 1 is not selected for VM payment amount is still $20
yes it is true, the condition is done on the ptoduct total, not on the order total

in  file plugins/vmpayment/paypal/paypal.php
change (around line 917 function checkConditions)
$amount = $cart_prices['salesPrice'];
with
$amount = $cart->pricesUnformatted['billTotal'];

and then the coupon discount ill be included