[ic] Re: Subcategories - populate comb_category table?

J.M.R. interchange-users@interchange.redhat.com
Fri Mar 22 05:17:01 2002


Hi all,

Really amazing this tree tag, but although I´ve been trying, I was not able
to create a looking tree like the "vertical_category" component (In
tree_disply.html the cats and subcats are underlined). I would like that the
tree appears the same that areas (parent_fld in the tree) and cats
(child_fld) are in foundation, so I can play with different colors and sizes
for them (I know it sounds simple but I´ve got nothing).

Thanks.

José Mª Revuelto

> -----Mensaje original-----
> De: interchange-users-admin@interchange.redhat.com
> [mailto:interchange-users-admin@interchange.redhat.com]En nombre de Dog
> Tags
> Enviado el: viernes, 15 de marzo de 2002 20:08
> Para: interchange-users@interchange.redhat.com
> Asunto: [ic] Re: Subcategories - populate comb_category table?
>
>
> Hi Jonathan
>
> 1. Would you have a link to see an example of what you have
> working for subcats?
>
> 2. Also, how can you split out just one branch to display only
> that branch on the appropriate subcat page?
>
> 3. I have to admit that I'm still not sure where Mike's following
> preliminary perl code goes - the part that populates the *sql
> comb_category table:
>
> ###################
> Prerequisites:
>
> * SQL database. Trees are not recommended for DBM databases as the
>   selects will be too slow.
>
> * This example assumes you have added a field to your products
>   database named comb_category. Use your SQL command line utility
>   to add it:
>
>     alter table products add column comb_category varchar(255);
>
>   It will be populated with colon-separated categories. Make sure you
>   reconfig the catalog ("Apply changes") to pick up the new field.
>
> * You can populate it from prod_group and category with this code:
>
>     [flag type=write table=products]
>     [perl tables=products]
> 	my $db = $Db{products};
> 	my $ary = $db->query('select sku,prod_group,category from
> products');
> 	my $out = '';
> 	foreach $row ( @$ary) {
> 	    my ($sku, $pg, $cat) = @$row;
> 	    $db->set_field($sku, 'comb_category', "$pg:$cat")
> 		and $out .= "$sku = $pg:$cat<br>\n";
> 	}
> 	return $out;
>     [/perl]
> #####################
>
> Thanks very much. I greatly appreciate your help.
>
> DT
>
>
> > I found an article by Mike Heins about his Tree Example in which
> > deeper subcategories are created and displayed on the tree page.
> >
> > Here is a link to the full code for those who would like it:
> >
> >
> http://developer.akopia.com/archive/interchange-users/2001/msg09061.html
> >
> > I have a few questions:
> >
> > 1. In the Prerequisites section, Mike mentions that you can
> > populate the new field with the following code. Where does the code go?
>
> put it into a basically blank page and call it from a web browser.
>
> > 2. Can the tree code be used to create deeper subcats that could
> > be displayed at the tops of the respective subcatgory pages, as
> > well as on the tree page?
>
> yes.
>
> [snip]
>
> > This encourages me that deeper subcats are possible. Has anyone
> > created a system that can handle deeper subcats?
>
> That's what the [tree] tag is for. I have a tree which can go as
> deep as you
> like. Each record has field which defines its position in the tree. I use
> this for a (sort of) file manager. The tree can go as deep as you
> like and
> each level can have more folders (branches) or files (leaves). I have one
> 'tree' page which is called with a parameter which indicates where in the
> tree to start; this could be the root, or anywhere else further down.
>
> Jonathan
> Webmaint.
>
> --
>
> _______________________________________________
> Sign-up for your own FREE Personalized E-mail at Mail.com
> http://www.mail.com/?sr=signup
>
> Travelocity.com is giving away two million travel miles.
> http://ad.doubleclick.net/clk;3969773;6991039;g?http://svc.travelo
city.com/promos/millionmiles_main/0,,TRAVELOCITY,00.html