[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
[mv] [data session arg] and [scratch foo] in UserTag
****** message to minivend-users from Ken Berland <ken@hero.com> ******
Thanks everyone. If mvend is a little defficent in documentation, the
stength of this list makes up for it. Got it to work. this usertag reads
from [data session arg] and writes to three scratch variables. I was doing
it in a [perl] tag that I've also included. Maybe we should add a section
to the web site of working code snippets?
#from catalog.cfg
UserTag cat-set Routine <<EOF
sub
{
my($input)=$Vend::Session->{'arg'};
if($input=~/item=(.+)/){
$::Scratch->{'my-e-item'}=$::Scratch->{'my-item'}=$1;
$::Scratch->{'my-e-item'}=~s/'/\\'/g;
}else{
$::Scratch->{'my-item'}="";
$::Scratch->{'my-e-item'}="";
}
if($input=~/cat=(.+)/){
$::Scratch->{'my-cat'}=$1;
}
return "";
}
EOF
This is the way I was doing it in a perl tag
<!-- from category.html -->
[perl arg=scratch]
my($input)=$Safe{scratch}{'arg-input'};
if($input=~/item=(.+)/){
$Safe{scratch}{'my-e-item'}=$Safe{scratch}{'my-item'}=$1;
$Safe{scratch}{'my-e-item'}=~s/'/\\'/g;
}else{
$Safe{scratch}{'my-item'}=""
}
if($input=~/cat=(.+)/){
$Safe{scratch}{'my-cat'}=$1;
}
"";
[/perl]
On Tue, 4 Jan 2000, Eric Frisch wrote:
> ****** message to minivend-users from "Eric Frisch" <ericf@conetra.com> ******
>
> I have not directly accessed [data session arg]. I grep'd the following out
> of the source, maybe worth a try:
>
> $Vend::Session->{'arg'}
>
> Anticipating the next question, here are a couple other useful samples:
>
> $::Values->{'mv_searchspec'}
> $CGI::values{foo}
>
> It was brutal figuring this stuff out the first time, there are very few
> references in the mail archive on accessing and setting these things. I am
> always afraid that I am going to trash some internal data structure and
> destabilize MV by doing this, one may want to tread carefully . . .
>
> Eric Frisch
>
> > -----Original Message-----
> > From: owner-minivend-users@minivend.com
> > [mailto:owner-minivend-users@minivend.com]On Behalf Of Ken Berland
> > Sent: Friday, January 07, 2000 2:13 PM
> > To: minivend-users@minivend.com
> > Subject: RE: [mv] $Safe{scratch} in a UserTag?
> >
> >
> > ****** message to minivend-users from Ken Berland
> > <ken@hero.com> ******
> >
> > This works.
> > Now how about getting at [data session arg] in a UserTag?
> > (I tried $::Session->{'arg'} to no avail. I know I can set it to a
> > scratch variable before doing the userTag, but thats 2 tags instead of
> > one. If you can get at $::Scratch, session arg must be there ?
> >
> > On Fri, 7 Jan 2000, Eric Frisch wrote:
> >
> > > ****** message to minivend-users from "Eric Frisch"
> > <ericf@conetra.com> ******
> > >
> > > Try this, it works for me. I am no MV guru so if someone
> > things I am doing
> > > something very bad I would be happy to hear about it.
> > >
> > > $::Scratch->{'yuks'}='foo';
> > >
> > > Eric Frisch
> > >
> > > > -----Original Message-----
> > > > From: owner-minivend-users@minivend.com
> > > > [mailto:owner-minivend-users@minivend.com]On Behalf Of Ken Berland
> > > > Sent: Thursday, January 06, 2000 10:49 PM
> > > > To: minivend-users@minivend.com
> > > > Subject: [mv] $Safe{scratch} in a UserTag?
> > > >
> > > >
> > > > ****** message to minivend-users from Ken Berland
> > > > <ken@hero.com> ******
> > > >
> > > > I've got the following [perl] code that I'd like to move to
> > UserTag in the
> > > > catalog.cfg so I can be neater, cleaner person. Minvend
> > V3.14-3 doesn't
> > > > like the same syntax in the usertag as in the [perl], I got
> > this error on
> > > > statup:
> > > >
> > > > [06/January/2000:19:47:57 -0800] - - UserTag 'cat_set' code is not a
> > > > subroutine reference
> > > > > In line 1527 of the configuration file 'catalog.cfg':
> > > > > UserTag cat-set Routine <<EOF
> > > >
> > > > So, I tried changing $Safe{scratch}{yuks}="works"; to
> > > > $Vend::Safe->{scratch}->{yuks}="foo"; but that doesn't seem to work.
> > > > How do i reference my scratch vars inside a UserTag? TIA.
> > > >
> > > > <!-- Working way, in html -->
> > > > [perl]
> > > > $Safe{scratch}{yuks}="works";
> > > > [/perl]
> > > > [scratch yuks]
> > > >
> > > > <!-- Broken attempt from catalog.cfg -->
> > > > UserTag cat-set Routine <<EOF
> > > > sub
> > > > {
> > > > $Vend::Safe->{scratch}->{yuks}="foo";
> > > > return "Did usertag<BR>";
> > > > }
> > > > EOF
> > > >
> > > > -
> > > > To unsubscribe from the list, DO NOT REPLY to this message.
> > Instead, send
> > > > email with 'UNSUBSCRIBE minivend-users' in the body to
> > > > Majordomo@minivend.com.
> > > > Archive of past messages:
> > http://www.minivend.com/minivend/minivend-list
> > > >
> > >
> > > -
> > > To unsubscribe from the list, DO NOT REPLY to this message.
> > Instead, send
> > > email with 'UNSUBSCRIBE minivend-users' in the body to
> > Majordomo@minivend.com.
> > > Archive of past messages: http://www.minivend.com/minivend/minivend-list
> > >
> >
> > -
> > To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
> > email with 'UNSUBSCRIBE minivend-users' in the body to
> > Majordomo@minivend.com.
> > Archive of past messages: http://www.minivend.com/minivend/minivend-list
> >
>
> -
> To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
> email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> Archive of past messages: http://www.minivend.com/minivend/minivend-list
>
-
To unsubscribe from the list, DO NOT REPLY to this message. Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list