[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] [PATCH] Accept scratch variable in simple search with bar_link
--=-=-=
This is something I've done twice now. This version is pretty
straight forward. In the admin UI for the site layout you can specify
a simple search for the categories. Typically this affects the
left-side links, but also some of the top links. The usage is
something like this:
category=foobar
This does a search on the products table where "category=foobar" or
"sf=categroy/se=foobar". OK, I think we all understand the way that
works. What I've done is change it where you can add scratch
variables to the list of simple searches like this:
category=foobar
prod_group=[scratch my_prod_group]
The purpose is to let the user fill out a form somewhere that sets a
scratch variable. You can then use that scratch variable to do
selective searches. In my case, I'm building a cellphone accessories
catalog and want to limit category searches to those items that are
compatible with the shopper's phone.
Anyway, it's a simple patch to the bar_link sub. I hope that either
1) Mike will commit this change to CVS so the next release of IC will
support this; or 2) Someone will come back with a way for me to make
this change local to a catalog so I don't have to keep patching IC
with each release. :)
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=catalog_before.patch
Content-Description: Make bar_link parse scratch variables on simple searches
--- /usr/lib/interchange/catalog_before.cfg Sat Dec 1 17:21:24 2001
+++ catalog_before.cfg Sat Feb 23 15:00:33 2002
@@ -129,6 +129,11 @@
push @out, "co=yes";
for(@items) {
my ($col, $string) = split /\s*=\s*/;
+ if ($string =~ /\[scratch (\w+)\]/) {
+ my $variable = $1;
+ next unless ($Scratch->{$variable});
+ $string = $Scratch->{$variable};
+ }
push @out, "sf=$col";
push @out, "se=$string";
}
--=-=-=
--
(__) Doug Alcorn (mailto:doug@lathi.net http://www.lathi.net)
oo / PGP 02B3 1E26 BCF2 9AAF 93F1 61D7 450C B264 3E63 D543
|_/ If you're a capitalist and you have the best goods and they're
free, you don't have to proselytize, you just have to wait.
--=-=-=--