[ic] hints on using the [assign] tag

interchange-users@interchange.redhat.com interchange-users@interchange.redhat.com
Fri Sep 21 07:54:00 2001


Quoting Guido Sohne (caught_one@yahoo.com):
> When overriding a tag with assign, such as
> 
>   [assign shipping="45.67"]
> 
> other core tags such as [shipping] and [total-cost]
> are affected. The documentation warns about this.
> 
> In the case of shipping, using [assign shipping="[delivery]"]
> more than one time in a catalog, where [delivery] is a tag that
> itself calls sub tag_shipping (the code executed when you use the
> [shipping] tag.)
> 
> [delivery] returns a wrong result if [delivery] expected 
> tag_shipping to return the result of its normal calculation 
> instead of the last supplied value. 

This makes sense, since tag_shipping with no mode specified will
return the shipping cost which you have assigned.

You should be able to avoid this by calling the shipping subroutine
instead, with the mode:

	my $cost = Vend::Interpolate::shipping($mode);

> 
> In cases like this, just use a
> 
>   [assign clear=1]
> 
> before 
> 
>   [assign shipping="[delivery]"]
> 

That would work fine too. 8-)

-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Any man who is under 30, and is not liberal, has not heart; and any man
who is over 30, and is not a conservative, has not brains.
 -- Winston Churchill