Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
In carts, provide prevention for item attributes migrating to other i…
…tems

This can happen due to a user's removal of an item and subsequent use of Back button.

Requires setting of CGI parameter in ord/basket.html and other cart modification pages:
<input type="hidden" name="mv_nlines" value="[nitems lines=1]">

By Mike Heins.
  • Loading branch information
Josh Lavin committed Mar 13, 2014
1 parent 8cf1f55 commit 01b3df9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/Vend/Order.pm
Expand Up @@ -22,6 +22,7 @@
# MA 02110-1301 USA.

package Vend::Order;
use Vend::Error;
require Exporter;

$VERSION = '2.110';
Expand Down Expand Up @@ -2063,6 +2064,15 @@ my @Scan_modifiers = qw/
sub update_quantity {
return 1 unless defined $CGI::values{"quantity0"}
|| $CGI::values{mv_quantity_update};

if ( my $n = $CGI::values{mv_nlines} ) {
my $check = scalar(@$Vend::Items);
if ( $n != $check ) {
Vend::Error::interaction_error();
return undef;
}
}

my ($h, $i, $quantity, $modifier, $cart, $cartname, %altered_items, %old_items);

if ($CGI::values{mv_cartname}) {
Expand Down

0 comments on commit 01b3df9

Please sign in to comment.