[ic] shipping charges and weights...

Steve icdev at mrlock.com
Wed May 19 17:00:50 EDT 2004


> Unless I'm missing something important this user tag isn't working out
> for me. the error I'm getting upon restart is this:
>
> .UserTag 'ship_cost_i' subroutine failed safe check: syntax error at
> (eval 202) line 22, near "}
> EOR
>
> # Allow customers to have their passwords emailed to them.
> ActionMap  "
>
> In line 287 of the configuration file 'catalog.cfg':
>
>
> Here is what I placed in the catalog.cfg file:



Here is the copy from my catalog.cfg
We are Using IC 4.8.x so there may have been some changes - you might need
to ask one of the guru's.


The ship_cost does an on-line lookup
ship_cost_i does the internal lookup


Code follows:
-----------------------------

#
# break large weight into smaller units and calculate new freight amounts#
# search ic by Shipping Questions - Multiple Boxes per Item - How to?
#

UserTag ship_cost Order weight mode zip
UserTag ship_cost Routine <<EOR
sub {
	my($weight,$mode,$zip) = @_;
	return unless $weight;
	$mode = $Variable->{SHIP_DEFAULT_MODE} unless $mode;
	$zip = $Variable->{SHIP_DEFAULT_ZIP} unless $zip;
	my $total = 0;
        if ($weight < 1)
           { $weight = 1 }
	$total = int($weight/145) * $Tag->ups_query( {
						      mode => $mode,
						      zip => $zip,
						      weight => 145
						    } );
	$total += $Tag->ups_query( {
				    mode => $mode,
				    zip => $zip,
				    weight => $weight % 145
				   } );
	return $total;
}
EOR

#==========================================================================#
#
# break large weight into smaller units and calculate new freight amounts#
# used for internal ups lookup
#


UserTag ship_cost_i Order weight mode zip upsmode
UserTag ship_cost_i Routine <<EOR
sub {
	my($weight,$mode,$zip,$upsmode) = @_;
	return unless $weight;
	$mode = $Variable->{SHIP_DEFAULT_MODE} unless $mode;
	$zip = $Variable->{SHIP_DEFAULT_ZIP} unless $zip;
        my $zone = '760';
	my $total = 0;
        my $w_weight = $weight;
        if ($weight < 1)
           { $weight = 1 }
	$total = int($weight/145) * Vend::Interpolate::tag_ups($mode, $zip,
145,$zone);
	$total += Vend::Interpolate::tag_ups($mode, $zip, $weight % 145,$zone);
	if ($total < 1)
          {$total = $Tag->ship_cost($w_weight, $upsmode, $zip)}

        return $total;
}
EOR


==================
end of code

-Steve



More information about the interchange-users mailing list