# Fractional Quantity (e.g. 0.5 yards)

Hey there - I see that this question was asked and not answered (or solved) about a year ago, so I’ll try again - does anyone know if it’s possible to set the product quantity box to increment less than zero amounts? I would just like my customers to add products in half yards and I don’t want to confuse matters by using an addendum that states 1 unit = 0.5 yards. I have lots of senior citizen customers

Thanks for any help.

The ‘amount’ field in the order_details table is a smallInt and in the products table it is a mediumInt. So there is NO support for fractional quantities.

What is your actual unit of measure?

Do you currently price & sell your products by the “Lineal Yard”, thus you want to allow customers to order as little as a half yard of these products?

I guess I am wondering if you could use “Lineal Inch” as your unit of measure pricing your product accordingly. Then you could set the minimum order amount for these items at 18 (which would be “18 Lineal Inches” = 1/2 Yard).

There may also be benefit for you in setting the “Minimum Order Quantity” at 18, and the “List Quantity Amount” at 36 so that you could sell as little as 1/2 yard, and then jump up to full yards.

[quote name=‘Struck’]What is your actual unit of measure?

Do you currently price & sell your products by the “Lineal Yard”, thus you want to allow customers to order as little as a half yard of these products?

I guess I am wondering if you could use “Lineal Inch” as your unit of measure pricing your product accordingly. Then you could set the minimum order amount for these items at 18 (which would be “18 Lineal Inches” = 1/2 Yard).

.[/QUOTE]

Thanks for the thoughtful response. Yes, I am selling fabric by the lineal yard.

I think your solution would work, but I’m not ready to diverge from what my competitors offer, which is a simple input box with a default of “0.5” and they allow decimals in these increments:

1/8 = .125

1/4 = .25

3/8 = .375

1/2 = .5

5/8 = .625

3/4 = .75

7/8 = .875

Of course I may have to diverge if I find I have to rewrite too much code. Right now I’m still doing the forensics.

• As for the first comment above - the db data types on those fields can be changed to decimal without breaking anything.

Your quite welcome, they were just some quick thoughts as I have been down this road before while involved in other industries.

I do fully understand your point in following the standards within your particular industry. Often times even though your method is “better” & more logical, the real difficulty comes in conveying this difference to the potential customers who have “never seen it done this way”! This is where the real creativity comes into play.

If I understand correctly in that your competitors allow consumers to purchase in 1/8th yard increments, then I can only say what an inventory and order processing nightmare! :shock: In this case then, I would have no choice than to become the maverick in your industry and offer these products by the lineal inch, which is much more logical.

[quote]

• As for the first comment above - the db data types on those fields can be changed to decimal without breaking anything.

[/quote]

Not sure what assmptions are made about this data type in the templates or the JS that manipulates price based on amount. I’d also be nervous about any future upgrades. Assuming you’ve done your homework to ensure it won’t “break anything”.

I would take the approach that cs-cart owns those columns and that any mods I make to them could:
1. break other things in the cart
2. could get stomped on during an upgrade

Anyone found solution for decimal quantity issue so that the clients are able to purchase for istance 1,75 kg?

I am also looking for this feature, anyone find it? If not I need to find a cart that will allow it.

[quote name='chris102' timestamp='1320885361' post='125660']

Anyone found solution for decimal quantity issue so that the clients are able to purchase for istance 1,75 kg?

[/quote]

Yes, change the database fields[color=#282828][font=arial, verdana, tahoma, sans-serif] 'amount' field in the order_details table to [/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif]decimal(12,2)[/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif] and in the products table change it to [/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif]decimal(12,2)[/font][/color][color=#282828][font=arial, verdana, tahoma, sans-serif]. [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]Then in fn.cart.php change:[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]``` function fn_normalize_amount(\$amount = '1') { \$amount = abs(intval(\$amount)); ```[/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]to [/font][/color]

[color=#282828][font=arial, verdana, tahoma, sans-serif]``` function fn_normalize_amount(\$amount = '1') { \$amount = number_format(\$amount, 2, '.', ''); ```[/font][/color]

[font=arial, verdana, tahoma, sans-serif][color=#282828]Works fine with me on CSC 3.0.1[/color][/font]

But didnt work with paypal module.

The message that i get when i am trying a payment is:

[size=1]

[/size] You have entered an invalid quantity value. A quantity value must be an integer greater than or equal to one.

Hello!

Our team has implemented a fractional product quantity modification. We've made two different versions for our clients.

The first version is described here Fractional product quantity

The second version allows customers to type in the product quantity that they need. the quantity will be automatically rounded to the possible quantity specified by the administrator in the admin back-end.

Best regards, Alt-team