[ic] prepend to PageSelectField
Mike Heins
interchange-users@icdevgroup.org
Tue Dec 24 13:25:00 2002
Quoting Mike Heins (mike@perusion.com):
> There would be another way, via GlobalSub and Autoload. You just check
> the path for a valid product code, and set
> $Vend::Cfg->{Special}{flypage} accordingly when you find one.
>
> GlobalSub <<EOR
> sub munge_flypage {
> my $code = $Vend::FinalPath;
> $code =~ s/\.html?$//;
> $code =~ s:^/::;
> my $db = Vend::Data::product_code_exists_ref($code)
> or return;
> my $template = $db->field($code, $Vend::Cfg->{PageSelectField})
> or return;
> $Vend::Cfg->{Special}{flypage} = "f_$template";
> }
> EOS
>
> Then in catalog.cfg you put "Autoload munge_flypage".
By the way, this last would actually be bad in some situations. Though
you will typically open the product database on most pages, this ensures
that you do even for mv_tmp_session pages. Also, if you wanted to later
flag it for write you would not be able to (though the default SQL mode
write-enables anyway).
--
Mike Heins
Perusion -- Expert Interchange Consulting http://www.perusion.com/
phone +1.513.523.7621 <mike@perusion.com>
I am a great believer in luck, and I find that the harder I work
the more luck I have. -- Thomas Jefferson