close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Combined Shipping Discounts:

Thread began 2/05/2010 2:36 pm by BeDigital94844 | Last modified 5/27/2010 8:31 pm by Eric Mittman | 2658 views | 27 replies |

BeDigital94844Beta Tester

Combined Shipping Discounts:

Shipping Discounts combined:

1. provide the customer a shipping over-ride PromoCode
enter PromoCode "Freeshipping" for any order of any amount


2. free shipping for orders over $100 US domestic only

I am able to get Free shipping to work for all orders over $100 but I can not seem to add for domestic only based on US ship to country or the shipping over ride discount promo

On the cart page:
I have created the following session

PromoCode:

Trigger = ((isset($_POST["txtPromoCode"]))?$_POST["txtPromoCode"]:"")
Name = PromoCode
Value= <?php echo ((isset($_POST["txtPromoCode"]))?$_POST["txtPromoCode"]:""); ?>

On the check out page:
I have created the following session

Ship To session:

Trigger- ((isset($_POST["shipping_country"]))?$_POST["shipping_country"]:"")
Session Name: shipTo
Value: <?php echo ((isset($_POST["shipping_country"]))?$_POST["shipping_country"]:""); ?>

In eCart 4.5

I have the following
Merchandising Rule Discounts:

1. Free_Shipping_Over ride
Trigger = "Total Number of Items > 0 "
AND If Session variable PromoCode == FREESHIP

Calculation
Flat Rate 0.00


2. Free Shipping over 100
Trigger = Sub Total of Total Price < 100
AND If Session variable shipTo == US

I realize the check out page is where the ship to happens and I have the session on that page but I can not get the shipping to work as an over ride or based on ship to country


not sure what I am missing I reviewed much of the discount threads- I am getting there very slowly… I am beginning to think a need to have a text field for the promo shipping discount on the check out page and it will update the confirm page...

any help would be appreciated - thank you

Sign in to reply to this post

Eric Mittman

The way that you have the rules defined seem ok to me. If the charges are not working like this then there may be a problem with the session variable values you are using. If they are not set to the correct value then the rules will not work properly. It seems that all of these values should be present by the time you get the the confirm page initially. A good test would be to print out the values of these session variables to ensure that they are being set correctly. You can do that with this code:

php:
<?php print("The value of PromoCode is: " $_SESSION['PromoCode'] . "<br/>"); ?>

<?php 
print("The value of shipTo is: " $_SESSION['shipTo'] . "<br/>"); ?>



Make sure that you put this in the visible section of your confirm page so you can ensure that the values should already be set. If you do not see the values that you are expecting then you may need to look into how you are setting the session variables to see if there is a problem. Let us know what you discover.

Sign in to reply to this post

BeDigital94844Beta Tester

Combined Shipping Discounts

Thank you Eric- I'll let you know...

Sign in to reply to this post

BeDigital94844Beta Tester

Combined Shipping Discounts

Eric-

Thanks for your support - still having a difficult time getting the shipping over> $100 to be applied to only US ship to countries: everything eles seems to work- all ship to countries with order greater than $100 receive free shipping- which is incorrect but is likely due to the individual shipping rules Total Price <100

I am using the $_SESSION["eCartCheckoutForm_shipping_country"] on the confirm page


here is the shipping rules - there are 4 types of shipping Fedex standard, next day, 2 day, and international - I think those rules may conflict with the free domestic over 100 rule

//start node
function DefineRules() {
$this->Discounts = array();
$this->Charges = array();
$this->Tax = array();
$this->Shipping = array();
$this->ShippingIsTaxed = true;
//Discounts
$this->Discounts[] = new WA_eCart_Rule(urldecode("Free_Shipping_Override"), true, "WAEC_eCart1_Free_Shipping_Override");
$this->Discounts[] = new WA_eCart_Rule(urldecode("Promo%2015%25%20%20Discount"), true, "WAEC_eCart1_15PromoDiscount");
$this->Discounts[] = new WA_eCart_Rule(urldecode("Promo%2020%25%20Discount"), true, "WAEC_eCart1_Pomotional20Discount");
$this->Discounts[] = new WA_eCart_Rule(urldecode("Promo%2025%25%20Discount"), true, "WAEC_eCart1_Promo25Discount");
//Charges
//Tax
$this->Tax[] = new WA_eCart_Rule(urldecode("NJS%20Sales%20Tax"), true, "WAEC_eCart1_NJSalesTax");
$this->Tax[] = new WA_eCart_Rule(urldecode("NYS%20Sales%20Tax"), true, "WAEC_eCart1_NYSSalesTax");
//Shipping
$this->Shipping[] = new WA_eCart_Rule(urldecode("Shipping%20&%20Handling"), false, "WAEC_eCart1_ShippingHandling");
$this->Shipping[] = new WA_eCart_Rule(urldecode("Fedex%20Standard"), true, "WAEC_eCart1_FedexStandard");
$this->Shipping[] = new WA_eCart_Rule(urldecode("Fedex%20Next%20Day"), true, "WAEC_eCart1_FedexNextDay");
$this->Shipping[] = new WA_eCart_Rule(urldecode("Fedex%202%20Day"), true, "WAEC_eCart1_Fedex2Day");
$this->Shipping[] = new WA_eCart_Rule(urldecode("Fedex%20International"), true, "WAEC_eCart1_FedexInternational");
$this->Shipping[] = new WA_eCart_Rule(urldecode("FreeDomesticShippingOver100"), true, "WAEC_eCart1_FreeDomesticShippingOver100");
}
//end node
//start node
//eCart Rule
function WAEC_eCart1_Free_Shipping_Override() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['PromoCode'])?$_SESSION['PromoCode']:"") == "SHIP4FREE"))) {
$totalDiscount += 0.00;//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_15PromoDiscount() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['PromoCode'])?$_SESSION['PromoCode']:"") == "L7ViYvea"))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * 0.15);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_Pomotional20Discount() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['PromoCode'])?$_SESSION['PromoCode']:"") == "KVGVIP"))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * 0.20);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_Promo25Discount() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['PromoCode'])?$_SESSION['PromoCode']:"") == "CLBuvb6i"))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * 0.25);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_NJSalesTax() {
$totalTax = 0;
if (true && (($this->GetTaxableTotal() > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "New Jersey") || ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "NJ"))) {
$totalTax += ($this->GetTaxableTotal() * 0.070);//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_NYSSalesTax() {
$totalTax = 0;
if (true && (($this->GetTaxableTotal() > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "New York") || ((isset($_SESSION['eCartCheckoutForm_shipping_state_province'])?$_SESSION['eCartCheckoutForm_shipping_state_province']:"") == "NY"))) {
$totalTax += ($this->GetTaxableTotal() * 0.08775);//Result
}
return WA_eCart_FormatNumber($totalTax, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_ShippingHandling() {
$totalShipping = 0;
if (false && ((sizeof($this->Items) > 0))) {
$totalShipping += 10;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_FedexStandard() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_type'])?$_SESSION['eCartCheckoutForm_shipping_type']:"") == "1") && ($this->TotalColumn("TotalPrice") < 100))) {
$totalShipping += 9.95;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_FedexNextDay() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_type'])?$_SESSION['eCartCheckoutForm_shipping_type']:"") == "2") && ($this->TotalColumn("TotalPrice") < 100))) {
$totalShipping += 21.95;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_Fedex2Day() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_type'])?$_SESSION['eCartCheckoutForm_shipping_type']:"") == "3") && ($this->TotalColumn("TotalPrice") < 100))) {
$totalShipping += 14.95;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_FedexInternational() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_type'])?$_SESSION['eCartCheckoutForm_shipping_type']:"") == "4") && ($this->TotalColumn("TotalPrice") < 100))) {
$totalShipping += 28.50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_FreeDomesticShippingOver100() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) == 0) && ($this->TotalColumn("TotalPrice") > 100) && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "US"))) {
$totalShipping += 0.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule

Sign in to reply to this post

Eric Mittman

If this is the only one you are having trouble with you should print out the values you are using in this rule to see what they are when you get to the confirm page. On your confirm page you can add in the following code to view these values:

php:
<?php

print("the total of the items in the cart is: " $eCart1->TotalColumn('TotalPrice') . "<br/>" "the checkout country is: " $_SESSION['eCartCheckoutForm_shipping_country']);
?>



Also, one other thing that I noticed is that you have the other rules setup for < 100, because of this the final rule should be looking for >= 100. If the total was exactly 100 neither rule would trigger.

Sign in to reply to this post

BeDigital94844Beta Tester

Combined Shipping Discounts

Eric-
Thank you-
I've done that and yet the discount "Free shipping over $100 " is applied to ALL countries
not just to US. I've been working on this for a few weeks and it's the only outstanding item
I've tried all sorts of combinations - not equal to US, changing the 4 primary rules using OR - I just can't seem to figure this one out.

I appreciate your help more than I can express- thank you

attached is a screen shot

and code-------- of the last drop down (4) and the exception rule

//eCart Rule
function WAEC_eCart1_FedexInternational() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_type'])?$_SESSION['eCartCheckoutForm_shipping_type']:"") == "4") && ($this->TotalColumn("TotalPrice") < 100))) {
$totalShipping += 28.50;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_FreeDomesticShippingOver100() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) == 0) && ($this->TotalColumn("TotalPrice") >= 100) && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "US"))) {
$totalShipping += 0.00;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule

Sign in to reply to this post

Eric Mittman

The rule that you have crafted for free US shipping seems to be fine to me. Have you disabled this rule and tested it or disabled the other rules and tested to ensure that it is the free US shipping rule that is being triggered?

If you can post back with a copy of your WA_eCart > eCart1_PHP.php I can do some testing and let you know what I experience.

Sign in to reply to this post

BeDigital94844Beta Tester

Combined Shipping Discounts

Thanks Eric-

I tried various combinations- it appears to trigger- attached are the eCart and the checkout page-

The drop down shipping option is on the checkout page.

I am interested in what you find - and appreciate your help- this has helped me understand eCart much more, thank you.

Attached Files
ecart.zip
Sign in to reply to this post

Eric Mittman

It looks like the problem might be that the session variable for shipTo is not getting set. This is because you have the set session code on the checkout page. The checkout form on this page posts to the confirm page so your code is not getting executed to set the shipTo variable. To make it work properly you just need to move the code for this on your checkout page to the confirm page:

php:
<?php

if (!session_id()) session_start();
if((((isset(
$_POST["shipping_country"]))?$_POST["shipping_country"]:"") != ""))     {
  
$_SESSION["shipTo"] = "".((isset($_POST["shipping_country"]))?$_POST["shipping_country"]:"")  ."";
}
?>



With this code on your confirm page the shipTo variable should be set and trigger the rule. Give this a try and let us know how it goes.

Sign in to reply to this post

BeDigital94844Beta Tester

Combined Shipping Discounts

Eric-

Thank you- still no joy.

The sessions are displaying on the Confirm page - just fine

but I think the issue is the specific rules- for shipping which displays < $100

There are 4 shipping types standard, next day, 2 day and international these all have an AND statement "Total Price"< 100 which allows ALL orders over $100 to exclude the flat rate specific dollar amount

However- I can not get US ship to country to override this flat rate with $0.00

This is the first rule: where fax is the drop down of the ship type 1-4

//eCart Rule
function WAEC_eCart1_FreeShippingDomesticOver100() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "US") && ($this->TotalColumn("TotalPrice") >= 100) && ((isset($_SESSION['eCartCheckoutForm_shipping_fax'])?$_SESSION['eCartCheckoutForm_shipping_fax']:"") == "1"))) {
$totalShipping += 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_eCart1_FedexStandard() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_fax'])?$_SESSION['eCartCheckoutForm_shipping_fax']:"") == "1") && ($this->TotalColumn("TotalPrice") < 100))) {
$totalShipping += 9.95;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule



I think there needs to be a conditional statement somewhere


//eCart Rule
function WAEC_eCart1_FreeShippingDomesticOver100() {
$totalShipping = 0;
if (true && ((sizeof($this->Items) > 0) && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "US") && ($this->TotalColumn("TotalPrice") >= 100) && ((isset($_SESSION['eCartCheckoutForm_shipping_fax'])?$_SESSION['eCartCheckoutForm_shipping_fax']:"") == "1"))) {
$totalShipping += 0;//Result
}
return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule

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