Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 10-15-2004 13:36:20

gdnop2
Member
Registered: 08-20-2004
Posts: 23
Website

Custom Shipping Problem

hi,

I've got two CCP stores - one running CCP5.0 and one running CCP 5.1. I've got custom shipping set up for both stores. Version 5.1 comes with a 'Calculate shipping by destination' custom script, and this was easy to set up and all is well with that store.

CCP5.0 doesn't come with a canned 'Calculate shipping by destination' script, so I thought it should be simple to modify the 'User Defined Script' to do the same as the 'by destination' script from CCP5.1. But I can't get it to work....the cart keeps using the custom error shipping details, rather than getting the values from my script.

Any clues as to why? Any thoughts at all would be much appreciated as this is driving me nuts....



Here is the script that I'm using:


#########
######### This custom script calculates shipping
######### based on user scripting.  The default script
######### uses a flat rate shipping fee.
#########
######### A listing of available variables:
#########
######### $ship_items_found     Count Of shippable items
#########
######### $ship_methods_found   Count of items with a
#########                       shipping method already
#########
######### $cart_items_found     Count of rows in the cart
#########
######### $cart_quantity_found  Total quantity of items
#########                       in the cart
#########
######### $tracking_subtotal    Subtotal of the prices for
#########                       all items in the cart
#########
######### $cart_total_weight    Total weight of all items
#########                       in the cart in pounds.
#########
######### Directly below, enter in the name for this
######### method to be displayed to the user.
#########

my $ship_meth_name = "UK Delivery";
my $ship_meth_name1 = "Off Mainland UK Delivery Zone 1";
my $ship_meth_name2 = "Off Mainland UK Delivery Zone 2";
my $ship_total = "4.95";
my $ship_display = "";
my $ship_total1 = "25.00";
my $ship_display1 = "";
my $ship_total2 = "40.00";
my $ship_display2 = "";


if ($fd_trackitem_shipcountry eq "United Kingdom") {
### UK shipping

$ship_display = "$ship_meth_name - $currency_symbol$ship_total";

$ship_total = sprintf("%.2f", $ship_total);

} elsif
(($fd_trackitem_shipcountry eq "Highlands & Islands Scotland") ||($fd_trackitem_shipcountry eq "Isles Of Scilly")||($fd_trackitem_shipcountry eq "Isle of Man")||  ($fd_trackitem_shipcountry eq "Northern Ireland")){
###

$ship_display = "$ship_meth_name1 - $currency_symbol$ship_total1";

$ship_total = sprintf("%.2f", $ship_total1);

} else {
### Channel Islands & Rep of Ireland £40.00


$ship_display = "$ship_meth_name2 - $currency_symbol$ship_total2";

$ship_total = sprintf("%.2f", $ship_total2);

}


#########
######### Print the HTML display for the shipping
######### charge.
#########

print <<ENDOFTEXT;

<CENTER>

<TABLE WIDTH="100\%" CELLPADDING="10" CELLSPACING="3">

<TR BGCOLOR="$html_pri_tablerow_color">

<TD VALIGN="TOP"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><B>Delivery Charge</B> <FONT COLOR="$html_notnull_font_color"><B>$html_notnull_character</B></FONT><BR><BR></FONT>

<INPUT TYPE="RADIO" NAME="shipinfo" VALUE="$ship_meth_name\:$ship_total" CHECKED> <FONT FACE="$html_base_font_face" SIZE="$html_base_font_size" COLOR="$html_base_font_color">

$ship_display

</FONT></TD>

</TR>

</TABLE>

</CENTER>

<BR>

ENDOFTEXT

Offline

 

#2 10-15-2004 14:24:13

gdnop2
Member
Registered: 08-20-2004
Posts: 23
Website

Re: Custom Shipping Problem

Hi,

I found the solution to my problem.....

in ste_chkout.pl it was evaluating the custom script, and throwing out an error if it encountered a '|' character.

Now, my custom script has some OR conditions in it as in || ....so it would always error....

Is there a problem is commenting out the check for '|' ? Is there a replacement line of perl code which would allow OR statements?

Thanks in advance...

Offline

 

#3 10-27-2004 09:46:01

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Custom Shipping Problem

Instead of '||' use 'OR'.  The problem with allowing pipe characters in 5.0 custom scripts is that | allows you to pipe output to another program and potentially causes security issues.  In 5.1 we coded around this.


Nick Hendler

Offline

 

Board footer