[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: HELP: perl variable in a minivend tag
Kyle! my savior :)
Everything is running smoothly now. I do belive the 'uses' were necessary as it couldnt seem
to locate database_field without them.
I think this will help alot of ppl out as it's the first i've ever seen this function
mentioned anywhere. Perhaps its time for me to print out the source and have a nice long read
;)
Thanks Again,
Ezra
Kyle Hayes wrote:
> ****** message to minivend-users from Kyle Hayes <kyle540@quicknet.net> ******
>
> Ah Grasshopper, one must look long and hard (and in the source) for
> answers:
>
> UserTag ...<<EOT
>
> use Vend::Util;
> use Vend::Data;
> use Vend::Cart;
> use Vend::Server;
> ...
> my $weight = database_field('products',$code,'weight');
> ...
> EOT
>
> I am not sure you need the "use" constructs there, but they don't seem to
> hurt. database_field takes three arguments (actually more I think, but
> check in <MV root>/lib/Vend/Data.pm to make sure). The first is the name
> of the database. The second is the key value and the third is the column
> you want to bring back.
>
> You can't have interpolated tags in a UserTag's definition as far as I
> know. I believe the UserTags are all compiled once at load time.
>
> You example would be:
>
> my $GRS = database_field('products',$code,'GRS');
>
> Best,
> Kyle
>
> On Wed, 28 Jul 1999, Ezra Gilbert wrote:
>
> > ****** message to minivend-users from Ezra Gilbert <egilbert@cybernex.net> ******
> >
> > I'm running into some trouble with interpolation. How can I use a perl
> > variable within a minivend tag? What I'm attempting to do is as follows:
> > [perl interpolate=1]
> > $code = [item-code];
> > $GRS = [data products GRS $code];
> > [/perl]
> > The above doesn't work.
> > Yes, I know I can just do [data products GRS [item-code]] in this case but
> > this is just a test for what I really want to do. I need to be able to look
> > up a field in a usertag like so:
> > UserTag price-mod Routine <<EOR
> > sub {
> > my $item = $Vend::Interpolate::item;
> > my $code=$item->{code};
> > my $GRS=[data products GRS $code];
> > return $GRS;
> > }
> > I tried setting the item-code to a value/scratch variable and doing [data
> > products GRS [value code]]/[data products GRS [scratch code]] except that
> > gives me the following errors, respectively, in debug mode:
> > Died in server spawn: There is no row with index '[value' at
> > /var/www/virtual/jewelp/mvend/lib/Vend/Table/DB_File.pm line 181.
> > Died in server spawn: There is no row with index '[value' at
> > /var/www/virtual/jewelp/mvend/lib/Vend/Table/DB_File.pm line 181.
> >
> > I have searched through the mail list archive and found similar problems but
> > no working solution. As have I read the documentation to no avail.
> >
> > I have been working on this for litteraly weeks and am quite sure someone
> > experienced must have come into this at some point and I am equally sure
> > there is a way to do it, I just haven't found it yet :(
> >
> > Please, please, please, with a cherry on top ;)
> > Ezra
> >
> > -
> > 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