VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Cotec on September 11, 2013, 03:53:07 AM

Title: Virtuemart Confirm not working?
Post by: Cotec on September 11, 2013, 03:53:07 AM
TO get the Coupon's and Paypal to work for free orders I had to use a custom script.  Basiclly if I do not then virtuemart will always put it in "pending" With the script it will make the order "completed"

So here is the original:

in www/components/com_virtuemart/helpers/cart.php,
around line 943 is this function

<?php
    
private function confirmedOrder() {
       

//Just to prevent direct call
        
if ($this->_dataValidated && $this->_confirmDone) {
           

$orderModel VmModel::getModel('orders');
            if ((

$orderID $orderModel->createOrderFromCart($this)) === false) {
                
$mainframe JFactory::getApplication();
                
JError::raiseWarning(500'No order created '.$orderModel->getError());
                
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart') );
            }
            
$this->virtuemart_order_id $orderID;
            
$order$orderModel->getOrder($orderID);
           

$dispatcher JDispatcher::getInstance();
           

JPluginHelper::importPlugin('vmshipment');
            
JPluginHelper::importPlugin('vmcustom');
            
JPluginHelper::importPlugin('vmpayment');
            
$returnValues $dispatcher->trigger('plgVmConfirmedOrder', array($this$order));
            
// may be redirect is done by the payment plugin (eg: paypal)
            // if payment plugin echos a form, false = nothing happen, true= echo form ,
            // 1 = cart should be emptied, 0 cart should not be emptied
       

}
    }

?>


Here is the custom:

<?php
    
private function confirmedOrder() {
       

//Just to prevent direct call
        
if ($this->_dataValidated && $this->_confirmDone) {
           

$orderModel VmModel::getModel('orders');
            if ((

$orderID $orderModel->createOrderFromCart($this)) === false) {
                
$mainframe JFactory::getApplication();
                
JError::raiseWarning(500'No order created '.$orderModel->getError());
                
$mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart') );
            }
            
$this->virtuemart_order_id $orderID;
            
$order$orderModel->getOrder($orderID);
           

$dispatcher JDispatcher::getInstance();
           

JPluginHelper::importPlugin('vmshipment');
            
JPluginHelper::importPlugin('vmcustom');
            
JPluginHelper::importPlugin('vmpayment');
            
$returnValues $dispatcher->trigger('plgVmConfirmedOrder', array($this$order));
            
// may be redirect is done by the payment plugin (eg: paypal)
            // if payment plugin echos a form, false = nothing happen, true= echo form ,
            // 1 = cart should be emptied, 0 cart should not be emptied
       

}
    }

?>


Problem is with the script on it will then trigger a problem with Download for sale. It will say "TCPDF ERROR: [Image] Unable to get image: http://www.subaqueousmusic.com/plugins/vmcustom/downloads_for_sale/downloads_for_sale/assets/download_medium.png"

Not sure why it says that. I checked and that file is exactly where it needs to be.

What is happening here?  The site is www.subaqueousmusic.com by the way.  I used the hack: http://awodev.com/forum/awocoupon-virtuemart/help-section/coupon-code-exceeds-amount-wont-allow-payment-method-or-ship#comment-4081