close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

eCart shipping option

Thread began 12/06/2009 9:23 pm by david331670 | Last modified 12/22/2009 7:02 pm by Jason Byrnes | 2227 views | 18 replies |

david331670

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?

Sign in to reply to this post

Jason ByrnesWebAssist

On the checkout page add a new checkbox called pickup set the checked value to 1:

php:
<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:

php:
<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:
<?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"

Sign in to reply to this post

david331670

eCart shipping

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

Sign in to reply to this post

Jason ByrnesWebAssist

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 "!="

Sign in to reply to this post

david331670

eCart shipping

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

Sign in to reply to this post

Jason ByrnesWebAssist

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.

Sign in to reply to this post

david331670

eCart shipping

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?

Sign in to reply to this post

Jason ByrnesWebAssist

php:
<?php if(isset($_POST['pickup']) && $_POST['pickup'] == "1") { ?>
Local Pickup
<?php ?>
Sign in to reply to this post

david331670

eCart shipping

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"]:"") ?>&nbsp;<?php echo((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:"") ?><br /> XXXXXXXX
<?php echo((isset($_POST["shipping_street1"]))?$_POST["shipping_street1"]:"") ?><br />

Sign in to reply to this post

Jason ByrnesWebAssist

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:

php:
<p class="eC_OrderInfo"><?php echo((isset($_POST["shipping_firstname"]))?$_POST["shipping_firstname"]:""?>&nbsp;<?php echo((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:""?><br />




to:

php:
<p class="eC_OrderInfo"><?php if(isset($_POST['pickup']) && $_POST['pickup'] == "1") { ?>

Local Pickup
<?php ?><?php echo((isset($_POST["shipping_firstname"]))?$_POST["shipping_firstname"]:""?>&nbsp;<?php echo((isset($_POST["shipping_lastname"]))?$_POST["shipping_lastname"]:""?><br />
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

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.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...