[ic] Controlling checkout.html shipping method selections

Mark Bryant interchange-users@icdevgroup.org
Sun May 4 12:53:00 2003


At 17:02 04/05/2003, you wrote:
>At 10:07 AM 5/4/2003 +0100, you wrote:
>>Hi Folks,
>>
>>I'm having a bit of trouble with the shipping methods displayed on 
>>checkout.html.
>>
>>I've already set up two shipping methods (let's call them SHIP1 & SHIP2), 
>>where the calculation is done by weight and they are behaving normally.
>>
>>What I would like to do now is customise which one is displayed by 
>>checkout.html dependent on the cost of the goods+sales tax :
>>
>>
>>     [if] (the cost of the goods + sales tax <= 28.00)
>>
>>        Show both methods in checkout.html
>>
>>     [if] (the cost of the goods + sales tax > 28.00)
>>
>>        Only show method SHIP2 in checkout.html
>>
>>     [/if]
>>
>>
>>The checkout.html page is currently showing both methods using this code, 
>>which I guess if just fine in the < 28.00 case, but not for the > 28.00 case.
>>
>>     <SELECT NAME=mv_shipmode>
>>     [shipping
>>       label=1
>>       mode=|[data table=country key='[default country UK]' col=shipmodes]|
>>     ]
>>     </SELECT>
>>
>>
>>I'll freely admit that I don't understand how most of the IC tags/code 
>>work and having spent hours looking at code and getting nowhere fast I 
>>have to ask if someone out there could supply the code (or enough of it 
>>to get me going) to do the job. I'm sure it's pretty simple if you 
>>understand how getting data from the databases works, but I'm so lame 
>>with IC right now I couldn't even write the required [if][/if] lines :o(
>>
>>Many thanks to anyone that can help out here.
>>
>>Mark
>
>I'll start by saying that I've never tried it before, but according to the 
>docs, your shipping formula can contain any mixture of ITL and Interchange 
>Perl objects as part of the expression, so this *should* work:
>
>SHIP1   Shipping method 1       weight  0       9999    f if ( 
>$Tag->subtotal({ noformat => 1}) + $Tag->salestax({ noformat => 1}) <= 28 
>) { #your shipping formula here }
>
>- Ed L.

Hi Ed,

Many thanks for your reply :o)

I've been using the UI to input the shipping method and data table which 
has produced the following in shipping.asc:

REC2ND  Standard Shipping (3-5 Days)    weight  0       0       e Your 
Basket is Empty!         {'ui_ship_type' => "weight",'ups' => 
"0",'at_least' => "0.98",'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  0       60      0.98            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  60      100     1.14            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  100     150     1.20            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  150     200     1.40            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  200     250     1.55            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  250     300     1.68            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  300     350     1.81            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  350     400     2.03            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  400     450     2.21            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  450     500     2.41            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  500     600     2.71            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  600     700     3.00            {'PriceDivide' => "1",}
REC2ND  Standard Shipping (3-5 
Days)    weight  700     750     3.14            {'PriceDivide' => "1",}


I realise this is cheeky, but could you show me an example using the above 
working table as I'm unsure how this fits with your example?

Many thanks

Mark