Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Mega Attributes Quandry

Locked

Started by juggersworth on 21 Oct 2009, 5:40 AM · Views: 697

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
21 Oct 2009, 5:40 AM
#1
juggersworth avatar

juggersworth

New Zenner

Join Date:
Oct 2009
Posts:
5
Plugin Contributions:
0

Mega Attributes Quandry

My questions are very detailed so I will try t be as clear about what I am trying to do so that someone may be able to give me a direction to look in. I am working with a fresh install of 1.3.8 with no addons (yet), with basic template overrides. Sandbox site is at http://www.turnerandtaylorindustries.com/store if interested. I put it up there for my business partner and employees to see the progress as I go. But now I am stuck and I've spent a couple of days and this afternoon looking through addons, toying with code, and reading forums.

I manufacture and sell drapery hardware. All of the products, such as rings, & brackets are straight forward as far as product + color attribute = price. However, the rods present a problem: The best way to categorize them is as follows. (Note: I have listed, and will use, all of the necessary attributes for a 1-Bend rod, which is the least complex rod that still uses all of the logic, however logic applies to all rods):

Styles/Products:
-Straight, 1-Bend (L shaped), 2-Bend, 3-Bend, 4-bend, Custom Number-Bend(Call for price), Arch. Each type has a base price = base price + set-up charge.

Attributes
-Diameter: 3/4", 1", 1-1/4", 1-1/2", 2" [Dropdown]
-Color:Black, Antique Gold, Oil Rubbed Bronze, Pewter, Satin Nickel, Antiqued Bronze, Antiqued Pewter [Dropdown]
-Length in Inches: Length(A-B), Length(B-C), Length(C-D), Length(D-E), Length(E-F), Length(A-C), Length(B-D), Length(C-E), Length(D-F) [Text/User Input]
-Corner Split Style: Miter, Round (included in base price) [Dropdown]
-Termination(A): None, Round [Dropdown]
-Termination(END) None, Round [Dropdown]

I need to write a script that will update the price and insert into cart based on this logic minus validations etc.:

Total_Cost = (2_Bend_Rod_Base_Price + Term_A + Term_End) + ((Diameter + Color)*(round((Length_AB + Length_BC)/12)))

I can put together a PHP script do the math, but I need help on a bunch of things like; Where should I put/include this script (right now I'm thinking on the cart_page), how the attribute variables are passed (assume GET/POST). I've looked at the jscript_updater addon from D Parry (Chrome) 2007 ([email protected]) but it's in javascript and only works with radio boxes, but is close to the idea.

To make matters worse I need wholesale and retail prices based on customer tier. This could be done with a simple percentage discount at the cart level, but we only wholesale the drapery hardware so we don't want other product put in with a drapery order and then discounted. So, i suppose another script could be written to check that the user == logged _in && user_is_wholesale && product_master_category == drapery and then calculate the discount. Any ideas?

To make matters painful there is one more scenario that goes with all of this. Orders usually have multiple straight rods which have different attributes (different lengths at the very least). Let's say you choose all of the attr's for Bedroom_Straight_Rod and add it to the cart. Dandy. Now you continue shopping and create Hall_Straight_Rod and add it to the cart. In such a scenario the cart will merge the 2 because they are technically the same product so the quantity will get added. Or will it? I haven't tested this. How does a shirt site sell Hanes_Small_Shirt with custom writing "TINA" and also Hanes_Small_Shirt with custom writing "BOBBY". What I really need is to be able to add multiple instances of rod type to the cart. Again, I can probably write the logic, but I am not familiar with modules, addons, what the workflow of the standard product_info_page->cart_page is etc..

In summary, It's late (for me), I am working on this and have to come up with something soon because it doesn't make sense to have the website up and running (which will take us to a national audience that is waiting) and then have functionality for every product except the rods. Thank you to everyone in advance.

Josh

21 Oct 2009, 6:58 AM
#2
gjh42 avatar

gjh42

Black Belt

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

Re: Mega Attributes Quandry

The rod attribute pricing is definitely going to be a bunch of custom coding.
However, there is one factor you won't have to worry about: if the customer adds the same product twice with different attribute selections, it will show as two different items in the cart and invoice. If they add it twice with identical attributes, then it will show as one item, qty 2.

21 Oct 2009, 1:12 PM
#3
juggersworth avatar

juggersworth

New Zenner

Join Date:
Oct 2009
Posts:
5
Plugin Contributions:
0

Re: Mega Attributes Quandry

Thanks Glenn,
That's one hurdle overcome. Goes to show; sometimes we create problems that don't exist. Your clarification is much appreciated.
Josh