[ic] adding items to multiple categories?

Mark Stosberg mark@summersault.com
Thu, 21 Sep 2000 15:58:52 -0500


Hello,

I'm setting up a shop with Interchange 4.5.5, and I have a question
about how to set up many-to-many relationships between entities.
Specifically, I'd like to add a product to multiple categories. The
admin "item add" interface makes it appear that this is possible,
because I can select multiple categories in the menu, however, only one
category appears to be represented in the MySQL database and tied to the
product. It's also not clear how this would be supported in the current
data model. How's how I usually data model this myself, and is in fact
how the clients information is already stored: 

create table products (
	product_id		int primary_key,
     --other attributes here
);

create table cat (
	cat_id			int primary_key,
     -other attributes here
);

create table products_cat_map (
	product_id		int,
	cat_id			int,
);


when I want to add a product to multiple categories, a make a single
entry in the products table, and entries in the products_cat_map table
for each category I'm adding products to. 

Considering I'd like to use this standard data model scheme, how can I
use minivend to select all the products in a category, or modify the
admin area to support such a scheme. I've already built a similar admin
interface in Perl/SQL, I'm just not sure how to make the data model work
with Interchange.

Perhaps all that is needed is some more documentation on how the flex
editor and  metadata works. 

 Thanks!

  -mark 


personal website             }      Summersault Website Development
http://mark.stosberg.com/    {      http://www.summersault.com/