[ic] many warehouses shipping

Bill Carr interchange-users@interchange.redhat.com
Tue Apr 16 06:56:01 2002


On Mon, 2002-04-15 at 09:52, Rick Eicher II wrote:
> > -----Original Message-----
> > From: interchange-users-admin@interchange.redhat.com
> > [mailto:interchange-users-admin@interchange.redhat.com]On Behalf Of Rick
> > Eicher II
> > Sent: Friday, April 12, 2002 1:29 PM
> > To: interchange-users@interchange.redhat.com
> > Subject: RE: [ic] many warehouses shipping
> >
> >
> > > I have a customer that will be selling items from many companies.
> > > So I need
> > > to calculate the shipping based on the location of the item, which is
> > > different for each item. This is simmular to a company that has many
> > > warehouses to ship from.
> > >
> > > Has any one done this before or know how would be the best way
> > to go about
> > > doing it?
> > >
> > > I was think about adding a column to the products table to hould
> > > the zip of
> > > the items location. Then have shipping pull this information to
> > calculate
> > > shipping. I am currently useing the ups-query tag to calculate shipping.
> > > Maybe way off on this. :/
> > >
> > > Thank you for your time,
> > > Rick Eicher II
> > > www.pbol.net
> > >
> > >
> >
> > My shipping.asc file now makes use of the ups_query tag.
> > [ups-query zip="[either][value zip][or][var SHIP_DEFAULT_ZIP][/either]"
> > mode="GNDRES" weight="@@TOTAL@@"]
> >
> > I would like to add a column to the products table then read it in as the
> > origin of this tag.
> > [ups-query zip="[either][value zip][or][var SHIP_DEFA
> > ULT_ZIP][/either]" mode="GNDRES" weight="@@TOTAL@@" origin="origin column
> > data"]
> >
> > Can add column just not sure what would be the best way to get it into the
> > tag.
> >
> > Rick
> >
> 
> Ok I added the column to the products table called origin. I have filled
> this column with the origin zip that the product will be shipped from. I
> have the ups-query tag set up like this.
> 
> [ups-query mode=1DA weight="@@TOTAL@@" origin="[item-field origin]"]
> 
> After a quick restart the 1DA shipping mode no longer appears in the drop
> down menu of the check out page.
> 
> Any one have an idea of how to read the zip out of the products table and
> pass it to the ups-query tag? Or how to read any data into any tag?
Here is one way that might work (untried, untested):
catalog.cfg:
AutoModifer origin weight

UserTag ship_cost Order mode zip
UserTag ship_cost Routine <<EOR
sub {
        my($mode,$zip) = @_;
	my $total = 0;
	my %origins;
	for (@$Items) { # Combine origins to minimize ups-queries
		$origins{$_->{origin}} += $_->{weight};
	}
	for (keys %origins) {
             $total += $Tag->ups_query( {
					mode => $mode,
					zip => $zip,
					weight => $origins{$origin},
					origin => $_
                                      } );
	}
	return $total;
}

Then instead of ups-query as you have above do: [ship_cost mode=1DA]


> 
> redhat 7.2, interchange 4.8.3, perl 5.6.1, postgresql-7.1.3-2
> 
> Rick
> 
> 
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users
> 
-- 
Bill Carr
Worldwide Impact
bill@worldwideimpact.com
413-253-6700