Post by craftyhobbies » Mon Jan 23, 2012 4:45 am

Hi iam havin some difficulties with my site, when you add a product to your shoppin cart it shows the weight as 11g but should be 109g and for some strange reason it keeps rounding the figures up and not showing the 3 figures it should
ie product weighs 0.109g but when in admin or cart it only reads 0.11g so shipping not working properly.
i have tried looking files to find the answer but now going insane.
have set site to g for weight and localisation to kg1.000 and g to 0.001 (and have tried 0.01).
any advice would be greatly welcome as this is the only thing now stopping us to adding our products
many thanks
john :crazy:

Newbie

Posts

Joined
Sat Dec 31, 2011 9:38 pm

Post by OpenCart Addons » Mon Jan 23, 2012 8:09 am

Hey John,

In system / library / weight.php
Find:

Code: Select all

return number_format($value, 2, $decimal_point, $thousand_point) . $this->weights[$weight_class_id]['unit'];
		} else {
			return number_format($value, 2, $decimal_point, $thousand_point);
Change To:

Code: Select all

return number_format($value, 3, $decimal_point, $thousand_point) . $this->weights[$weight_class_id]['unit'];
		} else {
			return number_format($value, 3, $decimal_point, $thousand_point);
And that should fix your problem.

Regards,
Joel.

Canada's Leading Expert In OpenCart Development & Certified OpenCart Development Partner Image


User avatar
Active Member

Posts

Joined
Thu Nov 24, 2011 10:51 am
Location - Canada

Post by craftyhobbies » Wed Jan 25, 2012 3:48 am

Hey Joel
thats awsome have been looking for this for what felt like an eternity.
Now my wife will be pleased as this is her site and after being messed by a few people we are going it alone.
Thanks again and will let people know if they also get the same problem.
Its also good to know that there is still some honest and genuine people out there cheers ;D
john

Newbie

Posts

Joined
Sat Dec 31, 2011 9:38 pm

Post by HorseMagic » Fri Feb 03, 2012 12:32 pm

I am a newbie with open cart and having problems with this too, I added the code but it doesn't seem to be changing the outcome, just seems to do my head in by going around in circles :D

Hope someone can see what I am doing wrong...

I am wanting to use grams up and up to kilograms, we sell per metre - webbing, we have one that weighs 45grams per metre but it keeps rounding to 50grams, so when you buy say 100 metres it should be 4.5kg weight but instead it will be 5kg?

I am entering it to product like this 0.045
then it changes to 0.05

It doesn't seem to matter whether I use grams or kg the end result is the same.

Then to top it off if I go through the checkout selecting 100 metres it shows the shipping option of "standard" that I set up that only goes to 3kg and yet it clearly says in checkout the weight is 5kg?

I have Version 1.5.1.3

Anita


User avatar
New member

Posts

Joined
Sat Jan 21, 2012 1:55 pm
Location - Australia

Post by Stevecuns » Fri Feb 03, 2012 9:50 pm

Had similar problem. I set my global shop weight to grams. Then each product set to grams. Then enter each product weight as grams ie 45 (not 0.045kg). Along with the code in above post & all seems to be calculating correctly.

hope this helps, im a noobie too & just starting to get into it.

good luck

Steve.....

Newbie

Posts

Joined
Thu Jan 26, 2012 4:31 am

Post by HorseMagic » Fri Feb 03, 2012 10:07 pm

Hi Steve,

Thank you for your reply.

I tried what you have done but unfortunately it isn't working, the 45 grams comes up as 45kg when a large order goes through then when I go back to have a look it says 45.00.

I have searched high and low on the boards and google, for nearly 12 hours I am trying to figure this out, still no closer :(

Anita


User avatar
New member

Posts

Joined
Sat Jan 21, 2012 1:55 pm
Location - Australia

Post by webvet » Fri Feb 03, 2012 11:29 pm

HorseMagic wrote: I tried what you have done but unfortunately it isn't working, the 45 grams comes up as 45kg when a large order goes through then when I go back to have a look it says 45.00.
The weight system does work! Honest!

Changing the number of decimal points as in previous postings should help resolve rounding issues - but to enter one unit of weight and then display another you have to make sure that both the global weight setting is correct AND the options within the individual store are set to the same.

1. Is your Admin > System > Localisation > Weight classes set properly (with '1' in which unit you choose as default)

2. Is your Admin > System > Settings > Your Store > Local tab set to the same units?

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by HorseMagic » Sat Feb 04, 2012 4:30 am

Many thanks for your help...
The weight system does work! Honest!
I believe you but I am beginning to think if your not a coder or very technical type then getting opencart to work is not going to happen any time soon.
Changing the number of decimal points as in previous postings should help resolve rounding issues
No it didn't ???
1. Is your Admin > System > Localisation > Weight classes set properly (with '1' in which unit you choose as default)
2. Is your Admin > System > Settings > Your Store > Local tab set to the same units?

This may be where the problem lies, yes i have this set same as the next one you mention however it is doing grams and kilograms as default, I can't change either of them so they both say 1.00000000, I have tried to change this around but both keep defaulting to same.

I have tried all sorts of different settings, I have a log of errors which I have found only one other person to have similar and they post on OpenCart 1.5.1.3 Bug Thread, I couldn't see a fix for it, I have asked late last night or was it early hours this morning, hoping for reply.

Anita


User avatar
New member

Posts

Joined
Sat Jan 21, 2012 1:55 pm
Location - Australia

Post by OpenCart Addons » Sat Feb 04, 2012 10:49 am

Hey HorseMagic,

I fixed this for you while I was looking at your shipping.


Regards,
Joel.

Canada's Leading Expert In OpenCart Development & Certified OpenCart Development Partner Image


User avatar
Active Member

Posts

Joined
Thu Nov 24, 2011 10:51 am
Location - Canada

Post by HorseMagic » Sat Feb 04, 2012 12:14 pm

OMG You are awesome Joel, thank you so much for all your help, and special thanks for your time and patience to teach.

What can I say but Amazing Guy :)

Anita


User avatar
New member

Posts

Joined
Sat Jan 21, 2012 1:55 pm
Location - Australia

Post by cnees » Mon Feb 06, 2012 11:02 am

HorseMagic wrote:Many thanks for your help...
The weight system does work! Honest!
I believe you but I am beginning to think if your not a coder or very technical type then getting opencart to work is not going to happen any time soon.
Changing the number of decimal points as in previous postings should help resolve rounding issues
No it didn't ???
1. Is your Admin > System > Localisation > Weight classes set properly (with '1' in which unit you choose as default)
2. Is your Admin > System > Settings > Your Store > Local tab set to the same units?

This may be where the problem lies, yes i have this set same as the next one you mention however it is doing grams and kilograms as default, I can't change either of them so they both say 1.00000000, I have tried to change this around but both keep defaulting to same.

I have tried all sorts of different settings, I have a log of errors which I have found only one other person to have similar and they post on OpenCart 1.5.1.3 Bug Thread, I couldn't see a fix for it, I have asked late last night or was it early hours this morning, hoping for reply.

I'm having the same kind of weight issue. My products range from 1g - 11g each. The fedex mod i'm using requires the system to run in lbs so i have all the products set in lbs as well. Seems that the rounding issue is my problem but when I tried the decimal fix above i get the same results (it only saves weights at two decimal places ex. 0.01). All my system weights are set to 1.00000. The rate starts doubling or more as i add more items but i'm only adding items that weigh grams not pounds... Well maybe not since it seems i can't enter more than two decimal spots. I'm hoping someone can assist me so I'm not spending hours working on this tomorrow.

Any ideas?
Thank you in advance!

Newbie

Posts

Joined
Mon Feb 06, 2012 10:52 am

Post by webvet » Mon Feb 06, 2012 8:17 pm

cnees wrote: Well maybe not since it seems i can't enter more than two decimal spots. I'm hoping someone can assist me so I'm not spending hours working on this tomorrow.

Any ideas?
Thank you in advance!
Go to your phpMyAdmin site, and select the 'Product' table.

Find the 'Weight' field, and edit the length (set to 5,2 by default) and increase it to 5,3 or 5,4 depending on how many decimal points you require. See what effect this has on your problem.

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by HorseMagic » Tue Feb 07, 2012 4:27 am

I'm having the same kind of weight issue. My products range from 1g - 11g each. The fedex mod i'm using requires the system to run in lbs so i have all the products set in lbs as well. Seems that the rounding issue is my problem but when I tried the decimal fix above i get the same results (it only saves weights at two decimal places ex. 0.01). All my system weights are set to 1.00000. The rate starts doubling or more as i add more items but i'm only adding items that weigh grams not pounds... Well maybe not since it seems i can't enter more than two decimal spots. I'm hoping someone can assist me so I'm not spending hours working on this tomorrow.

Any ideas?
Thank you in advance!
Well for me I thought I had it correct but I did not have it set to grams in store settings which I think is where it messed up my grams and kilograms, both went value = 1.0000,.
Once I had my settings changed correctly it went as below which it should have been.
g - value = 1.0000
kg - value = 0.001

The other thing I had wrong was I had ' , ' at the beginning and end of each sets of rates which totally messed it up. Joel helped me heaps :)

Anita


User avatar
New member

Posts

Joined
Sat Jan 21, 2012 1:55 pm
Location - Australia

Post by outoftheordinary » Fri Nov 23, 2012 3:20 pm

OpenCart Addons wrote:Hey John,

In system / library / weight.php
Find:

Code: Select all

return number_format($value, 2, $decimal_point, $thousand_point) . $this->weights[$weight_class_id]['unit'];
		} else {
			return number_format($value, 2, $decimal_point, $thousand_point);
Change To:

Code: Select all

return number_format($value, 3, $decimal_point, $thousand_point) . $this->weights[$weight_class_id]['unit'];
		} else {
			return number_format($value, 3, $decimal_point, $thousand_point);
And that should fix your problem.

Regards,
Joel.

I just want to say thank you for being so helpful.

outoftheordinary


New member

Posts

Joined
Sun Nov 18, 2012 11:28 am

Post by santura » Sun Jun 16, 2013 6:10 pm

I am having this same issue. I have checked all my weight settings as described above. But still no joy. So I guess I have to make the changes to weight.php

I'm a newbie, so please excuse my ignorance.

If I edit weight.php and then upgrade won't the changes be overwritten?

I have vqmod installed which I understood was to stop this happening, but I have no idea how to use it to edit this script safely.

Any help would be much appreciated. Using version 1.5.5.1

New member

Posts

Joined
Fri Jun 14, 2013 8:33 pm

Post by webvet » Sun Jun 16, 2013 6:29 pm

santura

If you edit the weight.php file directly then it will be overwritten during an upgrade.

If you want to use vQmod to make the change for you, it will need a vQmod (xml file) to make the changes on-the-fly. This will leave your core weight.php untouched, and (assuming the lines of code exist after an upgrade) the vQmod should still work.

Hope that makes sense?

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by santura » Sun Jun 16, 2013 7:09 pm

Thanks that does make sense, but how do I do it? I have read all the documentation - maybe I am missing something - but I can't find any instructions as to how to use vqmod to actually do this.

New member

Posts

Joined
Fri Jun 14, 2013 8:33 pm

Post by webvet » Sun Jun 16, 2013 9:17 pm

santura - I'll upload the vQmod for you later on this thread, just let me know if you are playing around and figure it out first (unfortunately I am busy for the next few hours)...

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by webvet » Mon Jun 17, 2013 4:32 am

Ok - I haven't changed anything from Joel from OpenCart AddOns in earlier posts (so no credit at all to me!) but just put it into an .xml file for use as a vQmod:

Just upload into your 'vqmod/xml' folder and it should work fine. Increases the number of digits after the decimal point from 2 to 3 in the shopping cart page.

Let me know if any problems - I have checked it in my v1.5.4.1 site and appears to work fine.

Genuine, Honest Opencart Support @ http://webvetservices.com


User avatar
Active Member

Posts

Joined
Thu May 14, 2009 2:04 am
Location - Shropshire, UK

Post by santura » Mon Jun 17, 2013 5:25 am

Thanks so much for doing that, I have learned a lot by looking at the file.

Unfortunately though my problem is still not fixed - my 401g item which was showing as 401.20g in the shopping cart now shows up as 401.200g

New member

Posts

Joined
Fri Jun 14, 2013 8:33 pm
Who is online

Users browsing this forum: No registered users and 94 guests