close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Shipping Pickup Option

Thread begun 10/16/2009 11:04 am by kevin347925 | Last modified 10/21/2009 1:33 pm by Eric Mittman | 4982 views | 8 replies |

kevin347925

Shipping Pickup Option

I would like to add a checkbox to my cart page with the label entitled, "Order Pickup."

When the user clicks the "update cart" button, the shipping cost would zero out and vice versa.

How would I go about doing this? Thanks so much.

Sign in to reply to this post

Eric Mittman

How you would implement this depends on how your shipping rule is setup. The norm is that there is a particular session variable that will be set and this is what the shipping charge is triggered on. If you unset this value then this would zero out the shipping, getting it back though would require you to either set the value back to what it was or run the code that generates the value again. So it all depends on how your shipping is currently setup. Please post back with some more details about your charge rule for the shipping and we can give you some pointers on how to get this going.

Sign in to reply to this post

kevin347925

Sure Eric.

I have two shipping rules set up, one for each product type ([1] candles and [2] signs).

I have set up a base rate system with tiers ($0 - $20 = X and so on) for each of the two product types. The shipping subtotals for each product then add to create the shipping total.

The code is below if that helps...

//Shipping
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%201"), true, "WAEC_CommonScentsCart_CandlesShipping");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%202"), true, "WAEC_CommonScentsCart_CS2");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%203"), true, "WAEC_CommonScentsCart_CS3");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%204"), true, "WAEC_CommonScentsCart_CS4");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%205"), true, "WAEC_CommonScentsCart_CS5");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%206"), true, "WAEC_CommonScentsCart_CS6");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%201"), true, "WAEC_CommonScentsCart_SN1");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%202"), true, "WAEC_CommonScentsCart_SN1b");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%203"), true, "WAEC_CommonScentsCart_SN3");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%204"), true, "WAEC_CommonScentsCart_SN4");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%205"), true, "WAEC_CommonScentsCart_SN5");
}
//end node
//start node
//eCart Rule
function WAEC_CommonScentsCart_SalesTax() {
$totalTax = 0;
if (true && (($this->GetTaxableTotal() > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "FL"))) {
$totalTax += ($this->GetTaxableTotal() * .07);//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CandlesShipping() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") <= 20.00))) {
$totalShipping += 10.50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS2() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 20.00) && ($this->TotalColumn("CDshipping") <= 40.00))) {
$totalShipping += 14.50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS3() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 40.00) && ($this->TotalColumn("CDshipping") <= 70.00))) {
$totalShipping += 21.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS4() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 70.00) && ($this->TotalColumn("CDshipping") <= 100.00))) {
$totalShipping += 25.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS5() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 100.00) && ($this->TotalColumn("CDshipping") <= 140.00))) {
$totalShipping += 29;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS6() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 140))) {
$totalShipping += 40.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN1() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") == 1))) {
$totalShipping += 10;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN1b() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") == 2))) {
$totalShipping += 15;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN3() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") == 3))) {
$totalShipping += 20;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN4() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") == 4))) {
$totalShipping += 25.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN5() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") >= 5))) {
$totalShipping += 30;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule

Thanks so much.

Kevin

Sign in to reply to this post

Eric Mittman

Thanks for the updated info about the charge rules. I have an idea that could get this working for you but it will require a little bit of editing of your rules to add in a new condition.

The idea is that you set a new session variable, this session variable can be called something like pick_up. You should set this session variable on the cart display page and default it to 0. You will then have another set of this code that will be very similar but the trigger will be the checkbox that the user checks for pick up.

Then on the cart page you can have your checkbox to indicate pick up instead of shipping, when the user checks this box and submits the page your set session value server behavior will set the value of the pick_up session variable to 1.

You will then need to update the charge rules to check this session variable and ensure that it has a value of 0 in order to make the charge.

If you set the checkbox to be checked based on the value of this session variable it will represent weather or not the user has made that choice. The last thing you will need is another set session server behavior like the one that sets the variable when the box is checked. This time though you will need to check the value of the check box and if it does not have a value set the pick_up variable back to 0.

This is just one way you could do it but I think it would fit your situation. If you have any questions or would like any clarification on any part of this please let us know.

Sign in to reply to this post

kevin347925

Thanks, Eric.

I will give this a try tomorrow.

Sign in to reply to this post

kevin347925

Thanks for all your help so far.

Ok.

I think I have it set so that the session variable changes based on whether or not the checkbox clicked. I had it set to update when any form button is pressed.

I am running into some trouble when it actually comes to making a the shipping go to 0 when pick_up is set to one. I tried to make another shipping rule and edit the code, but it's not working. I can't hide my nooness!

Below is the code. Any direction would be very much appreciated.

//Shipping
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%201"), true, "WAEC_CommonScentsCart_CandlesShipping");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%202"), true, "WAEC_CommonScentsCart_CS2");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%203"), true, "WAEC_CommonScentsCart_CS3");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%204"), true, "WAEC_CommonScentsCart_CS4");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%205"), true, "WAEC_CommonScentsCart_CS5");
$this->Shipping[] = new WA_eCart_Rule(urldecode("CS%206"), true, "WAEC_CommonScentsCart_CS6");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%201"), true, "WAEC_CommonScentsCart_SN1");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%202"), true, "WAEC_CommonScentsCart_SN1b");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%203"), true, "WAEC_CommonScentsCart_SN3");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%204"), true, "WAEC_CommonScentsCart_SN4");
$this->Shipping[] = new WA_eCart_Rule(urldecode("SN%205"), true, "WAEC_CommonScentsCart_SN5");
$this->Shipping[] = new WA_eCart_Rule(urldecode("Pickup"), true, "WAEC_CommonScentsCart_Pickup");
}
//end node
//start node
//eCart Rule
function WAEC_CommonScentsCart_SalesTax() {
$totalTax = 0;
if (true && (($this->GetTaxableTotal() > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "FL"))) {
$totalTax += ($this->GetTaxableTotal() * .07);//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CandlesShipping() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") <= 20.00))) {
$totalShipping += 10.50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS2() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 20.00) && ($this->TotalColumn("CDshipping") <= 40.00))) {
$totalShipping += 14.50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS3() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 40.00) && ($this->TotalColumn("CDshipping") <= 70.00))) {
$totalShipping += 21.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS4() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 70.00) && ($this->TotalColumn("CDshipping") <= 100.00))) {
$totalShipping += 25.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS5() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 100.00) && ($this->TotalColumn("CDshipping") <= 140.00))) {
$totalShipping += 29;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_CS6() {
$totalShipping = 0;
if (true && (($this->TotalColumn("CDshipping") > 140))) {
$totalShipping += 40.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN1() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") == 1))) {
$totalShipping += 10;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN1b() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") == 2))) {
$totalShipping += 15;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN3() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") == 3))) {
$totalShipping += 20;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN4() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") == 4))) {
$totalShipping += 25.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_SN5() {
$totalShipping = 0;
if (true && (($this->ConditionalTotal("Quantity", "Itemtype", "SN") >= 5))) {
$totalShipping += 30;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_CommonScentsCart_Pickup() {
$totalShipping = 0;
if (true && ((isset($_SESSION['pick_up']) == 1))) {
$totalShipping = 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule

Sign in to reply to this post

Eric Mittman

You should be able to make the edits to your shipping rules directly from within eCart. On the shipping tab where you have the rules defined just edit one, and add in another condition to the trigger. For the new condition you will choose 'based on a session variable value' and then specify your pick_up session variable and look for the value to not equal 1.

So long as you are setting this session variable correctly and you have this extra check in each of the charge rules it should suppress shipping charges from showing. As a test add an item to the cart and trigger one of the shipping rules, then check the box and submit the form to set the session variable correctly. It should then stop the shipping from occurring. Let us know what you encounter.

Sign in to reply to this post

kevin347925

It is working great. Thanks, Eric.

Sign in to reply to this post

Eric Mittman

Glad to hear that. When you have as many rules as you do it can be a bit of a pain to have to update all of them like this but at least you can do it from within the interface.

Sign in to reply to this post

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...