Author Topic: [SOLVED] Order total in Print View is wrong?  (Read 2650 times)

ronze

  • Beginner
  • *
  • Posts: 42
[SOLVED] Order total in Print View is wrong?
« on: September 16, 2008, 10:06:19 am »
Hey everyone

When looking at an order in the backend, it costs 269$, includinx tax and shipping tax.

But when I press the "Print View" the total is without shipping tax.

Is this a bug, and can I do anything?

 - Rune

ronze

  • Beginner
  • *
  • Posts: 42
Re: [SOLVED] Order total in Print View is wrong?
« Reply #1 on: September 16, 2008, 10:44:12 am »
Okay, I serached around the forum, and it seems like it is a bug in Virtuemart.

Problem: "Print View" doesn't show shipping tax, and therefore you get a lower order total than on the "Order View" page. Not good, if you're printing your orders from "Print View".

Solution:

Find the file administrator/components/com_virtuemart/html/order.order_printdetails.php

Find the following section:
Code: [Select]
<tr>
<td colspan="4" align="right"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX'?> :</td>
<td align="right"><?php 

$tax_total 
$db->f("order_tax")+ $db->f("order_shipping_tax");
echo 
$CURRENCY_DISPLAY->getFullValue($tax_total''$db->f('order_currency'));

?>
&nbsp;&nbsp;&nbsp;</td>
</tr>

<tr>
<td colspan="4" align="right">
<?php if (PAYMENT_DISCOUNT_BEFORE == '1') { ?><strong><?php 

echo 
$VM_LANG->_('PHPSHOP_CART_TOTAL') .":"; if (PAYMENT_DISCOUNT_BEFORE != '1') { ?>
</strong><?php ?></td>

<td align="right"><?php 
if (PAYMENT_DISCOUNT_BEFORE == '1') { ?>
<strong><?php  
$total 
$db->f("order_total");
echo 
$CURRENCY_DISPLAY->getFullValue($total''$db->f('order_currency'));
}
else {
$total $db->f("order_subtotal") + $db->f("order_tax") + $db->f("order_shipping") - $db->f("coupon_discount");
echo 
$CURRENCY_DISPLAY->getFullValue($total''$db->f('order_currency'));
}
if (
PAYMENT_DISCOUNT_BEFORE == '1') { ?>
</strong><?php ?>&nbsp;&nbsp;&nbsp;</td>
</tr>

And change it to this: (I've out commented the lines I've removed)
Code: [Select]
<tr>
          <td colspan="4" align="right"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX'?> :</td>
          <td align="right"><?php 
            $tax_shipping 
$GLOBALS['CURRENCY_DISPLAY']->getFullValue($db->f("order_shipping_tax"), ''$db->f('order_currency'));
//$tax_total = $db->f("order_tax")+ $db->f("order_shipping_tax");
$tax_total $db->f("order_tax")+ $tax_shipping;
            echo 
$CURRENCY_DISPLAY->getFullValue($tax_total''$db->f('order_currency'));
//echo $GLOBALS['CURRENCY_DISPLAY']->getFullValue($db->f("order_shipping_tax"), '', $db->f('order_currency'))
            
            
?>
&nbsp;&nbsp;&nbsp;</td>
        </tr>
     
        <tr>
          <td colspan="4" align="right">
          <?php if (PAYMENT_DISCOUNT_BEFORE == '1') { ?><strong><?php 
          
          echo 
$VM_LANG->_('PHPSHOP_CART_TOTAL') .":"; if (PAYMENT_DISCOUNT_BEFORE != '1') { ?>
</strong><?php ?></td>
         
          <td align="right"><?php 
          
if (PAYMENT_DISCOUNT_BEFORE == '1') { ?>
<strong><?php  
            $total 
$db->f("order_total");
            echo 
$CURRENCY_DISPLAY->getFullValue($total''$db->f('order_currency'));
          }
          else 
  {
$total $db->f("order_total") - $db->f("coupon_discount");

echo $GLOBALS['CURRENCY_DISPLAY']->getFullValue($total''$db->f('order_currency'));
//echo $GLOBALS['CURRENCY_DISPLAY']->getFullValue($db->f("order_total"), '', $db->f('order_currency'));
          
}
          if (
PAYMENT_DISCOUNT_BEFORE == '1') { ?>
</strong><?php ?>&nbsp;&nbsp;&nbsp;</td>
        </tr>

Hope this helps others that need it :-)

** Edited November the 17th 2008 -> Added subtraction of discount

clivemorley

  • Beginner
  • *
  • Posts: 20
Re: [SOLVED] Order total in Print View is wrong?
« Reply #2 on: November 28, 2008, 11:46:03 am »
Very useful thanks very much

jeffrey-s

  • Beginner
  • *
  • Posts: 6
Re: [SOLVED] Order total in Print View is wrong?
« Reply #3 on: August 27, 2009, 10:51:39 am »
Very Useful tnks for sharing!