[ic] Bug with shipping + total cost?

Sandy Thomson sandy at scotwebshops.com
Thu May 27 07:16:36 EDT 2004


New Media E.M.S. wrote:

> At 09:28 AM 5/25/2004, you wrote:
>
>> Hi,
>> I have discovered something I think might be a bug?
>>
>>
>> My Setup:
>> ===
>> I have a few different shipmodes in the shipping.asc file, and 
>> depending on what country a customer selects certain shipmodes (+ 
>> correct prices) are displayed on the basket page on a drop down list 
>> for customer to choose from.
>>
>> Only shipping country and shipping method are chosen on our basket 
>> page. The idea being the customer can see a simple heads up of how 
>> much everything costs before being confronted with crazy checkout form.
>>
>>
>> A hypothetical example:
>>
>> country.txt
>> -- 
>> ACountry    ups,fedex
>> -- 
>>
>> shipping.asc
>> -- 
>> ups    UPS             weight  0       0       e No items in basket
>> ups    UPS             weight  1       1999    f 10.00
>> ups    UPS             weight  2000    9999999 e Use Fedex instead
>> fedex  Fedex           weight  0       0       e No items in basket
>> fedex  Fedex           weight  1       9999999 f 20.00
>> -- 
>>
>> Note: Ignore all tab separation and formatting, its just an example 
>> and the db's work here.
>> ===
>>
>>
>>
>> The (Possible) Bug:
>> ===
>> For example, the weight criterion was out of bounds for the first 
>> shipmode (3000), i would like it to display only the second shipmode 
>> and the price for that country (e.g Fedex: 20.00) on the basket page.
>>
>> This works fine.
>>
>> But:
>> The [total-cost] tag returns the calculation of 
>> (subtotal+vat+shipping), but for some reason it assumes shipping to 
>> be 0.00, i assume because it looks at the first shipmode in the 
>> country db (ups) and sees 'e' (error), instead of the only option 
>> available that has no error (Fedex: 20.00).
>>
>> So the calculation should be (subtotal+vat+20.00) instead of 
>> (subtotal+vat+0.00), i think?
>>
>> Subsequently, going to the checkout page calculates the order total 
>> correctly, but I was really wanting the basket page to do the price 
>> calculation.
>> ===
>>
>> Any hints?
>> Cheers.
>>
>> Sandy.
>
>
> You could add some to display a message about this to the user:
>
> [if type=!explicit compare="[shipping noformat=1]"]
>         <font color=red>Please click 'Recalculate' to see your
>         total with shipping charges added in.</font>
> [/if]
>
>
> ... or something like this. Or if you want to get more ambitious you 
> could add a calc at the top of the page to evaluate all shipmodes and 
> apply the first one that produces an non-zero result.


Hi,
I thought this was a bit unreasonable and customers expect this sort of 
thing to be done automatically.
Anyway I managed to come up with a simple solution, you add something 
like this before the drop down shipping choice is displayed:

[comment] Shipping bugfix stuff [/comment]

[tmp name="ship_mode" interpolate=1][shipping modes="[data table=country 
key='[value country]' col=shipmodes]" label=1][/tmp]

[perl]
$Scratch->{ship_mode}=~/VALUE="([A-Za-z]*)"/;                                      

$Scratch->{ship_mode}=$1;                                                          

return;                                                                            

[/perl]                                                                            


[value name="mv_shipmode" set="[scratch ship_mode]" 
hide="1"]                     

[comment] End of shipping bugfix 
[/comment]                                       

I had to add a perl block to strip out the shipmode as format="%M" used 
with label=1 in the [shipping] tag returned 'not enough information".
Cheers for the help.

Sandy.


More information about the interchange-users mailing list