[ic] Issue w/Foundation Store & Categories / Groups

Brendan Crosser-McGay interchange-users@interchange.redhat.com
Tue Feb 26 19:02:22 2002


This is a multi-part message in MIME format.

------=_NextPart_000_0004_01C1BEB8.6ADCCE00
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: 7bit

You need the new layout_auto attached here.

-----------------------------------------
Brendan Crosser-McGay
brendan@paymentonline.com
-----------------------------------------


> -----Original Message-----
> From: interchange-users-admin@interchange.redhat.com
> [mailto:interchange-users-admin@interchange.redhat.com]On 
> Behalf Of Jack
> Sasportas
> Sent: Tuesday, February 26, 2002 10:11 AM
> To: interchange-users@interchange.redhat.com
> Subject: [ic] Issue w/Foundation Store & Categories / Groups
> 
> 
> In the foundation store, I am having an issue with groups & 
> categories.
> I am basically trying to have categories & sub-categories per say.
> 
> Here is an example of what I am trying to accomplish:
> Football
> -Sports Cards
> -8x10
> Soccer
> -Sports Cards
> -8x10
> Baseball
> -Sports Cards
> -8x10
> 
> BUT, what happens is something like this
> 
> Football
> -Sports Cards
> 
> Soccer
> 
> Baseball
> -8x10
> 
> It seems to not allow the repeating of the categories.
> I have done this several times on our server, and even tried it on the
> demo store on redhat, so I know it's not a setting within our server
> configs / ic configs...
> 
> Currently the Groups are Baseball - Football - Soccer and the 
> categories
> are the 8x10, Sports Cards, etc..
> 
> Any help is appreciated !
> 
> Jack
> ______________________________________________________
> Jack Sasportas
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users
> 
------=_NextPart_000_0004_01C1BEB8.6ADCCE00
Content-Type: text/html;
	name="layout_auto.html"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="layout_auto.html"

[set page_title]Layout auto-populate[/set]=0A=
[set ui_class]Design[/set]=0A=
[set page_banner]Layout Editor: Organize your site into categories[/set]=0A=
[set page_perm]layout=3De[/set]=0A=
[set help_name]layout.edit[/set]=0A=
[set icon_name]icon_pages.gif[/set]=0A=
[tmp meta_header]=0A=
	[include include/table_populator]=0A=
	<SCRIPT LANGUAGE=3DJavaScript>=0A=
	  function change_ta (ta_field, selector) {=0A=
	  	if(selector =3D=3D 'complex') {=0A=
			ta_field.rows =3D 20;=0A=
			ta_field.disabled =3D false;=0A=
		}=0A=
		else {=0A=
			ta_field.rows =3D 1;=0A=
			ta_field.disabled =3D true;=0A=
		}=0A=
		return;=0A=
	  }=0A=
	</SCRIPT>=0A=
[/tmp]=0A=
[seti ui_body_extra][/seti]=0A=
=0A=
@_UI_STD_HEAD_@=0A=
<!-- ----- BEGIN REAL STUFF ----- -->=0A=
=0A=
<form action=3D"[area __UI_BASE__/layout]" method=3DGET>=0A=
<input type=3Dhidden name=3Dmv_action value=3Dback>=0A=
=0A=
<table border=3D0 __UI_T_PROPERTIES__>=0A=
<tr>=0A=
<td colspan=3D2 bgcolor=3D__UI_C_TOPBLOCKBAR__><img src=3D"bg.gif" =
width=3D__UI_MAIN_WIDTH__ height=3D1></td>=0A=
</tr>=0A=
=0A=
<tr bgcolor=3D"__UI_C_INTBLOCK__">=0A=
<td width=3D25%>=0A=
=0A=
1. Choose a table as the source:=0A=
=0A=
</td>=0A=
<td>=0A=
[if !value area_table]=0A=
	[value name=3Darea_table set=3Dproducts hide=3D1]=0A=
	[value name=3Darea_column set=3Dprod_group hide=3D1]=0A=
	[value name=3Dcat_column set=3Dcategory hide=3D1]=0A=
[/if]=0A=
<select name=3D"area_table"=0A=
	onChange=3D"=0A=
		populateTable(=0A=
            this.form.area_table.options,=0A=
            this.form.area_column.options,=0A=
            =
this.form.area_table.options[this.form.area_table.selectedIndex].value=0A=
            );=0A=
		populateTable(=0A=
            this.form.area_table.options,=0A=
            this.form.cat_column.options,=0A=
            =
this.form.area_table.options[this.form.area_table.selectedIndex].value=0A=
            );=0A=
	"=0A=
size=3D1>=0A=
[loop list=3D"[list-databases]" option=3Darea_table]=0A=
	<OPTION VALUE=3D"[loop-code]">[loop-code]</OPTION>=0A=
[/loop]=0A=
</select>=0A=
</td>=0A=
</tr>=0A=
<tr>=0A=
<td>=0A=
2. Choose a column to populate areas:=0A=
</td>=0A=
<td>=0A=
<select name=3D"area_column">=0A=
<option value=3D""> -- none --=0A=
[loop list=3D"[db-columns table=3D'[value area_table]']" =
option=3Darea_column]=0A=
<option>[loop-code]=0A=
[/loop]=0A=
</select>=0A=
</td>=0A=
</tr>=0A=
<tr>=0A=
<td>=0A=
3. Choose a column to populate categories:=0A=
</td>=0A=
<td>=0A=
<select name=3D"cat_column">=0A=
<option value=3D""> -- none --=0A=
[loop list=3D"[db-columns table=3D'[value area_table]']" =
option=3Dcat_column]=0A=
<option>[loop-code]=0A=
[/loop]=0A=
</select>=0A=
</td>=0A=
</tr>=0A=
<tr>=0A=
<td>=0A=
4. Choose a search type:=0A=
</td>=0A=
<td>=0A=
<select name=3D"cat_type" =
onChange=3D"change_ta(this.form.search_code,this.form.cat_type.value)">=0A=
<option value=3D"narrow"> Narrow search (area and category match)=0A=
<option value=3D"simple"> Simple search (only category matches)=0A=
<option value=3D"complex"> Complex search (template substitution on =
below)=0A=
</select>=0A=
</td>=0A=
</tr>=0A=
<tr>=0A=
<td valign=3Dtop>=0A=
5. Complex search code:=0A=
</td>=0A=
<td>=0A=
NOTE: Not active unless complex search selected above.<br>=0A=
<textarea rows=3D1 cols=3D50 name=3Dsearch_code disabled=3Dtrue>=0A=
	fi=3Dproducts=0A=
	st=3Ddb=0A=
	co=3Dyes=0A=
=0A=
	sf=3Dprod_group=0A=
	se=3D~PROD_GROUP~=0A=
	op=3Deq=0A=
=0A=
	sf=3Dcategory=0A=
	se=3D~CATEGORY~=0A=
	op=3Deq=0A=
=0A=
	sf=3Dinactive=0A=
	se=3D1=0A=
	op=3Dne=0A=
=0A=
	rf=3Dsku=0A=
=0A=
	va=3Dbanner_text=3D~BANNER_TEXT~=0A=
</textarea>=0A=
</td>=0A=
</tr>=0A=
<tr bgcolor=3D"__UI_C_INTBLOCK__">=0A=
<td>=0A=
6. Select the page class:=0A=
</td>=0A=
<td>=0A=
<INPUT NAME=3Dwhich_page VALUE=3Dall>=0A=
</td>=0A=
</tr>=0A=
<tr bgcolor=3D"__UI_C_INTBLOCK__">=0A=
<td>=0A=
7. Select the page area:=0A=
</td>=0A=
<td>=0A=
<INPUT NAME=3Dsel VALUE=3Dleft>=0A=
</td>=0A=
</tr>=0A=
<tr bgcolor=3D"__UI_C_INTBLOCK__">=0A=
<td>=0A=
8. Decide whether to remove previous settings:=0A=
</td>=0A=
<td>=0A=
<SELECT NAME=3Dnuke><OPTION VALUE=3D0>No <OPTION VALUE=3D1>Yes</SELECT>=0A=
</td>=0A=
</tr>=0A=
<tr>=0A=
<td>=0A=
9. Click this button to populate:=0A=
</td>=0A=
<td>=0A=
[button text=3D"Populate"]=0A=
[flag type=3Dwrite table=3D"area"]=0A=
[flag type=3Dwrite table=3D"cat"]=0A=
[seti ui_failure]=0A=
[perl tables=3D"area cat [cgi area_table]"]=0A=
	my $go_page =3D $CGI->{mv_nextpage};=0A=
	$CGI->{mv_nextpage} =3D '@@MV_PAGE@@';=0A=
	my $ptab =3D $CGI->{area_table}=0A=
		or return "no area source table";=0A=
	my $pdb =3D $Db{$ptab}=0A=
		or return "area source table bad";=0A=
	my $adb =3D $Db{area}=0A=
		or return "no area table";=0A=
	my $cdb =3D $Db{cat}=0A=
		or return "no cat table";=0A=
	my $acol =3D $CGI->{area_column};=0A=
	my $ccol =3D $CGI->{cat_column};=0A=
	if(! $acol and ! $ccol ) {=0A=
		return "no column to populate either";=0A=
	}=0A=
=0A=
	my $selector =3D '';=0A=
	my $selcode =3D '';=0A=
=0A=
	my %area_defaults =3D (=0A=
		name =3D> undef,=0A=
		which_page	=3D> $CGI->{which_page} || 'all',=0A=
		sort	=3D> '05',=0A=
		sel	=3D> $CGI->{sel} || 'left',=0A=
		display_type =3D> 'name',=0A=
	);=0A=
	my %catmap;=0A=
	my $narrow;=0A=
	my $lt;=0A=
	my $search_code;=0A=
	if($CGI->{cat_type} eq 'simple') {=0A=
		$lt =3D 'simple';=0A=
		$selector =3D 'category=3D~CATEGORY~';=0A=
		$search_code =3D '';=0A=
	}=0A=
	elsif($CGI->{cat_type} eq 'narrow') {=0A=
		$narrow =3D 1;=0A=
		$lt =3D 'simple';=0A=
		$selector =3D <<EOF;=0A=
category=3D~CATEGORY~=0A=
prod_group=3D~PROD_GROUP~=0A=
EOF=0A=
		$search_code =3D '';=0A=
	}=0A=
	else {=0A=
		$lt =3D 'complex';=0A=
		$selector =3D '';=0A=
		$search_code =3D $CGI->{search_code};=0A=
	}=0A=
=0A=
	my %cat_defaults =3D (=0A=
		link_type =3D> $lt,=0A=
		selector =3D> $selector,=0A=
		search =3D> $search_code,=0A=
		sort	=3D> '05',=0A=
		display_type =3D> 'name'=0A=
	);=0A=
=0A=
	if($CGI->{nuke}) {=0A=
		$adb->query('delete from area');=0A=
		$cdb->query('delete from cat');=0A=
	}=0A=
	if($acol) {=0A=
		$adb->config('AUTO_NUMBER', '1000') if ! $adb->config('_Auto_number');=0A=
		return "area column $acol doesn't exist"=0A=
			unless $pdb->column_exists($acol);=0A=
		my $ary =3D $pdb->query("select distinct $acol from $ptab order by =
$acol")=0A=
			or return "area column query failed";=0A=
		for(@$ary) {=0A=
			my ($area) =3D (@$_);=0A=
			my $key =3D $adb->set_row('');=0A=
			return "no autonumbering available" if ! $key;=0A=
			$catmap{$area} =3D $key;=0A=
			for(keys %area_defaults) {=0A=
				$adb->set_field($key, $_, $area_defaults{$_} || $area);=0A=
			}=0A=
		}=0A=
	}=0A=
=0A=
	my %catdone;=0A=
	if($ccol) {=0A=
		$cdb->config('AUTO_NUMBER', '1000') if ! $cdb->config('_Auto_number');=0A=
		return "cat column $ccol doesn't exist"=0A=
			unless $pdb->column_exists($ccol);=0A=
		my ($ary, $fh) =3D $pdb->query(=0A=
								"select $acol, $ccol from $ptab order by $ccol",=0A=
								)=0A=
			or return "cat column query failed";=0A=
		foreach my $row (@$ary) {=0A=
			my $area =3D $row->[$fh->{$acol}];=0A=
			my $cat  =3D $row->[$fh->{$ccol}];=0A=
			my $donetag =3D $narrow ? "$area:$cat" : $cat;=0A=
			next if $catdone{$donetag}++;=0A=
			my $key =3D $cdb->set_row('');=0A=
			return "no cat autonumbering available" if ! $key;=0A=
=0A=
			my %defaults =3D %cat_defaults;=0A=
			$defaults{name} =3D $cat;=0A=
			$defaults{sel} =3D $catmap{$area};=0A=
			$defaults{search} =3D~ s/~ (\w+) ~/$row->[$fh->{lc $1}]/gx;=0A=
			$defaults{selector} =3D~ s/~ (\w+) ~/$row->[$fh->{lc $1}]/gx;=0A=
			=0A=
			for(keys %defaults) {=0A=
				Log("setting col=3D$_ key=3D$key =3D $defaults{$_}");=0A=
				$cdb->set_field($key, $_, $defaults{$_});=0A=
			}=0A=
		}=0A=
	}=0A=
	$CGI->{mv_nextpage} =3D $go_page;=0A=
	my $out =3D $Tag->uneval( { ref =3D> \%catmap } );=0A=
	$out =3D~ s/,/,\n/g;=0A=
	#return '<XMP>' . $Tag->uneval( { ref =3D> \%catmap } ) . "</XMP";=0A=
	return;=0A=
[/perl]=0A=
[/seti]=0A=
[/button]=0A=
<BR>=0A=
</td>=0A=
</tr>=0A=
=0A=
<tr>=0A=
<td colspan=3D2 bgcolor=3D__UI_C_TOPBLOCKBAR__><img src=3D"bg.gif" =
width=3D__UI_MAIN_WIDTH__ height=3D1></td>=0A=
</tr>=0A=
=0A=
</table>=0A=
=0A=
</form>=0A=
=0A=
=0A=
<!-- ----- END REAL STUFF ----- -->=0A=
@_UI_STD_FOOTER_@=0A=
<!-- page: @@MV_PAGE@@ -->
------=_NextPart_000_0004_01C1BEB8.6ADCCE00--