[ic] shipmode validation

Stefan Hornburg (Racke) racke at linuxia.de
Thu Dec 4 13:15:44 UTC 2008


Adam Lambert wrote:
>     I am trying to figure out how to get some code to do the following
> two tasks.
> 
> 1.  In confirm.html - I want to validate that shipmode is valid for the
> country code of the ship to address.
> 2.  If shipmode not valid, kick them back to checkout.html to have the
> shipmode reset/recalculated.
> 
>     If anyone has some pointers for me on how to accomplish this, it
> would be greatly appreciated.
> 
> Thanks,
> 

I wrote the following OrderCheck for validating shipmode:

CodeDef shipmode OrderCheck
CodeDef shipmode Routine <<EOS
sub {
	my ($ref, $name, $value, $code) = @_;

	if ($Tag->shipping({check_validity => 1})) {
		return (1, $name, '');
	}
	else {
		return (0, $name, errmsg($code || 'Invalid shipping mode'));
	}
}
EOS

Now you can put in your order profile:

shipping=shipmode Shipping cost has been adjusted. Please review and submit 
again.

Regards
	Racke

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team




More information about the interchange-users mailing list