[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: How can i show the item-quantity in my resultspage?
****** message to minivend-users from Larry Leszczynski <larryl@furph.com> ******
Hello Joachim -
> with nice helping from Larry, i am able to increase the
> item_order_quantity. Thank you very mutch, Larry!
You are welcome!
> Now, i want to show this item_order_quantity or item-quantity in my
> resultspage. I want to show my visitor, what item is ordered or not (if
> ordered tag work well). If an item is ordered, i will show the quantity
> of an ordered items and have no clue to do that!
Here is one way to do it, maybe not the most efficient but it works. It
puts all items in the cart even if they have quantity=0, so you can use
[item-list] to show the customer all the items available. You would need
to put it at the top of ord/basket.html, you can see an example at:
http://www.campandschooloutfitter.com/cgi-bin/brodys/ord/campwear
It uses a data field called "number" to control the sort order of the
items as they appear in the basket, but you could do that a variety of
other ways.
[perl arg="carts" interpolate=1]
# get a list of all product codes:
my @codes = qw(
[tag each products][sort products:number:n][loop-code] [/tag] );
if ( defined $Safe{'carts'}->{'main'} ) {
# Save a copy of the cart, and empty out the real one:
my $cart = $Safe{'carts'}->{'main'};
$Safe{'carts'}->{'main'} = [];
# If products already exists in cart, move it to main cart,
# otherwise, add it to main cart with quantity 0:
foreach my $code ( @codes ) {
if ( $cart->[0] && $cart->[0]->{'code'} eq $code ) {
push @{$Safe{'carts'}->{'main'}}, shift @{$cart};
}
else {
push @{$Safe{'carts'}->{'main'}}, { 'code' => $code,
'quantity' => 0,
'mv_ib' => 'products' };
}
}
}
else {
# No main cart, so create one and add all items with quantity 0:
$Safe{'carts'}->{'main'} = [];
foreach my $code ( @codes ) {
push @{$Safe{'carts'}->{'main'}}, { 'code' => $code,
'quantity' => 0,
'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