[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
[ic] Creating custom shipping dropdown list
Hello all.
I'm comfortable in Perl, but I'm still pretty new to Interchange. I'm
having a problem with passing a list of shipping modes to the [shipping]
tag.
The store we are building has custom shipping routines based on
vendor/supplier; each vendor/supplier drop ships the product directly to the
customer. We've decided to allow the customer to choose a shipping method
for each item in their cart. To accomplish this, we are modifying
ord/checkout.html.
We have set up custom shipping routines for each vendor using a naming
convention like this:
vendorname1DA
vendorname2DA
othervendor1DA
We've added a vendor field to the product table, and we're attempting to
create a dropdown shipping field under each product on ord/checkout.html
with the shipping methods for the vendor associated with the product.
Here is an excerpt of the shipping.asc with the rules for the vendor named
'syskos':
##### EXCERPT shipping.asc #####
syskosUPSG UPS Ground weight 0 0 e Nothing to ship!
{'origin' => "538",'ui_ship_type' => "UPSE:GNDRES",'ups' =>
"1",'PriceDivide' => "1",}
syskosUPSG UPS Ground weight 0 150 f [ups-query mode=GNDRES
weight="@@TOTAL@@" origin="538"] {'PriceDivide' => "1",}
syskosUPSG UPS Ground weight 150 9999999 e Too heavy for UPS
{'PriceDivide' => "1",}
syskos2DA UPS 2nd Day Air weight 0 0 e Nothing to ship!
{'ui_ship_type' => "UPSE:2DA",'ups' => "1",'at_least' => "5",'adder' =>
"3.00",'PriceDivide' => "1",}
syskos2DA UPS 2nd Day Air weight 0 150 f [ups-query
zip="[either][value zip][or][var SHIP_DEFAULT_ZIP][/either]" mode="2DA"
weight="@@TOTAL@@"] {'PriceDivide' => "1",}
syskos1DA UPS Next Day Air weight 0 0 e Nothing to ship!
{'ui_ship_type' => "UPSE:1DA",'ups' => "1",'adder' => "3.00",'at_least' =>
"5",'PriceDivide' => "1",}
syskos1DA UPS Next Day Air weight 0 150 f [ups-query
zip="[either][value zip][or][var SHIP_DEFAULT_ZIP][/either]" mode="1DA"
weight="@@TOTAL@@"] {'PriceDivide' => "1",}
##### EXCERPT ######
Here is the code that we are calling to generate the shipping dropdown:
###### CODE ord/checkout.html ######
[item-list modular=1]
# Other stuff in here...
[seti currentvendor][item-field vendor][/seti]
<SELECT NAME=mv_shipmode onChange="this.form.submit()" CLASS="styled">
[seti vendormodes][data table=country key='[default country US]'
col=shipmodes][/seti]
[perl]
my @temparr = split(/[\s,]/,$Scratch->{vendormodes});
my $currentvendor = $Scratch->{currentvendor};
# Display only those shipping modes that match the vendor for this
product.
@temparr = grep { m"^$currentvendor" } @temparr;
$Scratch->{vendormodes} = join(' ',@temparr);
# Also tried this...
# $Values->{vendormodes} = join(' ',@temparr);
[/perl]
[shipping
label=1
mode='[scratchd vendormodes]'
]
[comment]
# Also tried this...
[shipping
label=1
mode='[value vendormodes]'
]
[/comment]
</SELECT>
# Other stuff in here...
[/item-list]
###### CODE ######
We know that the vendor item-field is being properly set and that our [perl]
tag is setting $Values->{vendormodes} to the following string (the
whitespace delimited list of modes called for by the IC Tag Reference entry
for the [shipping] tag):
syskosUPSG syskos2DA syskos1DA
The problem seems to be with the mode argument of the [shipping] tag. To
make matters even stranger, the standard [shipping] tag, which pulls its
space-separated list of shipping modes from the country database, is
working. The trouble with that method is that it returns all the US
shipping modes. We need to limit the list to only those shipping modes
which match the vendor.
I've also been getting these two error messages in my catalog error.log
file, but I'm not sure whether they are relevant to this issue:
209.180.64.37 XF6oVGj6:209.180.64.37 - [11/July/2002:13:40:08 -0700]
hoopstore /cgi-bin/hoopstore/process.html UPS lookup called, zone data not
found
209.180.64.37 XF6oVGj6:209.180.64.37 - [11/July/2002:13:48:37 -0700]
hoopstore /cgi-bin/hoopstore/process.html Shipping 'u' lookup called, no
zone defined
Please help or at least point me in the right general direction.
Thanks.
--
Michael Lehmkuhl <michael@electricpulp.com>
Partner, Electric Pulp
1.605.988.0177 : 1.888.722.PULP
electricpulp.com