Akopia Akopia Services

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

Re: [mv] stacked mv_order_item and mv_order_quantity PATCH



******    message to minivend-users from cfm@maine.com     ******


Thi is a patch that seems to fix the issue in this case.  Don't
apply it without inspecting it!  Nor can I speak for other
consequences it may cause.

Bottom line I think the scope of $item needed to be
only the foreach loop here:

       my $set;
        foreach $code (@items) {
!           my($item);  # cfm

This on minivend 4.03

cfm


*** Order.pm	Thu Aug  3 17:49:44 2000
--- Order.pm-bak	Thu Aug  3 16:41:31 2000
***************
*** 1650,1659 ****
  
  	$items = $CGI::values{mv_order_item} if ! defined $items;
  
  	return unless $items;
  
! 	my($code,$found,$base,$quantity,$i,$j,$q);
! #	my($code,$found,$item,$base,$quantity,$i,$j,$q);
  	my(@items);
  	my(@quantities);
  	my(@bases);
--- 1650,1666 ----
  
  	$items = $CGI::values{mv_order_item} if ! defined $items;
  
+ 	# cfm
+ 	{
+ 	    my($s);
+ 	    $s=$items;
+ 	    $s=~ s/\000/|/g;
+ 	    ::logGlobal("items is ($s)");  # cfm
+ 	}
+ 	# /cfm
  	return unless $items;
  
! 	my($code,$found,$item,$base,$quantity,$i,$j,$q);
  	my(@items);
  	my(@quantities);
  	my(@bases);
***************
*** 1672,1677 ****
--- 1679,1694 ----
  
  	@items      = split /\0/, ($items), -1;
  	@quantities = split /\0/, ($quantities || delete $CGI::values{mv_order_quantity} || ''), -1;
+ 
+ 	# cfm
+ 	{
+ 	    my($s);
+ 	    $s="@items";
+ 	    ::logGlobal("items array ($s)");
+ 	    $s='';
+ 	    $s="@quantities";
+ 	    ::logGlobal("quantities array ($s)");
+ 	}
  	@bases      = split /\0/, delete $CGI::values{mv_order_mv_ib}, -1
  		if defined $CGI::values{mv_order_mv_ib};
  	@lines      = split /\0/, delete $CGI::values{mv_orderline}, -1
***************
*** 1711,1721 ****
  	$j = 0;
  	my $set;
  	foreach $code (@items) {
! 	    my($item);  # cfm
         $quantity = defined $quantities[$j] ? $quantities[$j] : 1;
         ($j++,next) unless $quantity;
  	   $set = $quantity =~ s/^=//;
- 	    ::logGlobal("foreach code,quantity[$j] is $code,$quantities[$j],$quantity,$set"); # cfm
  	    if(! $fly[$j]) {
  			$base = product_code_exists_tag($code, $bases[$j] || undef);
  		}
--- 1728,1737 ----
  	$j = 0;
  	my $set;
  	foreach $code (@items) {
! 	  
         $quantity = defined $quantities[$j] ? $quantities[$j] : 1;
         ($j++,next) unless $quantity;
  	   $set = $quantity =~ s/^=//;
  	    if(! $fly[$j]) {
  			$base = product_code_exists_tag($code, $bases[$j] || undef);
  		}
***************
*** 1764,1770 ****
  					# the standard handling because we are ordering
  					# accessories, and may want more than 1 of each
  					$cart->[$i]{quantity} = $set ? $quantity : $cart->[$i]{quantity} + $quantity;
- 
  				}
  			}
  		} # INCREMENT
--- 1780,1785 ----
***************
*** 1772,1778 ****
  		# And if not, start with a whole new line.
  		# If mv_orderline is set, will replace a line.
  		if ($found == -1) {
- 		    ::logGlobal("item exists:$item") if $item; # cfm
  			$item = {'code' => $code, 'quantity' => $quantity, mv_ib => $base}
  				if ! $item;
  
--- 1787,1792 ----



On Thu, Aug 03, 2000 at 05:28:05PM -0400, cfm@maine.com wrote:
> ******    message to minivend-users from cfm@maine.com     ******
> 
> 
> Re stacked mv_order_item and mv_order_quantity:
> 
> This little snippet works for us in 3.14 but fails
> in mv4.03.  It's very possible this is something
> we have broken and not minivend.  Does anyone have 
> anything like this working in mv4?  It simply puts
> all products on a page for ordering (code is much 
> simplified for purposes of this email).
> 
> cfm
> 
> 
> <INPUT TYPE=SUBMIT VALUE=ORDER>
> CV.250
> <INPUT TYPE=HIDDEN NAME="mv_order_item" VALUE="CV.250">
> <INPUT NAME="mv_order_quantity" TYPE=TEXT>
> CLEAR GLOSS VARNISH, 250 ml $11.00<BR>
> 
> 
> CV.500
> <INPUT TYPE=HIDDEN NAME="mv_order_item" VALUE="CV.500">
> <INPUT NAME="mv_order_quantity" TYPE=TEXT>
> CLEAR GLOSS VARNISH, 500 ml $17.00<BR>
> 
> CV.1000
> <INPUT TYPE=HIDDEN NAME="mv_order_item" VALUE="CV.1000">
> <INPUT NAME="mv_order_quantity" TYPE=TEXT>
> CLEAR GLOSS VARNISH, 1000 ml $31.50<BR>
> 
> 
> CV.5000
> <INPUT TYPE=HIDDEN NAME="mv_order_item" VALUE="CV.5000">
> <INPUT NAME="mv_order_quantity" TYPE=TEXT>
> CLEAR GLOSS VARNISH, 5000 ml $151.75<BR>
> 
> What it does now is this:
>  Vend::Session->{'carts'} - HASH(0x83de440)
>      Vend::Session->{'carts'}->{'main'} - ARRAY(0x8b43614)
>          Vend::Session->{'carts'}->{'main'}->[3] - HASH(0x83dd930)
>              Vend::Session->{'carts'}->{'main'}->[3]->{'quantity'} - 1
>              Vend::Session->{'carts'}->{'main'}->[3]->{'mv_ib'} - products
>              Vend::Session->{'carts'}->{'main'}->[3]->{'code'} - CV.250
>          Vend::Session->{'carts'}->{'main'}->[2] - HASH(0x83dd930)
>              Vend::Session->{'carts'}->{'main'}->[2]->{'quantity'} - 1
>              Vend::Session->{'carts'}->{'main'}->[2]->{'mv_ib'} - products
>              Vend::Session->{'carts'}->{'main'}->[2]->{'code'} - CV.250
>          Vend::Session->{'carts'}->{'main'}->[1] - HASH(0x83dd930)
>              Vend::Session->{'carts'}->{'main'}->[1]->{'quantity'} - 1
>              Vend::Session->{'carts'}->{'main'}->[1]->{'mv_ib'} - products
>              Vend::Session->{'carts'}->{'main'}->[1]->{'code'} - CV.250
>          Vend::Session->{'carts'}->{'main'}->[0] - HASH(0x83dd930)
>              Vend::Session->{'carts'}->{'main'}->[0]->{'quantity'} - 1
>              Vend::Session->{'carts'}->{'main'}->[0]->{'mv_ib'} - products
>              Vend::Session->{'carts'}->{'main'}->[0]->{'code'} - CV.250
> 
> When we order qty 1,2,3,4
> 
> -- 
> 
> Christopher F. Miller, Publisher                             cfm@maine.com
> MaineStreet Communications, Inc         208 Portland Road, Gray, ME  04039
> 1.207.657.5078                                       http://www.maine.com/
> Database publishing, e-commerce, office/internet integration, Debian linux.
> -
> 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

-- 

Christopher F. Miller, Publisher                             cfm@maine.com
MaineStreet Communications, Inc         208 Portland Road, Gray, ME  04039
1.207.657.5078                                       http://www.maine.com/
Database publishing, e-commerce, office/internet integration, Debian linux.
-
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: