[ic] Use full tip for order.profiles

Murray Gibbins Murray@scotweb.ltd.uk
Mon, 19 Feb 2001 16:20:06 +0000

Once I was asked to do some complicated checking,
basically we had shipping and billing addresses
and a check box to say the shipping address was
the same as the billing address. I had to make
sure that every thing went thought ok.

So I created a file called "copy_check" in "/etc/minivend/etc/"

Added "#include /etc/minivend/etc/copy_check" in interchange.cfg

(I am using interchange 4.6.3)

inside copy_check was ...


GlobalSub <<EOF
sub set_up_extra_check {
	    package Vend::Order;
	    sub _check_copy_and_ship_address {


		# $ref is to Vend::Session->{'values'} hash
		# $var is the passed name of the variable
		# $val is current value of checked variable
		my($ref, $var, $val) = @_;

		#::logDebug("\$var = $var");
		#::logDebug("\$val = $val");		
		if(( $var eq "copy") && ($val =~ /billing/oi)){
		    return 1,"copy","Ouch, not copy";

		    my @array = (0,"Ship Address","Ouch not copy");

		    return @array if !$ref->{shipname};
		    return @array if !$ref->{shipemail};
		    return @array if !$ref->{shipaddress};
		    return @array if !$ref->{shipcity};
		    return @array if !$ref->{shipzip};

		    return (0,"Ship Address","Ouch not copy");
		return (0,"Ship Address","Ouch not copy");




and inside /etc/order.prefiles was ......


name=required We need to know your name .
address=required We need to know where to send the products.
zip=required The postal services like to have zip codes.
email=required We need your email address.
address=required We need your address.
city=required We need your town/city name.
zip=required We need your zip/postcode.
copy=check_copy_and_ship_address We need to know where to send your package.
&set = mv_payment Credit Card
&set = mv_successpage ord/final


it worked a treat :-)

  \__/    Murray Gibbins             murray@scotweb.ltd.uk
  /  \    Programmer
_ \__/ _  ================================================
\\ || //  Scotweb Limited,             info@scotweb.ltd.uk
 \\||//   13a Albert Terrace,    http://www.scotweb.ltd.uk
  \||/    Edinburgh EH10 5EA   Tel: +44 (0)  131 270 82 33
   ||     Scotland. Europe.    Fax: +44 (0) 7020  93 49 04