[ic] shipping calculate
Sergey Sheykin
sheich@mosinfo.ru
Tue, 27 Mar 2001 19:31:06 +0400
No, I dont need this.
You calculate [shipping] in .asc file,
not in SQL-table.
> -----Original Message-----
> From: interchange-users-admin@lists.akopia.com
> [mailto:interchange-users-admin@lists.akopia.com]On Behalf Of
> Murray Gibbins
> Sent: Tuesday, March 27, 2001 4:48 PM
> To: interchange-users@lists.akopia.com
> Subject: Re: [ic] shipping calculate
>
>
> Sergey Sheykin wrote:
> >
> > I understand this!
> > But how I can to force Minivend calculate [shipping]
> > on formula, placed in SQL-table?
>
> This should give you lots to chew on :-)
>
>
> ==========================================
>
>
> [interch@handle shipd_mod]$ cat
> ~interch/shopping/etc/mv4_templates/products/shipping.asc
> code description criteria min max formula
> default United Kingdom quantity 0 99999999 f
> [perl subs=1
> global=1 ]my $cost =
> shipd($Scratch->{present_cart},$Carts->{$Scratch->{present_cart}},
> $Tag,$Values->{mv_ship_mode});return
> $cost;[/perl][interch@handle shipd_mod]$
>
> ===========================================
>
>
> GlobalSub <<EOGS
>
> sub shipd{
>
> use lib qw(/etc/minivend/shipd_mod);
> use strict;
> use DBI ;
> use Sys::Syslog qw(:DEFAULT setlogsock);
> use POSIX;
>
> use Get_zones;
>
>
> use Shop2 ;
> use Shop3 ;
> use Shop4 ;
> use Shop5 ;
> use Shop5 ;
> use Shop6 ;
> use Shop7 ;
>
>
> my $cart = shift ;
> my $Carts_ref = shift || [] ;
> my $Tag = shift ;
> my $dest = shift ;
>
> sub shipd_logmsg {
>
> setlogsock("unix");
>
>
> openlog("shipd","nodelay","user");
> #openlog("shipd","nodelay","local3");
> syslog("info","$0 $$: @_");
> closelog();
>
> #print "$0 $$: @_ at ", scalar localtime, "\n"
> };
>
>
> my $get_zones_obj = new Get_zones(\&shipd_logmsg);
>
> shipd_logmsg("Cart : $cart");
>
> MODTRY: {
>
> my $mod_name = lc $cart ;
> $mod_name = ucfirst $mod_name ;
>
> # now lets try to find the module...
>
> my $mod_obj ;
> eval{$mod_obj = $mod_name->new(\&shipd_logmsg,1)};
> if($@){last MODTRY;} # don't go any furthur.
>
> my $hash_ref = $mod_obj->hash_gen();
> my $totalcost =
> $mod_obj->shipd_cost($hash_ref,$dest,$get_zones_obj,); #
> return cost
>
>
> return $totalcost ;
> }
>
> shipd_logmsg("Can't find the module for cart $cart");
>
> return 99999999999;
>
>
>
>
>
>
> }
> EOGS
>
> =========================================================
>
>
>
> --
> ____
> \__/ Murray Gibbins murray@scotweb.ltd.uk
> / \ Programmer
> _ \__/ _ ================================================
> \\ || // Scotweb Limited, info@scotweb.ltd.uk
> \\||// 13a Albert Terrace, http://www.scotweb.ltd.uk
> \||/ Edinburgh EH10 5EA Tel: +44 (0) 131 270 82 33
> || Scotland. Europe. Fax: +44 (0) 7020 93 49 04
>
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users