Akopia Akopia Services

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

Re: [mv] page with only one ordered item and full basket functionality



******    message to minivend-users from Mike Heins <mikeh@minivend.com>     ******

Quoting Markus M|ller (ASS Software Odw.) (mueller@ass-software.de):
> 
> Hi list,
> 
> 
> I have to create a page where only one of all the ordered
> items is shown but I need full basket functionality (changing
> quantity, deleting item...).
> 
> I got the following tip from the german list: 
> 
> basket.html 
> [area href="otherpage" arg="[item-code]"]
> 
> otherpage.html
> [loop list="[data session arg]"]
> ...
> [/loop]
> 
> The problem is that when using the code above I can not change
> the quantity because mvend does not render the [quantity-name]
> and [item-quantity] (or [loop-quantity]).
> 
> Any hints?
> 

There are any number of ways, but you need to know which items are not
to be shown. One way would be to set a "hidden" modifier with a "hidden"
field in the database, then load it automatically into the cart with
this in catalog.cfg:

    AutoModifier  hidden

Now you can do:

[item-list]
   [if-item-modifier hidden]
   [else]
	Show the item: [item-code]
   [/else]
   [/if]
[/item-list]

Also, remember that the cart is nothing but an array of hash
references. You can program almost anything with embedded Perl.

[perl]
	my $cart = $Carts->{main};
	my $wanted = $Session->{arg};

	for(@$cart) {
	    $cart->{hidden} = 1 unless $cart->{code} eq $wanted;
	}

	for(@$cart) {
	    next if $cart->{hidden};
	    $out .= <<EOF;
Here is the item, $cart->{code}. You have $cart->{quantity} in your basket.<BR>
EOF
	}

	return $out;
[/perl]

-- 
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

Light travels faster than sound. This is why some people appear bright
until you hear them speak. -- unknown
-
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: