[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] Setting a catalog variable on a page
I have built a table, queries, for storing my SQL queries with names for
them. At interchange startup the queries table is read and a Variable is
set to hold the value of the SQL statement like this:
Variable sql_select_items SELECT * FROM
items
Now we can say things like this:
[query
list=1
table=items
sql=|__sql_select_items__|
]
[list]some stuff<br>[/list]
[/query]
We did this because many of the SQL queries were getting long and
complicated and we wanted an easier way to handle them.
Now a developer would like to change the query using a IC page. We are
able to make updates to the query table of course but how do we change the
value of the Variable and have it be available catalog wide?
I just tried using &Vend::Control::add_catalog("Catalog catalog") and it
will reconfig the catalog and therefore set my catalog variables with
their new values. Is this my best bet?
Bill Carr
Worldwide Impact
bill@worldwideimpact.com
413.253.6700
cfm@maine.com
Sent by: interchange-users-admin@developer.akopia.com
05/10/2001 09:28 PM
Please respond to interchange-users
To: interchange-users@developer.akopia.com
cc:
Subject: 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
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users