[ic] adding items to multiple categories?

Stefan Hornburg racke@linuxia.de
21 Sep 2000 23:26:31 +0200


Mark Stosberg <mark@summersault.com> writes:

> 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,
> );

This is traditional way to doing this in a database, but not so well
supported by IC.

> 
> 
> 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. 

In-page the selection is no problem ([query]).

> 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. 

I'm in the process to patching IC UI to support that. My scheme is
to insert links on the item edit page like

"Add related item to products_cat_map"
resp.
"Related items in products_cat_map"

Before the last large CVS UI update this worked fine.

Ciao
        Racke

-- 
LinuXia Systems && Cobolt NetServices, eCommerce and more
Shop- und Datenbanklösungen mit MiniVend, Firewalls auf Debian-Basis
http://www.linuxia.de - http://www.cobolt.net
--> Junior Officer of the MiniVend/Interchange Bug Patrol <---