[ic] Product Group Sort on Item Page (5.2) - Using reserved words
in the name
Gary Norton
gnorton at broadgap.com
Thu Aug 12 14:04:57 EDT 2004
I have product groups inside a catalog with the following type of names:
"Backpacks and Bags"
Notice the "and" in the name.
When I try to sort by Product group, I am taken to the appropriate
item_group.html page. All links work except the ones that have the "and" in
the name.
I think this is the appropriate are of the item_group.html page:
<SNIP>
if ($ui_text_qualification and $CGI->{ui_text_qualification} =~ /[<!=>\^]/ )
{
$CGI->{ui_text_qualification} = "co=1\n";
my @entries = split /\s+(and|or)\s+/i, $ui_text_qualification;
my $or;
for(@entries) {
if(/^or$/i) {
$or = 1;
$CGI->{ui_text_qualification} .= "os=1\n";
next;
}
elsif(/^and$/i) {
$or = 0;
$CGI->{ui_text_qualification} .= "os=0\n";
next;
}
my ($f, $op, $s) = split /\s*([<=!>\^]+)\s*/, $_, 2;
$op = "eq" if $op eq "==";
$op = "rm" if $op eq "=";
if($op eq '^') {
$op = 'rm';
$CGI->{ui_text_qualification} .= "bs=1\nsu=1\n";
}
else {
$CGI->{ui_text_qualification} .= "bs=0\nsu=0\n";
}
$CGI->{ui_text_qualification} .= "se=$s\nsf=$f\nop=$op\n";
if($op =~ /[<>]/ and $s =~ /^[\d.]+$/) {
$CGI->{ui_text_qualification} .= "nu=1\n";
}
else {
$CGI->{ui_text_qualification} .= "nu=0\n";
}
}
if(defined $or) {
$CGI->{ui_text_qualification} .= $or ? "os=1\n" : "os=0\n";
}
$out_message = <<EOF;
<H3>Entries matching "$ui_text_qualification"</H3>
EOF
}
</SNIP>
I belive that the problem is this line:
my @entries = split /\s+(and|or)\s+/i, $ui_text_qualification;
However, I am not sure how to address the problem. I don't understand regex
well enough to change this comfortably, and am not entirely sure this is the
correct (or only) place that needs to be changed.
Can anyone tell me if I am on the right track and perhaps offer
sugguestions?
Thanks,
Gary
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.732 / Virus Database: 486 - Release Date: 7/29/2004
More information about the interchange-users
mailing list