Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Product Weight display customization


Recommended Posts

Hello erveryone,


Since I had not much luck in the 'General Support" Forum I'll try this on. Hope somebody can help.


I'm building up a shop wit osCommerce using Version 2.2. Everything seems to work fine, but I can't find a way to change one little detail. The person I setup this shop for has mainly food & drinks as products in her online shop. She would like to use the "Product Weight" attribute to display different weights for different kind of products. E.g. 250 ml for a drink bottle or 300 grams for a steak (just some silly examples).

The way I want to have the shop is, that she simply puts something like '250 ml' or '300 grams' in the products description, when adding a new product. In the actual shop on the product info page exactly this input ('250 ml') should be displayed. At the moment the shop displays a 5,2 decimal and the measure unit I put in admin.

I already changed the database field 'products_weight' in the table 'products' to VARCHAR. I thought that would take care of it, but unfortunately if I put something like '250 ml' in, it just displays '250'.

So here is my questions (finally):

where does the input for products_weight gets checked and also changed into a number? What do I have to change in the script to get all of '250 ml' displayed?


Thanks in advance for any help.




Link to comment
Share on other sites

Alright, after hours of browsing through the code I found the solution myself. Maybe someone else is interested in it:


As said before the database field 'products_weight' in the table 'products' has to be changed to e.g. VARCHAR to store chars as well as numbers.

The second step is really easy, but it took awhile to find the right line in the code. Open up the file 'catagories.php' in /catalog/admin/ and browse to line 298. In this line the array gets set up with the values for the product. Simply remove the '(float)' in front of 'tep_db_prepare_input($HTTP_POST_VARS['products_weight']),'. This will stop the parsing of the weight value into a float.


and that's it! To easy, but took me a while to find it B)




Link to comment
Share on other sites


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

  • Create New...