Contribution - Price per KG under Price almost finished help
Salvo <[email protected]> 12 Sep 2003 10:50:01 -0000
| Newsgroups | gmane.comp.web.oscommerce.general |
|---|---|
| Message-ID | <65f025d08652f2314fc074bda4a681df@osCommerce-Forums> |
This message was sent from: General Support
http://forums.oscommerce.com/viewtopic.php?p=228335#228335
----------------------------------------------------------------
Hi all
This is a small contribution which is finished for shop with one currency, but for shops that use more than one currency, it is not quite finished and I need some help here.
Calculating the Price per KG of a product and show it in the products_info_php page under the Price.
UK Pound or whatever...
Kg = 1000 gr
From weight field = 500 gr
From price field = 0.89
The actual formula would be: 1000 / 5000 = 2 x 0.89 = 1.78
see below
<?php
// salvo added to show by the KG/LT
if ($product_info['products_weight'] > 0) {
$KG_LT = round((1000/$product_info['products_weight'])*($product_info[products_price]), 2);
echo '(', $currency, ' ', $KG_LT, ' ', per, ' ', Kg./Lt.')';
} else {
};
?>
And This works very very Well (GBP 1.78 per Kg)
The Problem would be if one has two or more currency
I chage the currency to Euro and it shows:
Euro Price = 1.25 (this is fine)
price per KG (EUR 1.78 per Kg) this should be EUR 2.50
This means that there is something in the formula NOT correct
Can someone help?
Thanks