[ic] Canadian shipping woes.

Honest to Goodness interchange-users@interchange.redhat.com
Sun May 26 21:40:01 2002


On Sun, 2002-05-26 at 17:40, Kari Suomela wrote:
> 
> Wednesday May 08 2002 15:25, Honest to Goodness wrote to All:
> 
>  HG> CPC_HELOISE. A good sample request is
>  HG> here: http://206.191.4.228/ServerV3/HTTPInterface.html
> 
> Got that, but how/where do I apply it?
> 
>  HG> Next you need to put this usertag canpo.tag where it can be global 
>  HG> and
> 
> Working ok.
> 
> 
>  HG> In /pages/ord/checkout.html you need to insert this perl block:
> 
>  HG> [perl subs=1 global=1]
> 
> Got this working so-so. Having trouble inserting it into the correct 
> location in the page. I suppose the current shipping choices need to be 
> rmoeved?
> 
>  HG> Now you have to alter your products.txt or file database and add
>  HG> columns named: length, width and height and make sure there is 
>  HG> weight
>  HG> as well. Enter data for these values for each of your products.
> 
> Done.
> 
>  HG> You have to add 4 shipping routes, or 7 if you get an expedited
>  HG> account from CanPost. Here are the 4 routes:
> 
>  HG> 1CAN1 Priority Courier    Formula     $Scratch->{can1}
> 
> This may be a stupid question, but WHERE do I add these?
> 
1) The sample server request is more for reference at this point since
the form of it is already embedded into the perl block. Of interest is
the [header][repeated product block(s)][footer] structure of the
request. Notice how the perl block has a constant header, a loop over
the multiple products and then a constant footer.

2) I removed the pull down select box control of shipping choices on the
checkout page and substituted the radio button control higher up on the
form. Thanks to that other guy who supplied the radio button code and
then I improved it with some pretty formatting. Check my back posts in
the archive.

3) From the [ic] admin pages go to Admistration, Shipping to get to the
Shipping Configuration page. Hit the Create New Method button to add the
4 new methods.

The perl block on the checkout page composes the request and sends it
with the server ip to the usertag. There it is sent out and the reply
received. Back on the checkout page the perl block extracts the prices
using some pretty facile regular expressions and puts them into the
scratch variables. When the radio button code is encountered it asks all
the shipping routes if any have non-zero values and those that are make
it onto the page.

There is also some estimated-time-of-delivery date information contained
in the reply and that can be extracted and output as well. But since it
depends on the time it takes you to get the wrapped product into the
mailbox which is a big variable for me, I just assumed a fixed packing
time and I ignored the estimated times returned. These times do factor
into the calculation though because of weekends and holidays and stuff.

You might think from the foregoing that I know this [ic] stuff pretty
good but I'm actually still just a bozo and quite in awe of those that
really know what they're doing.