Hello,
I submitted a patch to Virtuemart to get this fixed and should show up in the next version. If you would like it now, here it is, this is Virtuemart 2.0.14:
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
}
}
?>
change it to this
<?php
private function confirmedOrder() {
//Just to prevent direct call
if ($this->_dataValidated && $this->_confirmDone) {
{ # seyi_code zero order total
$prices = $this->getCartPrices();
if($prices['billTotal']<=0) $this->virtuemart_paymentmethod_id = 0;
}
$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
if($prices['billTotal']<=0) { # seyi_code zero order total
$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
$this->emptyCart();
}
}
}
?>
around line 844 is this code
<?php
//Test Payment and show payment plugin
if (empty($this->virtuemart_paymentmethod_id)) {
return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=editpayment' , $redirectMsg);
} else {
if(!class_exists('vmPSPlugin')) require(JPATH_VM_PLUGINS.DS.'vmpsplugin.php');
JPluginHelper::importPlugin('vmpayment');
//Add a hook here for other payment methods, checking the data of the choosed plugin
$dispatcher = JDispatcher::getInstance();
$retValues = $dispatcher->trigger('plgVmOnCheckoutCheckDataPayment', array( $this));
foreach ($retValues as $retVal) {
if ($retVal === true) {
break; // Plugin completed succesful; nothing else to do
} elseif ($retVal === false) {
// Missing data, ask for it (again)
return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=editpayment' , $redirectMsg);
// NOTE: inactive plugins will always return null, so that value cannot be used for anything else!
}
}
}
?>
change it to this
<?php
$prices = $this->getCartPrices(); # seyi_code zero order total
if($prices['billTotal']>0) {
//Test Payment and show payment plugin
if (empty($this->virtuemart_paymentmethod_id)) {
return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=editpayment' , $redirectMsg);
} else {
if(!class_exists('vmPSPlugin')) require(JPATH_VM_PLUGINS.DS.'vmpsplugin.php');
JPluginHelper::importPlugin('vmpayment');
//Add a hook here for other payment methods, checking the data of the choosed plugin
$dispatcher = JDispatcher::getInstance();
$retValues = $dispatcher->trigger('plgVmOnCheckoutCheckDataPayment', array( $this));
foreach ($retValues as $retVal) {
if ($retVal === true) {
break; // Plugin completed succesful; nothing else to do
} elseif ($retVal === false) {
// Missing data, ask for it (again)
return $this->redirecter('index.php?option=com_virtuemart&view=cart&task=editpayment' , $redirectMsg);
// NOTE: inactive plugins will always return null, so that value cannot be used for anything else!
}
}
}
}
?>
Then in your template, the default his here
www/components/com_virtuemart/views/cart/tmpl/default_pricelist.php
but you may have it overriden, in which case it will be here
www/templates/[your_template_name]/html/com_virtuemart/cart/tmpl/default_pricelist.php
around line 338 is this
<tr class="sectiontableentry1">
<?php if (!$this->cart->automaticSelectedPayment) { ?>
<td colspan="4" align="left">
<?php echo $this->cart->cartData['paymentName']; ?>
<br/>
<?php if (!empty($this->layoutName) && $this->layoutName == 'default') {
echo JHTML::_ ('link', JRoute::_ ('index.php?view=cart&task=editpayment', $this->useXHTML, $this->useSSL), $this->select_payment_text, 'class=""');
} else {
JText::_ ('COM_VIRTUEMART_CART_PAYMENT');
} ?> </td>
</td>
<?php } else { ?>
<td colspan="4" align="left"><?php echo $this->cart->cartData['paymentName']; ?> </td>
<?php } ?>
<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo "<span class='priceColor2'>" . $this->currencyDisplay->createPriceDiv ('paymentTax', '', $this->cart->pricesUnformatted['paymentTax'], FALSE) . "</span>"; ?> </td>
<?php } ?>
<td align="right"><?php // Why is this commented? what is with payment discounts? echo "<span class='priceColor2'>".$this->cart->pricesUnformatted['paymentDiscount']."</span>"; ?></td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPricePayment', '', $this->cart->pricesUnformatted['salesPricePayment'], FALSE); ?> </td>
</tr>
change it to this
<tr class="sectiontableentry1">
<?php if ($this->cart->pricesUnformatted['billTotal']>0) { # seyi_code zero order total ?>
<?php if (!$this->cart->automaticSelectedPayment) { ?>
<td colspan="4" align="left">
<?php echo $this->cart->cartData['paymentName']; ?>
<br/>
<?php if (!empty($this->layoutName) && $this->layoutName == 'default') {
echo JHTML::_ ('link', JRoute::_ ('index.php?view=cart&task=editpayment', $this->useXHTML, $this->useSSL), $this->select_payment_text, 'class=""');
} else {
JText::_ ('COM_VIRTUEMART_CART_PAYMENT');
} ?> </td>
</td>
<?php } else { ?>
<td colspan="4" align="left"><?php echo $this->cart->cartData['paymentName']; ?> </td>
<?php } ?>
<?php if (VmConfig::get ('show_tax')) { ?>
<td align="right"><?php echo "<span class='priceColor2'>" . $this->currencyDisplay->createPriceDiv ('paymentTax', '', $this->cart->pricesUnformatted['paymentTax'], FALSE) . "</span>"; ?> </td>
<?php } ?>
<td align="right"><?php // Why is this commented? what is with payment discounts? echo "<span class='priceColor2'>".$this->cart->pricesUnformatted['paymentDiscount']."</span>"; ?></td>
<td align="right"><?php echo $this->currencyDisplay->createPriceDiv ('salesPricePayment', '', $this->cart->pricesUnformatted['salesPricePayment'], FALSE); ?> </td>
<?php } ?>
</tr>
Thats it
There is also a paypal solution if you prefer:
https://awodev.com/forum/awocoupon/help-section/error-coupon-equal-sales-price#comment-2981