News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Data structure error in virtuemart_orders

Started by optmax, July 24, 2015, 12:53:01 PM

Previous topic - Next topic

optmax

VM 3.0.9.4
J! 3.4.3

in the database  `virtuemart_orders`.`order_shipment` has data type decimal(10,2)

I think this should be decimal(10,5)

I am not sure if `virtuemart_orders`.`order_payment` should also be should be decimal(10,5)

With the setting decimal(10,2) for order_shipment I get the following problem.

I have 'Round only display' set in pricing config.

I have a weight_countries shipment method cost £3.75 inclusive of 20% tax.

In the shipment parameters the net shipment cost is correctly stored as 3.125 but for an individual order this is stored in  `virtuemart_orders`.`order_shipment` as 3.13 along with the correct `virtuemart_orders`.`order_shipment_tax` of 0.62500

So as can be seen in the attached screen shot in the BE order view the Shipping total is displayed as £3.76 (3.13+0.625 and rounded up)

This problem carries through to the invoice and system emails.


If I change  `virtuemart_orders`.`order_shipment`  data type to decimal(10,5) the problem is solved.

I have tried enabling database tools and using 'Install/update tables' but the data type is not updated.



Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

optmax

#2
Thanks Milbo.

But...

Before I mark thread SOLVED there is another related display problem;

As can be seen in first attached screenshot...

With the same shipment method described above

With data type 10,5 for order_shipment the shipment total is correct.

But in some cases, eg order_shipment 3.125 order_shipment_tax 0.62500, where both displayed values will have been rounded up

the sum of the displayed values 3.13 + 0.63 does not equal the correctly displayed shipment total 3.75


I have a work round:
subtract 0.005 from the order_shipment_tax before displaying it.

So in the BE order view order.php (or its override) in the COM_VIRTUEMART_ORDER_PRINT_SHIPPING section
Change line 663
from
<td  align="right" style="padding-right: 5px;"><?php echo $this->currency->priceDisplay($this->orderbt->order_shipment_tax); ?>
to
<td  align="right" style="padding-right: 5px;"><?php echo $this->currency->priceDisplay($this->orderbt->order_shipment_tax 0.005) ; ?>

Second screen shot shows result of this work round