[interchange] In carts, provide prevention for item attributes migrating to other items
Josh Lavin
interchange-cvs at icdevgroup.org
Thu Mar 13 20:48:20 UTC 2014
commit 01b3df9d13b58d2a4ee9c146eac176df10fdefb1
Author: Josh Lavin <josh at perusion.com>
Date: Thu Mar 13 13:42:52 2014 -0700
In carts, provide prevention for item attributes migrating to other items
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.
lib/Vend/Order.pm | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/lib/Vend/Order.pm b/lib/Vend/Order.pm
index 11d8afd..5944598 100644
--- a/lib/Vend/Order.pm
+++ b/lib/Vend/Order.pm
@@ -22,6 +22,7 @@
# MA 02110-1301 USA.
package Vend::Order;
+use Vend::Error;
require Exporter;
$VERSION = '2.110';
@@ -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}) {
More information about the interchange-cvs
mailing list