eCart shipping option
I have my eCart set up to add in shipping, a % of the item cost.
Some customers want to collect the goods, how do I make the shipping charge an option in the shopping cart?
I have my eCart set up to add in shipping, a % of the item cost.
Some customers want to collect the goods, how do I make the shipping charge an option in the shopping cart?
On the checkout page add a new checkbox called pickup set the checked value to 1:
<input name="pickup" type="checkbox" id="local" value="1">
on the confirm page, create a hidden form element by the same name, set it to get the initial value form the checkbox on the checkout page:
<input name="pickup" type="hidden" id="local" value="<?php echo((isset($_POST["pickup"]))?$_POST["pickup"]:"") ?>">
now on the confirm page, add a sest session value server behavior to capture the pickup form element value. SDet the trigger to any form post, the name to pickup and get the value from the pickup form element:
<?php
if (!session_id()) session_start();
if($_SERVER["REQUEST_METHOD"] == "POST") {
$_SESSION["pickup"] = "".((isset($_POST["pickup"]))?$_POST["pickup"]:"") ."";
}
?>
in the shipping rule add another trigger:
Based on session variables value:
if the Session Variable "pickup" is "<>" a value of "1"
I have tried to follow, however in my cart page I already have a shipping cost before I get to checkout. This is added by the add to cart button.
I am also unsure where on the page I put the Checkbox, Billing or shipping info area or does it make a difference??
Does it matter where I put the hidden form element code?
<input*name="pickup"*type="hidden"*id="local"*value="<?php*echo((isset($_POST["pickup"]))?$_POST["pickup"]:"")*?>">
I have put the session variable on with the other session variables.
Allowing for local pickup doesn't alter the Grand Total result
In the shipping rule (see Pic) I cannot select "<>" with a value of 1
It doesn't matter where the checkbox element is added on the checkout page as long as it is within the checkout form.
Same for the hidden form element on the confirm page, as long as it is part of the form that exists on that page.
The Session code should be added with all of the other set session value behaviors on the confirm page.
The shipping is showing because of the way you have it triggered.
if you do not have the option for "<>" when creating the rule use "!="
More questions.
I have deleted the shipping details from my cart page and it now does not show shipping costs.
I still have the shipping costs added to the total in confirm page.
I would have thought that I need a condition If I check this box "pickup" Then do not add shipping costs. I have 2 rules, ONE a $fee per item and a TWO a $fee based on a percentage of the total sales.
I can see nothing in the supplied php code that supports any condition "if, then ignore shipping"
But I am only a beginner.
Can you please clarify
Thank you
You have to add the condition to your shipping rules by adding another trigger to the shipping rule as I outlined in my previous posts.
It is a four part process:
1) Create the checkbox on the checkout page
2) Create the hidden form element on the confirm page.
3) Add the set session value code to the confirm page
4) Add a trigger to the shipping rule so it is only applied if the session variable does not equal 1.
Look back at my previous replies for information on adding the trigger to the shipping rule.
Yes Finally
I had the new shipping trigger at the bottom of the list, moved it to the top and it works.
Thank you, Now how do I get the "Local Pickup" to appear on the confirm page?
<?php if(isset($_POST['pickup']) && $_POST['pickup'] == "1") { ?>
Local Pickup
<?php } ?>
Thank you for your help.
At the risk of you telling me exactly.. Where do I put the code supplied .
I have tried to put the code in a number of areas but the code will not render and in Dreamweaver it does not "highlight" as code with the proper syntax.
I tried to put it with the other php code in the "shipping information" area of the confirm page. Here just after lastname:
<p class="eC_OrderInfo"><?php echo((isset($_POST["shipping_firstname"]))?$_POST["shipping_firstname"]:"") ?> <?php echo((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:"") ?><br /> XXXXXXXX
<?php echo((isset($_POST["shipping_street1"]))?$_POST["shipping_street1"]:"") ?><br />
It should go where you want the local pickup message to display.
you want it to show before the First name and last name, then change:
<p class="eC_OrderInfo"><?php echo((isset($_POST["shipping_firstname"]))?$_POST["shipping_firstname"]:"") ?> <?php echo((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:"") ?><br />
to:
<p class="eC_OrderInfo"><?php if(isset($_POST['pickup']) && $_POST['pickup'] == "1") { ?>
Local Pickup
<?php } ?><?php echo((isset($_POST["shipping_firstname"]))?$_POST["shipping_firstname"]:"") ?> <?php echo((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:"") ?><br />
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
These out-of-the-box solutions provide you proven, tested applications that can be up and running now. Build a store, a gallery, or a web-based email solution.