error? coupon equal to sales price


  • Your avatar
    seyi    
     4 years ago
    0

    joomla 2.5, vm 2.0.6

    if a customer redeems a coupon for 100% of the value, so price is equal to $0 and clicks next i get

    * Info: Payment Amount not valid for Paypal

    Thank you for your order!
    Your order has been processed.

    i know the awo coupon works 100% but i am desperate for help.
    vm forums hinted at this fix but it refers to vm 2.0.2 only and unable to get it working on 2.0.6.


    "This worked perfectly. I did make one change. Below is what I have In plugins/vmpayment/paypal/paypal.php starting at about line 252"
    Code: [Select]

    <?php
    //     2 = don't delete the cart, don't send email and don't redirect
            //return $this->processConfirmedOrderPaymentResponse(2, $cart, $order, $html, $dbValues['payment_name'], $new_status);
            // coupon mod by Supermac begins, also commented out line 253
            
    if ($totalInPaymentCurrency ){
                return 
    $this->processConfirmedOrderPaymentResponse(2$cart$order$html$dbValues['payment_name'], $new_status);
            } else {
                
                
    $html '' "\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 .= '' "\n";
                
                return 
    $this->processConfirmedOrderPaymentResponse(true$cart$order$html$dbValues['payment_name'],'C');
            }
            
    // coupon mod by Supermac ends
    ?>
  • Your avatar
    seyi    
     4 years ago
    0

    The question I have is why do you even have a paypal pament option when the order total is 0? In vm1, virtuemart was smart enough to skip the payment method all together if the total is 0. In any case, looking at the code, I updated the modification you posted. Not tested, hope it works

    <?php
        
    //     2 = don't delete the cart, don't send email and don't redirect
        //$cart->_confirmDone = false;
        //$cart->_dataValidated = false;
        //$cart->setCartIntoSession();
        //JRequest::setVar('html', $html);
        // coupon mod by Supermac begins, also commented out line 257, updated by Seyi
        
    if ($totalInPaymentCurrency ){
            
    $cart->_confirmDone false;
            
    $cart->_dataValidated false;
            
    $cart->setCartIntoSession();
            
    JRequest::setVar('html'$html);
        } else {
                
            
    $html '' "\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 .= '' "\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$ordertrue);
            
            
    $order['paymentName']= $dbValues['payment_name'];
            
    //We delete the old stuff
            
    $cart->emptyCart();
            
    JRequest::setVar('html'$html);
        }
        
    // coupon mod by Supermac ends update by Seyi
    ?>
  • Default avatar
    joel04    
     4 years ago
    0

    you are absolutely right, vm1 was smart enough to complete a zero cost transaction. i am tryingto duplicate the same when my clients redeem a 100% coupon/certificate.
    unless im mistaken i must have a payment option (plugin) enabled to complete the transaction, by default i had paypal so thats why i was looking at code tweaks to make that work.
    is there a better way?
    ps: sorry, the code above produced same error of "Info: Payment Amount not valid for Paypal"
  • Your avatar
    seyi    
     4 years ago
    0

    The best solution is to find the code in the core and fix it. The easy fix is fix paypal, and that is what I have done. Undo the previous code and search for this line, should be around line 149
    <?php
    if ($totalInPaymentCurrency 
    ?>


    As you can see, paypal is checking to see if the total is 0 or less than zero and returning an error, before getting to the other code. So change the above to this:
    <?php
    if ($totalInPaymentCurrency 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 .= '' "\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$ordertrue);
            
    $order['paymentName']= $dbValues['payment_name'];
            
    //We delete the old stuff
            
    $cart->emptyCart();
            
    JRequest::setVar('html'$html);
            return 
    false;
    }
    ?>


    This time I tested it out of curiosity, it works.
  • Default avatar
    joel04    
     4 years ago
    0

    cant tell you how much i appreciate you looking into this and going aboe and beyond. thank you!
    with the above fix i am able to complete transactions with 100% coupon!
    i am going through forums now on how to customize the confirm page to not show :


    * Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order
    * Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order
    * Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order

    and as soon as i have this i'll repost the fix here.
    again, you have been a lifesaver
  • Default avatar
    anaffelici    
     4 years ago
    0

    Some news about how to fix it?

    I have this message in the confirm page:


    Warning: array_push() [function.array-push]: First argument should be an array in /home/artedevoar/new.artedevoar.com/libraries/tcpdf/tcpdf.php on line 21357
  • Your avatar
    seyi    
     4 years ago
    0

    Not sure what the cause is, try searching virtuemart forum. Here is one post i found on the error:
    http://forum.virtuemart.net/index.php?topic=101483
  • Default avatar
    anaffelici    
     4 years ago
    0

    Thank you very much seyi !

    I'll take a look ;)

    About this other system messages? Some idea how to solve it?


    * Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order
    * Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order
    * Info: Attention, #__virtuemart_payment_plg_paypal has not any entry for the order
  • Your avatar
    seyi    
     4 years ago
    0

    look for the string "has not any entry for the order" inside www/administrator/components/com_virtuemart/plugins/vmpsplugin.php
  • Default avatar
    jheuser    
     4 years ago
    0

    I just now followed the instructions for the fix of having a coupon that is the same price as the item.

    Thank you for posting that.

    I get this error now.

    #__virtuemart_payment_plg_paypal has not any entry for the order


    You had hinted to look in the file, what do I do once I find it?

    Thank you.

  • Your avatar
    seyi    
     4 years ago
    0

    you can comment out the warning so it does not appear anymore, like so:
    <?php
            
    //vmWarn ('Attention, ' . $this->_tablename . ' has not any entry for the order ' . $db->getErrorMsg ());
    ?>
  • Default avatar
    diem28    
     4 years ago
    0

    Hi I'm having a problem with 100% off coupons too. The code above totally broke my site. all but the home page would not show. Not sure why. Is there another solution?
  • Your avatar
    seyi    
     4 years ago
    0

    not that I know of, you should search/post in the Virtuemart forum.
  • Default avatar
    diem28    
     4 years ago
    0

    Thanks for the prompt response, I have been looking at the joomla and the vm forums and have not found a solution. Yours was the best bet! could I possibly pm you and ask you to take a look at why this code would break my site while others are not reporting the same problem?
  • Your avatar
    seyi    
     4 years ago
    0

    they are not. It should not break your site in any way. Yes you can pm me temporary admin/ftp access and I can look at it.
  • Your avatar
    seyi    
     4 years ago
    0

    Hello,

    I have added to the code to your site, tested it and it works. Maybe when adding it you also added the <\?php and ?> tags, if so yes, that would break your site.
  • Default avatar
    diem28    
     4 years ago
    0

    thank you seyi, i'll check it out and report back! (again, feels like I was the only one having problems).
  • Default avatar
    diem28    
     4 years ago
    0

    Hello Seyi - I just ran a test. IT WORKED!!! THANK YOU!

    A couple of notations. I have two payment options for my site. 1 - GO to paypal and 2 - STAY and pay on site (which is paypal pro). It did not work if the user chose to stay on site (because it did not see the user's cc number). It worked FINE if user choose to go with paypal. My solution, default user to paypal option - easy. :)

    that's it! thank you.

  • Your avatar
    seyi    
     3 years ago
    0

    Posted a true solution for any payment method here:
    http://awodev.com/forum/awocoupon/help-section/coupon-code-exceeds-amount-wont-allow-payment-method-or-ship#comment-4081