[ic] late added shipping method not working

Peter peter at pajamian.dhs.org
Wed Jan 19 03:47:27 UTC 2011


On 19/01/11 13:02, Paul Jordan wrote:
> 
> I am a little unclear if something like this example is supposed to work:
> 
> [set us_promo_max]19[/set]
> 
> [if !scratch ship_added]
> [seti ship_promo]
> foo_promo: U.S. Postal Service First Class Air
>    crit        [subtotal noformat=1]
>    min         0
>    max         0
>    cost        e No shipping needed!
>    p_time      5-10 business days*
>    adder      -1
> 
>    min         1
>    max         [scratch us_promo_max].99
>    cost        >>actual_foo
> 
>    min         [calc] $Scratch->{us_promo_max} + 1 [/calc]
>    max         999999
>    cost        1
> 
>    min         1000000
>    max         9999990
>    cost        1
> [/seti]
>    [shipping add="[scratch ship_promo]" hide=1]
>    [set ship_added]1[/set]
> [/if]

The min and max have to be fixed, but you can evaluate the criterion, so
you can do something like this:

	crit <<EOC
[calcn]
	my $subtotal = $Tag->subtotal({noformat => 1});
	if (!$subtotal) {
		return '0.00';
	}
	elsif (int $subtotal <= $Scratch->{us_promo_max}) {
		return 1;
	}
	else {
		return 2;
	}
[/calcn]
EOC

	min	0
	max	0
	cost	e No shipping needed!
	p_time	5-10 business days*
	adder	-1

	min	1
	max	1
	cost	>>actual_foo

	min	2
	max	2
	cost	1


Peter



More information about the interchange-users mailing list