Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Complicated Configurable Product Question
 
BradF73
Jr. Member
 
Total Posts:  7
Joined:  2008-02-20
 

Hi all,

I’m not even sure what I’m trying to do is possible, at least in any sort of straight-forward way, but I thought I’d ask:

I’m working on a website that will sell aftermarket parts for motorcycles. We’re currently trying to figure out exactly how to define certain parts that can be used on multiple motorcycles. For example, we have a set of brake pads, let’s say the SKU is BP1000. This particular model of brake pads fits many different motorcycles, across years, manufacturers, and models. I.e., ‘BP1000’ fits 2003- 2006 Honda CBR600s as well as the 2007 Kawasaki ZX9R. ‘BP2000’ might fit 2007 and up Yamahas. And so on.

Ideally, we would like to create a generic ‘Brake Pad’ product, with drop-downs for Bike Year, Bike Manufacturer, and Bike Model offered. Upon providing this information, the correct SKU would be added to the shopping cart.

My problem is that the only way to do this seems to be to define the same SKU part repeatedly for each possible combination of year/manufacturer/model. In other words:

BP1000-1 2003 Honda CBR600
BP1000-2 2004 Honda CBR600
BP1000-3 2005 Honda CBR600

...and so on. Workers in the shop actually filling the order would need to know to ignore the ‘-x’ part.

Is there a simpler way of accomplishing what I’m trying to do? Is this custom development work (or maybe something in 1.1? grin )

Thanks,

-Brad

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jennifer M
Jr. Member
 
Total Posts:  21
Joined:  2008-02-18
 

Interesting problem!

It does sound to me like something that would need new code, be it custom or future core as you say.  But I think it’s perfectly doable in principle. 

Caveat:  I’m a relative newbie to Magento. 

I think “configurable product” is probably the wrong name for it.  What you have is a search problem based on matching one of several alternative product attributes.  The product itself is simple.

At the moment Magento allows products to have attributes.  But as far as I know (based on my newbie level of Magento familarity), each attribute can have only one value. 

Ideally you want an attribute which is itself a table of bike, year and model.  (In practice you wouldn’t have a separate table for each product, you’d have all of the products’ data in one big table, labelled/distinguished by SKU.  But conceptually, it’s a table per product.)

In terms of the database structure, one way to do it would be like this:

Create a new table called something like relevance_of_product_to_bikes. 

In that, you would have fields

| product type | sku | bike | year | model |

and the populated table might look something like this:

| brake pad | BP1000 | Honda | CBR600 | 2003 |
| brake pad | BP1000 | Honda | CBR600 | 2004 |
| brake pad | BP1000 | Honda | CBR600 | 2005 |
| brake pad | BP2000 | Kawasaki | abc | 2005 |
| brake pad | BP2000 | Kawasaki | xyz | 2006 |
| headlight bulb | HB1000 | Kawasaki | abc |
and so on. 

(see how the first three lines there are all the bikes for BP1000 - that’s what I meant by it being conceptually one table per product - those three lines of the big table are like a mini-table just for BP1000.)

When you come to make e.g. the “brake pads” page, you’ve got a choice of how to populate your droppy-downers. 

You could do them based on three queries, each one for the unique values of one field,
WHERE “product type” = “brake pad”
So e.g. if that tiny table was all you had, the droppy downers for brake pads would be

| Honda |
| Kawasaki |

| CBR600 |
| abc |
| xyz |

| 2003 |
| 2004 |
| 2005 |

Or, more elegant if you’re going that way, make each query build on the next, so that e.g. after they’ve selected Kawasaki, they don’t get offered CBR600, since that’s a Honda model. 

so it would be like:

query all brake pads > offer Honda and Kawasaki
customer chooses Kawasaki > query all Kawasaki brake pads > offer abc and xyz
customer chooses xyz > query all Kawasaki xyz brake pads > offer years
(OK in this example table there was only one year but you see what I mean)
customer chooses year > query to identify product

(you’d also need a link saying something like “My bike is not here!” for the case where you don’t have the product for that person’s bike, which would take them to a page where they could contact you and ask if you might be getting their thing in the future)

Or, if you’d rather, you can populate the drop-down lists from the unique values of the whole table, or even from a separate longer list of all maker/model/year combinations ever in the whole world.  This has the advantage or disadvantage that the customer could choose bikes whose products you don’t actually have.  The disadvantage is that it makes their task harder because the droppy-downers would be longer.  The advantage would be that you could find out and store for later reference what products people were looking for that you didn’t have.

(In any case it would be nice to have a table or tables of all makers, models and years, to draw from in your admin backend when you’ve got to tell the system what bikes a product is relevant for.  Saves typing and typos.)

Anyway, then, whichever way you create the droppy-downer, you can take the droppy-downer selection that the customer’s given you, and use it to query the relevance_of_product_to_bikes table, so that if there’s a match, the query returns the SKU.  Then you can pick out the product by its SKU and display it.  (or else “We don’t have that for your bike at present, sorry!” if you’d allowed them to select something that wasn’t there.)

So that is how I would probably do it in terms of algorithm.  What that looks like in code is a whole other kettle of fish!  But I’m sure it’s something that a reasonably competent PHP/MySQL bod could do. 

On the other hand if Magento does (or will soon) allow multiple values per attribute, then you could do a less elegant version with rather less coding, whereby each product has multiple values for an attribute called “bike”, each value being make/model/year all stuck together in a lump.  You’d then have to concatenate the droppy-downers before you did the search on “bike”.  But that method would be more clunky - by which I mean it would fail to play to the strengths of databases, and probably lead to more human error in populating the tables.

Hope that was some help.  At least it’s a re-statement of the problem, and someone else may be able to elaborate on it, or correct me if I’m wrong.  Good luck!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jennifer M
Jr. Member
 
Total Posts:  21
Joined:  2008-02-18
 

Update:  I’ve just been reading this book, the chapter about how Magento organises its database. 

It uses EAV, Entity Attribute Value, which isn’t a term I’d come across before.  I don’t understand it yet, but I’ve got enough of a sense of it to be pretty sure that EAV is going to be relevant to any custom solution to your problem. 

Not sure what that means in terms of how different it would be from what I wrote above.  The outline may or may not be completely inapplicable, but at least the database tables would probably look different, and from what I gather, you’d probably take advantage of some of Magento’s built-in stuff rather than directly querying MySQL. 

Again, someone else might be able to add to this or correct it…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sintax
Member
 
Total Posts:  58
Joined:  2008-02-18
Hungary
 

I have exactly the same problem. I have products with 10 attributes each with 4-5 values each. The product count is over 2000. My problem is that if I need to create an SKU therefore a product for each combination I would have over 10000 products in the list which would be rather hard to manage.

I was trying to generate the SKU automatically and only have one base product, but ran into interference from the cart as it was adding the quantities of the same base product together rather than adding them as separate items. I think the alternative would be to use the nonexistant “input field” in the configurable product which some board members have been referring to ("adding text by the user and attaching it to an item"). This would only come in a later version of Magento so that’s sort of not a solution.

Did you manage to come up with something?

::Sintax

 
Magento Community Magento Community
Magento Community
Magento Community
 
BradF73
Jr. Member
 
Total Posts:  7
Joined:  2008-02-20
 

Thanks Jennifer, for your suggestions. I’ve been away for a bit and haven’t had time to pick back up on this. I was hoping I was just missing something obvious and wouldn’t have to code anything. grin

Looks like it’s time to start coding something up. If I manage to get something working, I’ll post back in this thread.

Thanks again,

-Brad

 
Magento Community Magento Community
Magento Community
Magento Community
 
enofman
Jr. Member
 
Total Posts:  11
Joined:  2007-08-31
 

check out this group
It may help

http://www.magentocommerce.com/group/view/174

Gary

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top