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 04-30-2008 17:26:12

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Not shipped nightmare

Hi,

Just testing Gift vouchers I have in store as an option based product and not shipped as the setting as there are sent via email -

All works well until you have a deliverable product in there.

all seems well at the start but it either ends up charging 0.00 or the correct 2.00 fee (this is a charge for a single deliverable item) but if you come out of checkout and back it goes to 0.00 again.

I think this is to do with the est. shipping mod.  been at it for 2 days now and going round in circles - any ideas?


---------------------------------

UPDATE

Just a thought - since the 'not shipped' is not working with the muse est shipping mod - could i edit the custom shipping script below to not count product item code-a and/or code-b

Code:

######### ######### Set Free Shipping for Trade Customers ######### ADDED CODE BELOW


%UK_regions = (
  "United Kingdom", 0,
  "Highlands & Islands Scotland", 0,
  "Isles Of Scilly", 0,
  "Isle of Man", 0,
  "Channel Islands", 0,
  "Northern Ireland", 0);

my $trade_shipping_name = "FREE Standard UK Delivery"; 
my $trade_shipping_rate = "0.00"; 

if ($tracking_discountcode eq 'Code1' && $item_quantity > '2' && (exists($UK_regions{$fd_trackitem_shipcountry})) || $tracking_discountcode eq 'Code2' || $tracking_discountcode eq 'Code3') { 

$custom_code_result .= <<ENDOFTEXT;

<CENTER>
<TABLE WIDTH="100\%" >
<TR BGCOLOR="$html_pri_tablerow_color">

<TD VALIGN="TOP">

ENDOFTEXT


$custom_code_result .= <<ENDOFTEXT;
<INPUT TYPE="RADIO" NAME="shipinfo-$shipid"
VALUE="$trade_shipping_name:$trade_shipping_rate" CHECKED> <FONT
FACE="$html_base_font_face" SIZE="$html_base_font_size"
COLOR="$html_base_font_color"> $trade_shipping_name - FREE

ENDOFTEXT




<<ENDOFTEXT;
</FONT></TD>
</TR>
</TABLE>
</CENTER>
<BR>

ENDOFTEXT

} else { 

######### ######### Regular shipping for everyone else ######### ADDED CODE ABOVE
$custom_code_result = "";
my $ship_meth_name = "";
my $ship_meth_name2 = "";
my $ship_total = "0.00";
my $ship_total2 = "0.00";

%shipping_cost = (
"UK - Royal Mail 1st Class Recorded (Free Over 5 Items*)" => ["0.00","2.00","3.50","4.50","4.99","4.99","0.00","0.00","0.00"],
"UK - Royal Mail Special Delivery (1 Working Day*)" => ["0.00","5.95","6.75","7.25","8.25","8.50","8.50"],
"EU - Royal Mail International Signed For" => ["0.00","5.97","6.47","7.47","8.97","10.97"],
"USA & Other - Royal Mail International Signed For" => ["0.00","7.97","8.97","9.97","10.97","12.97"],);


%UK_regions = (
  "United Kingdom", 0,
  "Highlands & Islands Scotland", 0,
  "Isles Of Scilly", 0,
  "Isle of Man", 0,
  "Channel Islands", 0,
  "Northern Ireland", 0);

%European_regions = (
"Austria", 0,
"Belgium", 0,
"Cyprus", 0,
"Denmark", 0,
"France", 0,
"Germany", 0,
"Gibraltar", 0,
"Greece", 0,
"Ireland", 0,
"Finland", 0, 
"Hungary", 0,
"Iceland", 0,
"Italy", 0,
"Luxembourg", 0,
"Netherlands", 0,
"Norway", 0,
"Poland", 0,
"Portugal", 0,
"San Marino", 0,
"Slovenia", 0,
"Spain", 0,
"Sweden", 0,
"Switzerland", 0);

if (exists($UK_regions{$fd_trackitem_shipcountry})){
  if ($item_quantity >= $store_sp_del_num) {
$ship_meth_name = "UK - Royal Mail 1st Class Recorded (Free Over 5 Items*)";

$ship_meth_name2 = "UK - Royal Mail Special Delivery (1 Working Day*)";
  } ## end of if
$ship_meth_name = "UK - Royal Mail 1st Class Recorded (Free Over 5 Items*)";



}elsif (exists($European_regions{$fd_trackitem_shipcountry})){
$ship_meth_name = "EU - Royal Mail International Signed For";

}else {
$ship_meth_name = "USA & Other - Royal Mail International Signed For";
}

if ($item_quantity >= 6){
$ship_total = $shipping_cost{$ship_meth_name}->[6];
if ($ship_meth_name2) { $ship_total2 = $shipping_cost{$ship_meth_name2}->[6];}
} else {
$ship_total = $shipping_cost{$ship_meth_name}->[$item_quantity];
if ($ship_meth_name2) { $ship_total2 = $shipping_cost{$ship_meth_name2}->[$item_quantity];}
} ## end of if

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

my $ship_display = "$ship_meth_name - $currency_symbol$ship_total<BR>";

my $ship_display2 = "$ship_meth_name2 - $currency_symbol$ship_total2<br>";

$custom_code_result .= <<ENDOFTEXT;

<CENTER>
<TABLE WIDTH="100\%" >
<TR BGCOLOR="$html_pri_tablerow_color">

<TD VALIGN="TOP">
<INPUT TYPE="RADIO" NAME="shipinfo-$shipid"
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

ENDOFTEXT

if ($ship_meth_name2 && $store_sp_del_flag eq "Y" ) {

$custom_code_result .= <<ENDOFTEXT;
<INPUT TYPE="RADIO" NAME="shipinfo-$shipid"
VALUE="$ship_meth_name2:$ship_total2"> <FONT
FACE="$html_base_font_face" SIZE="$html_base_font_size"
COLOR="$html_base_font_color">

$ship_display2


ENDOFTEXT

} ## end of if
}
$custom_code_result .= <<ENDOFTEXT;

</FONT></TD>
</TR>
</TABLE>
</CENTER>
<BR>

ENDOFTEXT

so it would work like so


In cart
1x normal product
1x code-a product

for shipping calc's it would think there is just 1 item and charge £2 (which is the 1 item price and not charge £3.50 as this is the 2 item price.

Last edited by celdirect (04-30-2008 18:34:08)

Offline

 

#2 04-30-2008 19:43:29

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Not shipped nightmare

Hi Charlie,

Not sure where to start with the estimated shipping mod.  But removing the unshipped items from the total count so you can use a custom script should be easy enough.  Try using something like this:

Code:

######### Remove Not Shipped Items from Count

my @ship_cart = ();
my $ship_quantity = $item_quantity;

$sql_statement = "

SELECT cart_prodquantity, cart_prodid
FROM cart

";

@ship_cart = database_call('cart','SELECT',$sql_statement);

foreach (@ship_cart) {

  ($cart_prodquantity, $cart_prodid) = @$_;

  if ($cart_prodid eq 'not_shipped_product_id') {

    $ship_quantity -= $cart_prodquantity;

  } ## end of if
} ## end foreach

######## Use $ship_quantity instead of $item_quantity for remainder of shipping calculations

Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#3 04-30-2008 20:18:30

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Re: Not shipped nightmare

THANK YOU!!!!

As far as i can see it works ok and sorts out the probs with the est ship mod - a nice hack.

I just added your code to the top of the one i posted and changed the if ($cart_prodid eq 'not_shipped_product_id') { to my prod id. 

Then did

Use $ship_quantity instead of $item_quantity for remainder of shipping calculations

If i want to ad another product id would this be ok

if ($cart_prodid eq 'code-a' || $cart_prodid eq 'code-b' )

Never sure what the || bits mean

have i added it all ok?

Thank you again - you have done what I've been trying to do for 2 days in less than 1hr.

Offline

 

#4 04-30-2008 21:02:13

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Not shipped nightmare

You're very welcome - I'm glad it worked!

Sounds like you did everything just fine.  Your alternate if statement to add an additional product id will work fine also.  For the sake of reference, the pipe pipe ( || )  is shorthand for OR.  && is shorthand for AND, in case you ever need it.  If you want to get really clever, you could make all your not shipped product reference strings have a common feature, such as ending in -NS.  Then, you could easily write a regex so that any id that has that feature is automatically caught.  For example, if you use the -NS suffix, as I just mentioned, your if statement would be:

Code:

if ($cart_prodid =~ m/-NS$/) {

Happy coding!


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

#5 05-01-2008 14:57:58

celdirect
Member
From: UK
Registered: 04-01-2005
Posts: 782

Re: Not shipped nightmare

Hi,

That's sounds a good idea. but for now just put what you posted with some changes. So it excepts a remote add to cart product:

Code:

######### Remove Not Shipped Items from Count added 01052008

my @ship_cart = ();
my $ship_quantity = $item_quantity;

$sql_statement = "

SELECT cart_prodquantity, cart_prodnumber
FROM cart
WHERE cart_id <>''  
";

@ship_cart = database_call('cart','SELECT',$sql_statement);

foreach (@ship_cart) {

  ($cart_prodquantity, $cart_prodnumber) = @$_;

  if ($cart_prodnumber eq 'CP-001' || $cart_prodnumber eq '004-006') {

    $ship_quantity -= $cart_prodquantity;



  } ## end of if
} ## end foreach


######## Use $ship_quantity instead of $item_quantity for remainder of shipping calculations changed 01052008

Thanks again

Last edited by celdirect (05-01-2008 14:58:44)

Offline

 

#6 05-01-2008 17:05:26

rachaelseven
Member
From: Massachusetts, USA
Registered: 01-23-2006
Posts: 3169
Website

Re: Not shipped nightmare

Looks good - nice modification to make it work with remote products.  I'm glad I could help!


Rachael Katz
- Custom Focusing Screens for DSLR Cameras

Offline

 

Board footer