Big Spender Posted November 27, 2011 Share Posted November 27, 2011 Hi, I am trying to gain some information how to calculate weights correctly in version 5.0.5, all my items are weighed in grams, so my weight setting is set to 'Metric kg' instead of imperial in general settings. I have set weight on a product which is 5 grams as 0.005kg. Then upon adding the item to the cart Cube Cart rounds the weight to 0.01kg, thus making the weight incorrect, as 0.01kg is 10grams (double the intended weight) I assume this is because the system rounds up - but as far as I can see, and without a 'grams' used in the general settings it can't be achieved...? Anyone help? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 27, 2011 Share Posted November 27, 2011 Hi, I am trying to gain some information how to calculate weights correctly in version 5.0.5, all my items are weighed in grams, so my weight setting is set to 'Metric kg' instead of imperial in general settings. I have set weight on a product which is 5 grams as 0.005kg. Then upon adding the item to the cart Cube Cart rounds the weight to 0.01kg, thus making the weight incorrect, as 0.01kg is 10grams (double the intended weight) I assume this is because the system rounds up - but as far as I can see, and without a 'grams' used in the general settings it can't be achieved...? Anyone help? Try changing the value in product_weight column of the Structure of the inventory table in your database. Right now it must be set to (some number,2) - that gives 2 decimal places. Change it to 3. Mine is set to (10,3). Quote Link to comment Share on other sites More sharing options...
Big Spender Posted November 27, 2011 Author Share Posted November 27, 2011 Will give it a try - btw do you have an example shipping by weight prices guide I can use which is in grams (set to kg) format? 1:1.58, 2: 1.96, etc? How are you setting those up with the gram weights set in kg? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 27, 2011 Share Posted November 27, 2011 Will give it a try - btw do you have an example shipping by weight prices guide I can use which is in grams (set to kg) format? 1:1.58, 2: 1.96, etc? How are you setting those up with the gram weights set in kg? Sorry, but I use pounds. I had set .625 back in v3 as the equivalent to 10 ounces, our default weight. So when I changed to v5 I changed the number of decimal places to keep from having to redo everything else. Good luck with the decimal places. I think that will fix it, unless there's another setting in the Shipping Module structure you need to change. I don't remember that I had to do that, though. Quote Link to comment Share on other sites More sharing options...
Big Spender Posted November 27, 2011 Author Share Posted November 27, 2011 Hi, no the fix didn't work, unfortunately my table structure is already set to: decimal(10,3) Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted November 27, 2011 Share Posted November 27, 2011 Well, that was the easiest thing it could have been. I took a look at these lines in modules/shipping/USPS/shipping.class.php trying to understand how CC figures the weight, and I noticed the kg/lb "conversion factor". private function weightLbsOz(){ $weight = $this->_basket['weight']; $weight += ($this->_settings['packagingWeight'] > 0) ? $this->_settings['packagingWeight'] : 0; if(strtolower($GLOBALS['config']->get('config','product_weight_unit'))=="kg"){ $weight *= 2.2046; } $this->_decimalWeight = $weight; $this->_lbs = floor($weight); $this->_oz = ceil(($weight - $this->_lbs)*16); } I know the By_Weight module doesn't have that in it, but try (10,4) just to see what happens, since the USPS module uses 4 decimal places and then rounds. Quote Link to comment Share on other sites More sharing options...
Big Spender Posted November 29, 2011 Author Share Posted November 29, 2011 Hi, Yes tried 10,4 with no luck. I submitted to the bug tracker but the post appears to have disappeared. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.