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.
I have fixed shipping cost on my items, and I would like to be able to show the mini cart as:
Sub-Total = $0.00
Shipping =$0.00
-------------------
Total = $0.00
How can I should this and get this to work?
Offline
Bump - Anyone?
Offline
Yes default method, not real-time shipping.
Offline
For product based shipping, there are 3 options, I say make option 1 the default, and the customer "could" change that once they go to checkout - right?
Also is it possible to include the Customer shipping script in this, so that if they choose to use a custom script (like fre shipping for orders over 50.00) the cart will reflect the free, once they hit 50.00 in sales?
As for realtime, I know that would not be possible unless the customer is logged to their customer account, then the mini cart "sould" calulate the realtime shipping charges based on the default customers ship to address.
Another option would be to require a ZIP CODE when they enter a product to the cart, so they it would calcuate the real-time shipping then, there could be a pop-up asking for the zip code? Just a thought- don't mean to start getting to "Pie in the Sky" on you.
Offline
For simple shipping one could use the code from the shipping script.
in ste_cart_pl in the mini cart sub routine, after
$mini_quantity = ($mini_quantity + $cart_prodquantity); $mini_total = ($mini_total + $cart_amtprod); $mini_totalrecur = ($mini_totalrecur + $cart_amtrecur); } ######### End of foreach statement.
if ($cart_prodquantity > 0) {
if ($mini_total >= "0" && $mini_total <= "40.00") {
$mini_ship_total = "6.00";
} elsif ($mini_total > "40.00" && $mini_total <= "74.00") {
$mini_ship_total = "5.50";
} elsif ($mini_total > "74.00" && $mini_total <= "99.99") {
$mini_ship_total = "4.50";
} else {
$mini_ship_total = "0.00";
}
} else {
$mini_ship_total = "0.00";
}
$mini_ship_total = sprintf("%.2f", $mini_ship_total);
replace
$mini_total = sprintf("%.2f", $mini_total); $mini_totalrecur = sprintf("%.2f", $mini_totalrecur);
with
$mini_total = ($mini_total+$mini_ship_total);
$mini_total = sprintf("%.2f", $mini_total);
$mini_totalrecur = sprintf("%.2f", $mini_totalrecur);
then in ste_layout
add (CGIVAR)mini_ship_total(/CGIVAR) where you want the shipping to appear
I am sure this could be adapted to reflect other shipping based on cost. If it based on weight we need to get the weight from someplace.
Offline
This looks great. I would like to do the same but reflect the UK shipping price just for UK. However, 'product weight' is the yardstick rather than 'product cost'.
So could I use the script below and how could I get have the script recognise the the item_total_weight which I think is calculated in the ste_chkout.pl
Any help greatly appreciated... Thanks, DP
if ($cart_prodquantity > 0) {
if ($item_total_weight >= "0" && $item_total_weight <= "500") {
$mini_ship_total = "0.95";
} elsif ($item_total_weight >= "500" && $item_total_weight <= "1000") {
$mini_ship_total = "1.95";
} elsif ($item_total_weight >= "1000" && $item_total_weight <= "1500") {
$mini_ship_total = "3.95";
elsif ($item_total_weight >= "1500" && $item_total_weight <= "2000") {
$mini_ship_total = "4.95";
} else {
$mini_ship_total = "6.95";
}
} else {
$mini_ship_total = "0.00";
}
Offline
a reply would be really helpful...
Thanks v much.
Offline
I haven't tested this, but it should give you a variable called $mini_weight that you can use in your shipping calculation...
This is the code to replace within ste_cart_mini (it is not the whole sub). Backup your ste_cart.pl file before you do this, of course.
HTH,
Dave
$sql_statement = " SELECT cart_prodquantity,cart_amtprod,cart_amtrecur,cart_prodshipweight FROM cart "; @mini = database_call('cart','SELECT',$sql_statement); foreach $row(@mini) { ($cart_prodquantity,$cart_amtprod,$cart_amtrecur,$cart_prodshipweight) = @$row; $mini_quantity = ($mini_quantity + $cart_prodquantity); $mini_total = ($mini_total + $cart_amtprod); $mini_totalrecur = ($mini_totalrecur + $cart_amtrecur); $mini_weight = ($mini_weight + $cart_prodshipweight); } ######### End of foreach statement. $mini_total = sprintf("%.2f", $mini_total); $mini_totalrecur = sprintf("%.2f", $mini_totalrecur); $mini_weight = sprintf("%.0f", $mini_weight);
Offline
Dave - thanks for helping me out again!
Not working yet but here's what I did:
I inserted your code then after the
} ######### End of foreach statement.
in your code I inserted my code changing '$item_total_weight' for '$mini_weight'
So now that part of the sub looks like this:
$sql_statement = "
SELECT cart_prodquantity,cart_amtprod,cart_amtrecur,cart_prodshipweight
FROM cart
";
@mini = database_call('cart','SELECT',$sql_statement);
foreach $row(@mini) {
($cart_prodquantity,$cart_amtprod,$cart_amtrecur,$cart_prodshipweight) = @$row;
$mini_quantity = ($mini_quantity + $cart_prodquantity);
$mini_total = ($mini_total + $cart_amtprod);
$mini_totalrecur = ($mini_totalrecur + $cart_amtrecur);
$mini_weight = ($mini_weight + $cart_prodshipweight);
} ######### End of foreach statement.
if ($cart_prodquantity > 0) {
if ($mini_weight >= "0" && $mini_weight <= "500") {
$mini_ship_total = "0.95";
} elsif ($mini_weight >= "500" && $mini_weight <= "1000") {
$mini_ship_total = "1.95";
} elsif ($mini_weight >= "1000" && $mini_weight <= "1500") {
$mini_ship_total = "3.95";
elsif ($mini_weight >= "1500" && $mini_weight <= "2000") {
$mini_ship_total = "4.95";
} else {
$mini_ship_total = "6.95";
}
} else {
$mini_ship_total = "0.00";
}
$mini_ship_total = sprintf("%.2f", $mini_ship_total);
$mini_total = sprintf("%.2f", $mini_total);
$mini_totalrecur = sprintf("%.2f", $mini_totalrecur);
$mini_weight = sprintf("%.0f", $mini_weight);
I'm way out my depth but giving it a go. I got a few syntax errors in the browser so I broke it some how.
I haven't put the add (CGIVAR)mini_ship_total(/CGIVAR) in the ste_layout yet though.
Do you want to know what the syntax errors read?
Bit more help would be great here to put me back on track.
Big thanks,
Darren.
Offline
Looks like you left off a curly brace here (see arrow in second line)
So change:
$mini_ship_total = "3.95"; ---> elsif ($mini_weight >= "1500" && $mini_weight <= "2000") { $mini_ship_total = "4.95";
to:
$mini_ship_total = "3.95"; } elsif ($mini_weight >= "1500" && $mini_weight <= "2000") { $mini_ship_total = "4.95";
See if that helps. If not and you get any syntax errors, by all means post them!
thx,
Dave
Offline
Dave - that has worked a treat - take a look
Now the only problem seems to be that it will add the weight of each separate item added but if you order more than one of the same item it assumes theres only one of that particular item. The main checkout shipping script works ok however.
Nearly there...
Darren.
Offline
Hi Darren,
Glad it's starting to work.
Try changing
$mini_weight = ($mini_weight + $cart_prodshipweight);
to
$mini_weight = ($mini_weight + ($cart_prodshipweight * $cart_prodquantity));
Let me know if it doesn't work. Sorry, my bad.
Dave
Offline
Dave - That worked. I am extremely grateful for all the help you have given me both on this thread and others (as you know!)
Cheers Big Ears
Darren
Offline