Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can I sell by weight (lbs.) with decimal places???


tags26

Recommended Posts

Hey everyone...love OSC. I need to set up a client with the ability to sell by a unit of weight. He owns a deli route and when he makes a delivery he needs to ring up the exact weight of the product which varies from piece to piece. The weight is not usually a whole number either and usually is in decimal places. I would need to set up OSC to create for example:

 

Product Quantity Price Total

 

Turkey (lb.) 24.88 5.99 $149.0312 ----> which rounds to $149.03

 

Where are you OSC experts? Is there any contrib for this, i couldn't find any.

 

I love the support this product has but i'm not that good with PHP. So i rely on you experts.

 

Best,

Rob

Link to comment
Share on other sites

Actually, I just tested something, and the answer doesn't matter. Osc will do what you want, as is, just create the product turkey, set the price as 5.99. You can define the units as pounds in the description. Add 1 pound to the cart, view cart contents, and enter the exact weight, to the decimal, and osc will do the math.

 

Jeremy

Link to comment
Share on other sites

  • 1 month later...

It appears that osC cannot handle numbers with decimal value less than 1 though. It always rounds up if the quantity is less than 1 so you couldn't buy .55 quantity of something (for example).

 

Any solutions?

 

Thanks,

Aaron

 

 

Actually, I just tested something, and the answer doesn't matter. Osc will do what you want, as is, just create the product turkey, set the price as 5.99.  You can define the units as pounds in the description.  Add 1 pound to the cart, view cart contents, and enter the exact weight, to the decimal, and osc will do the math.

 

Jeremy

Link to comment
Share on other sites

I went back and tested osC again for decimals lower than 1. It appears I spoke too soon. osC doesn't round up if the quantity is less than 1 - it just either won't add that product to the shopping cart, or if it's already in the cart, it will remove it altogether. I am sure there is probably a simple fix for this... just don't know what it is! Thanks!

 

-Aaron

Link to comment
Share on other sites

I went back and tested osC again for decimals lower than 1. It appears I spoke too soon. osC doesn't round up if the quantity is less than 1 - it just either won't add that product to the shopping cart, or if it's already in the cart, it will remove it altogether. I am sure there is probably a simple fix for this... just don't know what it is! Thanks!

 

-Aaron

 

 

BUMP

 

Anyone?

Link to comment
Share on other sites

  • 4 weeks later...

I am noticing that osCommerce doesn't hold the decimal values for some reason. If your session expires, and you log back in to check out or see your shopping cart - the decimal values fall off and it reverts back to whole numbers. There also seem to be some other weird reasons why the decimals vanish, but I can't pinpoint exactly why. Anyone have some experience dealing with decimal value product quantities? Please?

 

Thanks!

 

-Aaron

Link to comment
Share on other sites

have you tried modifing the database field for the issue in question?

making it 3 or 4 places instead of 2?

i made a small change to my site to allow upto 3 (.123) places for weight. i did not like it rounding on me. works just fine, so far, everything is calling the field without issue.

Link to comment
Share on other sites

have you tried modifing the database field for the issue in question?

making it 3 or 4 places instead of 2?

i made a small change to my site to allow upto 3 (.123) places for weight. i did not like it rounding on me. works just fine, so far, everything is calling the field without issue.

 

 

Thanks for the advice. Yes, the field is set up as an osCommerce "standard" 15,4 decimal field. Meaning it can have up to 15 integers before, and 4 after, the decimal.

 

-Aaron

Link to comment
Share on other sites

Thanks for the advice. Yes, the field is set up as an osCommerce "standard" 15,4 decimal field. Meaning it can have up to 15 integers before, and 4 after, the decimal.

 

-Aaron

Actually, that's 15 total.. 4 to the right of the decimal, leaving a max of 11 to the left of it. ;)

 

~James

Link to comment
Share on other sites

FIXED!

 

Here's what I did to sell products with osCommerce in decimal format.

 

1. Changed customers_basket_quantity in the customers_basket table to DECIMAL 15,4 format.

2. Changed products_quantity in the orders_products table to DECIMAL 15,4 format.

3. Changed products_quantity in the products table to DECIMAL 15,4 format.

4. In catalog/includes/classes/shopping_cart.php changed:

 

reset($this->contents);
     while (list($key,) = each($this->contents)) {
       if ($this->contents[$key]['qty'] < 1) {
         unset($this->contents[$key]);

 

To the best of my knowledge and recollection this is all that was changed.

Link to comment
Share on other sites

  • 1 month later...

Hi Just wondering how you change the fields to Decimal formats as suggested above. I use PhpMyAdmin etc but have never changed the format!

 

I am needing to change oscommerce to cope with decimal qtys!

 

Thanks!

Link to comment
Share on other sites

Hi Just wondering how you change the fields to Decimal formats as suggested above. I use PhpMyAdmin etc but have never changed the format!

 

I am needing to change oscommerce to cope with decimal qtys!

 

Thanks!

 

 

It's a little hard to explain, but in addition to those changes you will need to make a minor change on all the checkout pages as well.

 

PM me if you need some assistance.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...