Forums / Templates, Stylesheets, Page Layout / Using fractions for product quantities

Using fractions for product quantities

Locked

Started by kits1 on 5 Jan 2008, 6:38 AM · Views: 3,840

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
5 Jan 2008, 6:38 AM
#1
kits1 avatar

kits1

New Zenner

Join Date:
Apr 2007
Posts:
22
Plugin Contributions:
0

Using fractions for product quantities

I sell fabric and in the business people don't really use decimals to order, but more like ordering 3 1/3 of a yard or 3 3/4 of a yard. Can I setup the site to allow the customer to select the whole and fraction parts of the item they are buying?

If not, how can I change the min, and units so someone can order any amount of fabric? When I use .125 as the min and 0 as the max, I can not use 0 as the units. If I select .125 then the customer can order every 1/8 of a yard, but not a 1/3 of a yard. Do I set the units to 0.01 or what?

The best option would be the fractions, but how do I set that up?

Thank you very much.

5 Jan 2008, 8:35 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Using fractions for product quantities

You might try two dropdown attributes, one for whole numbers and one for fractions, and price by attributes. This would avoid having to enter every possible unit+fractional number in one list. It would require you to input the price for each number.

Yards: [0 ($x.xx)]
[1 ($x.xx)]
[2 ($x.xx)]
[3 ($x.xx)]
[etc.]

Fraction: [- (+$x.xx)]
[1/8 (+$x.xx)]
[1/4 (+$x.xx)]
[1/3 (+$x.xx)]
[1/2 (+$x.xx)]
[5/8 (+$x.xx)]
[2/3 (+$x.xx)]
[3/4 (+$x.xx)]
[7/8 (+$x.xx)]

Another possibility that just occurred to me is using the standard quantity box for whole yards (set units to 1), and an attribute for the fraction which you set as a one-time charge. That way when they order 5 1/3 yards, they get charged for 5 units and a single 1/3 charge. (You would need to define the cost of each fraction.)

5 Jan 2008, 9:30 AM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Using fractions for product quantities

I ran a test and this does work mostly as hoped.

Make the product with a unit price and not "priced by attributes". Create a "Fraction" option name and the desired values 1/8, 1/4, 1/3, etc. Add those to the product without a price but with the one-time charge equal to the cost for the fraction.

When you order a quantity of the item and select the "fraction" attribute, the fraction's cost is added to the total yardage cost (as a separate line item).

If you put the same item in the cart again with a different fraction, it is treated as a different order, and the one-time charge is applied to the second item correctly. 5 1/3 + 5 1/2 --> 5 1/3 + 5 1/2.

If you put the same item with the same fraction in the cart, it increases the unit quantity but leaves the single fraction as is. 5 1/3 + 5 1/3 --> 10 1/3.

The alternative would be to allow units of .001 and maybe provide a little conversion chart. Not as neat for the fractions but totally functional for quantity.

5 Jan 2008, 9:41 AM
#5
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Using fractions for product quantities

Last thought on the subject...

It would be possible to write a bit of code (javascript?) to interpret a number entered with fractions like 5 1/3 and then convert that to a real number for processing. Someone skilled in js would have to write that.

14 Jan 2008, 3:56 AM
#6
kits1 avatar

kits1

New Zenner

Join Date:
Apr 2007
Posts:
22
Plugin Contributions:
0

Re: Using fractions for product quantities

Thank you very much.
A couple of clarification questions:

  1. How would a customer order 1/2 yard. The option does not allow me to set the minimum to 0.
  2. I am sorry, but I have the zen-cart book, but I don't understand how to make that "fraction" option name. You said to assign a value or cost to each 1/8 yard. If I am selling 50 different fabrics and they are not the same cost for each 1/8 yard, will I have to make 7 fraction option names times the 50 items I have or how do I do that for each fabric.

Thank you and sorry that I'm not understanding this.

Thank you very much.

14 Jan 2008, 4:59 AM
#7
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Using fractions for product quantities

1: Hmm yes that would be a problem. You can't order a quantity of none of a product, even if there is an attribute chosen that means 1/2 a yard.
So i guess the yard quantity + one-time fraction is not going to work.
That leaves attributes for both whole yards and fractions (or else finding a programmer to make a "fraction-reading" function).

2: You can use one set of "fraction" option name and values for everything. The price is assigned to each product individually, in Attributes Controller.

15 Jan 2008, 3:27 AM
#8
kits1 avatar

kits1

New Zenner

Join Date:
Apr 2007
Posts:
22
Plugin Contributions:
0

Re: Using fractions for product quantities

Okay, sorry again, but do you mean create option values 1/8 to 7/8 and somehow attach whole numbers or do I do option values like:
1/8, 1/4, 3/8, ...... 2 1/8, 2 1/4,..... all the way up to 20 if I want to sell 20 yards of fabric.

Thank you.

15 Jan 2008, 3:35 AM
#9
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Using fractions for product quantities

or convert to all decimal admin > config > stock > Product Quantity Decimals > enter 2 or 3

Then sell 20.125 or 5.5 or?

Zen-Venom Get Bitten

15 Jan 2008, 9:58 AM
#10
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: Using fractions for product quantities

Kits1 doesn't want decimals if at all possible.

You would not need to have every fraction from 1/8 to 20 listed, just two dropdowns, one for whole numbers and one for fractions, as described in post 2:

Yards: [0 ($0.00)]
[1 ($x.xx)]
[2 ($x.xx)]
[3 ($x.xx)]
[etc.]

Fraction: [- (+$0.00)]
[1/8 (+$x.xx)]
[1/4 (+$x.xx)]
[1/3 (+$x.xx)]
[1/2 (+$x.xx)]
[5/8 (+$x.xx)]
[2/3 (+$x.xx)]
[3/4 (+$x.xx)]
[7/8 (+$x.xx)]

Along with this, you would want to limit the "product quantity" to 1, so the customer doesn't order 3 times 3 1/4 yards. You do this in the product entry/editing page. The quantity box by the add button will disappear.

9 May 2008, 10:19 PM
#11
jacdesigner avatar

jacdesigner

Zen Follower

Join Date:
Jun 2005
Location:
Austin, Texas, US
Posts:
205
Plugin Contributions:
0

Re: Using fractions for product quantities

Thank you VERY much for this post. I had been digging for that silly setting for a while. I also have a client with a fabric shop who wants to sell .25, .75, etc. This is such a relief!

kobra:

or convert to all decimal admin > config > stock > Product Quantity Decimals > enter 2 or 3

Then sell 20.125 or 5.5 or?

This message brought to you by Jac.
Happily developing sites with Zen Cart since 2003.