[ic] UPSE Online, special handling charge, adder

Daniel Browning db at endpoint.com
Thu Nov 20 17:33:34 UTC 2008


On Thursday 20 November 2008 9:14:59 am Steve Graham wrote:
> > SpecialSub shipping_callout custom_shipping
>
> IC 5.4 catalog.

I forgot to mention that this was added in 5.6.0, but the patch to older
versions is pretty simple:

http://www.icdevgroup.org/cgi-bin/cvsweb/interchange/lib/Vend/Ship.pm.diff?r1=text&tr1=2.26&r2=text&tr2=2.27

--
Daniel Browning


--- interchange/lib/Vend/Ship.pm	2007/08/09 13:40:54	2.26
+++ interchange/lib/Vend/Ship.pm	2008/04/11 07:47:16	2.27
@@ -1,8 +1,8 @@
 # Vend::Ship - Interchange shipping code
 # 
-# $Id: Ship.pm,v 2.26 2007/08/09 13:40:54 pajamian Exp $
+# $Id: Ship.pm,v 2.27 2008/04/11 07:47:16 danb Exp $
 #
-# Copyright (C) 2002-2007 Interchange Development Group
+# Copyright (C) 2002-2008 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
 #
 # This program was originally based on Vend 0.2 and 0.3
@@ -909,6 +909,16 @@ sub shipping {
 			}
 			undef $opt->{default};
 		}
+		if (my $callout_name = $Vend::Cfg->{SpecialSub}{shipping_callout}) {
+#::logDebug("Execute shipping callout '$callout_name(...)'");
+			my $sub = $Vend::Cfg->{Sub}{$callout_name} 
+				|| $Global::GlobalSub->{$callout_name};
+			eval {
+				my $callout_result = $sub->($final, $mode, $opt, $o);
+				$final = $callout_result if defined $callout_result;
+			};
+			::logError("Shipping callout '$callout_name' died: $@") if $@;
+		}
 		return $final unless $opt->{label};
 		my $number;
 		if($o->{free} and $final == 0) {



More information about the interchange-users mailing list