[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Setting a catalog variable on a page
On Thu, May 10, 2001 at 05:49:06PM -0700, Dan B wrote:
> At 04:33 PM 5/10/2001 -0400, you wrote:
> >How can I set a catalog variable from a page and have it persist?
> >
> >I want to do something like this:
> >
> >page1.html:
> >[perl]
> > $Variable->{sql_select_items} = 'SELECT * FROM items';
> > return;
> >[/perl]
If you are referring to the "Catalog Variable" as one might use
in the catalog.cfg, you can't (easily). By the time mv gets to the
page it has forked and whatever you set will die with that fork.
Let me guess, you are trying to redefine your catalog on the fly
according to user/merchant/product? If my guess is wrong, I probably
misread your question and the answer might be wrong too.
If not, I'll share what we do:
There already is Vend::Session->{values}. We store in that a
number of items, a hash %M as $values->{M}, an overall configuration
as $values->{SC}. These get dragged around (yeah, SC is big) with
the session. SC will someday get loaded at start up, but we never
seem to get out of prototype....
Anyway, SC, (site_config) is pretty much what you might use Catalog
Variables for. It defines page layout, image sizes, tables
available, templates - a lot of the things in the typical catalog.cfg.
M is a lot lighter, it defines a merchant, their names and payment
types, fine print, address block. It overrides some things within
the larger context defined by SC. (That makes sense to me. :-)...)
So rather than setting a catalog variable, we have an init routine
for each page psuedo code:
load_M(asdf) unless($values->{M});
load_SC(asdf) unless($values->{SC});
I've not looked into AUTOLOAD; that might well be appropriate.
Anyway, if you learn how to stuff a hash into the session and retrieve
it you can do anything.
cfm
--
Christopher F. Miller, Publisher cfm@maine.com
MaineStreet Communications, Inc 208 Portland Road, Gray, ME 04039
1.207.657.5078 http://www.maine.com/
Content management, electronic commerce, internet integration, Debian linux
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users