Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Custom price calculation from many attributes

Custom price calculation from many attributes

Views: 1,454

Results 1 to 4 of 4
3 Oct 2010, 4:23 PM
#1
lbowenc avatar

lbowenc

New Zenner

Join Date:
Jan 2004
Posts:
38
Plugin Contributions:
1

Custom price calculation from many attributes

I have searched the forum and can't find any discussion of what I am trying to do. My apologies if this has been covered before ... if it has, please point me to the relevant thread.

My products are picture frames. A frame is priced based on its total length, rounded up to the nearest foot. There are 4 attributes collected that define the width in inches, width fraction of an inch, height in inches, and height fraction of an inch. From those 4 values the total length can be calculated, and which is used to do a table lookup to get the price. For example, frames less than 5 feet are $30, less than 10 feet are $55, and so on. (Actually, there are 5 lookup tables since there are 5 levels of pricing for the different frame products).

I know this will require some custom programming and have spent many hours studying to determine the best way to implement this type of pricing. I don't see any straightforward way to do it. It looks like Zen is set up to do the pricing based on the product price (in the product table) and attribute pricing if any has been defined. The attribute pricing is done one attribute at a time and I don't see any way to easily calculate a price by looking at all the attributes together rather than individually.

Can anyone offer advice as to the best way to approach this that would fit best with how Zen does pricing?

Thanks ... Bowen

3 Oct 2010, 4:42 PM
#2
kobra avatar

kobra

Black Belt

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

Re: Custom price calculation from many attributes

The attribute pricing is done one attribute at a time and I don't see any way to easily calculate a price by looking at all the attributes together rather than individually.
What you are describing is one attribute dependant upon another or dependant attributes
There is no default facility for handling dependant attributes in ZenCart
Additionally, "width/height in fraction of an inch" is not directly calulatable and would need to be entered in decimal or converted programatically
It looks like Zen is set up to do the pricing based on the product price (in the product table) and attribute pricing if any has been defined.
One can select "priced by attributes" in the product entry, but this still does not attain the dependency

4 Oct 2010, 12:26 AM
#3
lbowenc avatar

lbowenc

New Zenner

Join Date:
Jan 2004
Posts:
38
Plugin Contributions:
1

Re: Custom price calculation from many attributes

That's what I concluded as well. Given that I will need to make some changes to how pricing works, can anyone recommend the best way to make this change? How would a veteran Zen developer go about doing it? I looked at notifiers/observers and didn't see a hook that would meet my needs.

Thanks ... Bowen

20 Sep 2011, 9:34 PM
#4
plaz avatar

plaz

New Zenner

Join Date:
Sep 2009
Posts:
23
Plugin Contributions:
0

Re: Custom price calculation from many attributes

Did you have any luck with this? I have the same need.

Thanks,

Peter