Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Contribution - Price per KG under Price almost finished help


Salvo

Recommended Posts

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...