bmett Posted March 23, 2010 Posted March 23, 2010 Hello erveryone, 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. Cheers Bjorn
bmett Posted March 24, 2010 Author Posted March 24, 2010 Nobody out there with an idea how to get this little fix done?
bmett Posted March 24, 2010 Author Posted March 24, 2010 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) cheers Bjorn
NodsDorf Posted March 24, 2010 Posted March 24, 2010 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) cheers Bjorn I was just going to suggest removing the weight from being displayed and add the "Size" to the description. Problem with calling that stuff weight is that ml is a measurement and 500ml of wine weights less then 500ml of liquid mercury. :) Any-who glad you found a solution.
bmett Posted March 24, 2010 Author Posted March 24, 2010 I was just going to suggest removing the weight from being displayed and add the "Size" to the description. Problem with calling that stuff weight is that ml is a measurement and 500ml of wine weights less then 500ml of liquid mercury. :) Any-who glad you found a solution. Thanks for the advice NodsDorf. The person I did this for is very happy with the way it works right now, so no need to change it :) But of course you're right, calling it weight is not 100% correct, and I'm aware that the weight attribute is initially introduced for shipping weights, but hey, this works fine now... :lol:
NodsDorf Posted March 24, 2010 Posted March 24, 2010 Happy Clients is all that counts. of course it wouldn't be to hard to change the word "weight" to "portion" which is another thought I had after you found the solution. Good job, Don
monitor Posted April 10, 2012 Posted April 10, 2012 Hi I know this is old but i need help with nodsdorf comment i want to change the word weight on my pages can anybody help me with this.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.