MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: A few questions...



Larry,
Can I use this same method to set a modifier off of my flypage?  i use an [item_accessories
length] on flypage.html and when order is clicked i see that $item->{length} is not set.
The only time it gets set is when i also have a [item_accessories length] on basket.html and
then a length is selected and you push recalc.  I'd like to set $item->{length}to the
default (*'d) value for that item. ie: if the value of an items length is
"1=1,2=2,3=3*,4=4"  it would get an initial value of 3.  That would make sense as 3 would be
the initial selected value when [item_accessories length] builds a select box.

I have the following code to use the *'d length or the first one if there is no *'d value:
## BEGIN LENGTH CODE
        my $lngth = database_field('products',$code,'length');
        my @lengths = split(/,/, $lngth);
        if ($lngth =~ /\*/) {
            for (my $i=0; $i<@lengths; $i++)
            {
                if($lengths[$i] =~ /\*/) {
                    $lngth = substr($lengths[$i],0,-1);
                }
            }
        } else {
            $lngth = $lengths[0];
        }
        my @newlength = split(/=/,$lngth);
        my $length = $newlength[1];
## END LENGTH CODE

I just need to set $item->{length}=$length somehow...

Any help would be appreciated,
Ezra

Larry Leszczynski wrote:

> ******    message to minivend-users from Larry Leszczynski <larryl@furph.com>     ******
>
> Hi Trevor -
>
> > Is there a way to reference all the attributes of the shopping cart
> > items inside a [perl] construct?  I have seen reference various times to
> > things like $Safe::Session and the like, but have avsolutely no
> > understanding of how they work, and can find no help in the
> > documentation.
>
> Here's some example code that might point you in the right direction:
>
> [perl arg="carts"]
>
>    # Loop over all items in cart:
>    foreach my $item ( @{$Safe{'carts'}->{'main'}} ) {
>
>       print "item code = " . $item->{'code'}     . "<br>\n";
>       print "quantity  = " . $item->{'quantity'} . "<br>\n";
>
>       # See if any modifiers:
>       print "color = " . $item->{'color'} . "<br>\n"
>          if exists $item->{'color'};
>       print "size  = " . $item->{'size'}  . "<br>\n"
>          if exists $item->{'size'};
>    }
>
>    # Add an item to the cart:
>    #   Note: "mv_ib" is the product file in which the product exists
>    push @{$Safe{'carts'}->{'main'}}, {
>                                        'code'     => 'abc123',
>                                        'quantity' => 3,
>                                        'color'    => 'blue',
>                                        'mv_ib'    => 'products',
>                                      };
> [/perl]
>
> Larry Leszczynski
> larryl@furph.com
> --
>   furph, Inc.   WWW/Unix/Windows Solutions      734-513-7763 (voice)
> info@furph.com     http://www.furph.com         734-513-7759 (FAX)
>
> -
> 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



Search for: Match: Format: Sort by: