diane43 Posted August 17, 2006 Share Posted August 17, 2006 :'( I am at the end of my rope. I have been working on this it seems like forever. No mater what I do I can not get this to calulate correctly. I put in 2.3 as pounds and ounces and the ups calulates as 2 pounds when it actually should be 3 lbs. When I put in the ounces it doesn't even show up. What am I doing wrong? Can someone Please help me out. Thank you, Diane43 Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted August 17, 2006 Share Posted August 17, 2006 I am at the end of my rope. I have been working on this it seems like forever. No mater what I do I can not get this to calulate correctly. I put in 2.3 as pounds and ounces and the ups calulates as 2 pounds when it actually should be 3 lbs. When I put in the ounces it doesn't even show up. What am I doing wrong? Why do you think PHP can calculate in pounds and ounces, just because pounds and ounces are used in the US? PHP (like every other computer program) uses the decimal system for calculations IMO. So in osC 2.3 pounds would be 2 plus (0.3 x 16) ounces = 2 pounds 4.8 ounces. Why should that be 3 pounds? Actually, the weight is sent by upsxml as a weight with one decimal place (so 2.3 would be sent) but in the display on checkout_shipping it is rounded to whole numbers. So 2.3 would become 2 using round this way. Quote Link to comment Share on other sites More sharing options...
diane43 Posted August 21, 2006 Author Share Posted August 21, 2006 Why do you think PHP can calculate in pounds and ounces, just because pounds and ounces are used in the US? PHP (like every other computer program) uses the decimal system for calculations IMO. So in osC 2.3 pounds would be 2 plus (0.3 x 16) ounces = 2 pounds 4.8 ounces. Why should that be 3 pounds? Actually, the weight is sent by upsxml as a weight with one decimal place (so 2.3 would be sent) but in the display on checkout_shipping it is rounded to whole numbers. So 2.3 would become 2 using round this way. <_< Thank you for responding to my question. I'm sorry but I do not know the osc shopping cart and code. This is all new ground to me and I was looking for some help through the rough spots. I've had to add a new shopping because my other one became out dated and too costly. What I meant to say is is UPS rounds up to the next pound to rate it's packages and the module is not doing this. I'm either putting the weight in wrong or the module is not calulating correctly. Thanks, Diane43 Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted August 21, 2006 Share Posted August 21, 2006 What I meant to say is is UPS rounds up to the next pound to rate it's packages and the module is not doing this. I'm either putting the weight in wrong or the module is not calulating correctly. The UPS documentation for developers state that the weight should be supplied with one decimal and the code does that. I suppose that UPS will give a rate back after rounding it up to the next pound itself (you can check that by changing the weight yourself in the admin and see what happens). Quote Link to comment Share on other sites More sharing options...
diane43 Posted August 21, 2006 Author Share Posted August 21, 2006 The UPS documentation for developers state that the weight should be supplied with one decimal and the code does that. I suppose that UPS will give a rate back after rounding it up to the next pound itself (you can check that by changing the weight yourself in the admin and see what happens). Hi, What is happening is when I put in for weight for a product that weights .2 ounces. UPS does not recgonize it and comes back with 0 LBS in which it should be 1 LB. I have put in 2 LBS 3 OZS and it comes back 2 LBS, but 2 LBS 5 OZS comes back 3 LBS. I think the calculating code doesn't round up the ounces in the checkout_shipping. I'm just guessing at this point. One thing I do know UPS is calculating the prices correctly. Now if I could just get the rest of it. My selling season starts real soon. Thanks for your help, Diane43 Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted August 21, 2006 Share Posted August 21, 2006 What is happening is when I put in for weight for a product that weights .2 ounces. UPS does not recgonize it and comes back with 0 LBS in which it should be 1 LB. I have put in 2 LBS 3 OZS and it comes back 2 LBS, but 2 LBS 5 OZS comes back 3 LBS. I think the calculating code doesn't round up the ounces in the checkout_shipping. I'm just guessing at this point. One thing I do know UPS is calculating the prices correctly. Now if I could just get the rest of it. You are confusing what UPS is getting with what is shown on checkout_shipping.php. The weight there is a rounded weight from what has been sent to UPS. So if UPS gets 0.49 lbs it will show 0 lbs and when it is 0.51 it will become 1. This has nothing to do with what UPS gets and uses for rates. If it makes you sleep better change it to give you one decimal (around line 300 in upsxml.php, round($variable, 0) to round($variable,1) ): if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) { if ($this->dimensions_support > 0) { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkg(s), ' : ' pkg, ') . round($totalWeight,1) . ' ' . strtolower($this->unit_weight) . ' total)'); } else { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' pkg(s) x ' : ' pkg x ') . round($shipping_weight,1) . ' ' . strtolower($this->unit_weight) . ' total)'); Also PHP and osC do not know how many ounces go into a pound. So 0.2 ounce is entered as 0.013 in the admin (0.2 /16 = 0.0125 lbs, but only three decimals available). Quote Link to comment Share on other sites More sharing options...
diane43 Posted August 22, 2006 Author Share Posted August 22, 2006 You are confusing what UPS is getting with what is shown on checkout_shipping.php. The weight there is a rounded weight from what has been sent to UPS. So if UPS gets 0.49 lbs it will show 0 lbs and when it is 0.51 it will become 1. This has nothing to do with what UPS gets and uses for rates. If it makes you sleep better change it to give you one decimal (around line 300 in upsxml.php, round($variable, 0) to round($variable,1) ): if ((is_array($upsQuote)) && (sizeof($upsQuote) > 0)) { if ($this->dimensions_support > 0) { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $this->boxCount . ($this->boxCount > 1 ? ' pkg(s), ' : ' pkg, ') . round($totalWeight,1) . ' ' . strtolower($this->unit_weight) . ' total)'); } else { $this->quotes = array('id' => $this->code, 'module' => $this->title . ' (' . $shipping_num_boxes . ($this->boxCount > 1 ? ' pkg(s) x ' : ' pkg x ') . round($shipping_weight,1) . ' ' . strtolower($this->unit_weight) . ' total)'); Also PHP and osC do not know how many ounces go into a pound. So 0.2 ounce is entered as 0.013 in the admin (0.2 /16 = 0.0125 lbs, but only three decimals available). I'm not confused about what UPS is getting thats not the problem. OSC is sending the wrong weight that's what I'm talking about. I tried what you gave me and it didn't work. I put in 0.013 for onces and it comes back as 0 LBS, and also in the products discription after I put in that weight it shows the as 0.01. I also changed the PHP to 1. The PHP which ever one, needs to total and round the weight to the next pound to send to UPS for the rate. I'm sorry if I sound a little frustrated but this is not my bag and this makes me feel really stupid. If I didn't need this so bad I would just forget the whole thing. We are starting our selling season and here I am still trying to figure this out. Thank you for your patient and God Bless Diane43 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.