[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: patch for slipping modification index
Quoting edstrom@teleport.com (edstrom@teleport.com):
>
> A patch for lib/Vend/Interpolate.pm version 3.14 to eliminate slipage of
> modifier index when items are deleted from the middle of the shopping
> cart.
>
>
> 3461,3467d3460
> < unless (defined($item->{NN}) and $item->{NN} >= 0) {
> < if (defined $cart->[$#$cart]->{NN}) {
> < $item->{NN} = $cart->[$#$cart]->{NN} + 1;
> < } else {
> < $item->{NN} = $i;
> < }
> < }
> 3469d3461
> < my $NN = $item->{NN};
> 3487c3479
> < $run =~ s:$T{'modifier-name'}$Spacef(\w+)\]:$1$NN:go;
> ---
> > $run =~ s:$T{'modifier-name'}$Spacef(\w+)\]:$1$i:go;
>
Hmm -- this might make some sense in a different context. But as it is,
I won't be adding it.
Normally, if you are using "NewTags Yes" and do any modifications to the
cart _before_ you use the [item-list] containing [modifier-name ...],
then there should be no trouble.
The best place to do cart modifications is the Autoload macro
or an mv_click.
For all users, all the time:
Autoload [perl arg=carts] CODE [/perl]
(using a UserTag is better for speed here)
or for any user accessing a shopping cart, place in ord/basket.html:
[set Something]
[perl arg=carts] CODE [/perl]
[/set]
[data base=session field=Autoload value="[scratch Something]"]
or only on form submission:
[set Something]
[perl arg=carts] CODE [/perl]
[/set]
<INPUT TYPE=hidden NAME=mv_click VALUE=Something>
--
Mike Heins http://www.minivend.com/ ___
Internet Robotics |_ _|____
131 Willow Lane, Floor 2 | || _ \
It's a little-known fact Oxford, OH 45056 | || |_) |
that the Y1K problem caused <mikeh@minivend.com> |___| _ <
the Dark Ages. -- unknown 513.523.7621 FAX 7501 |_| \_\