close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Free Shipping option for product category if it's the only one in the cart (flat rate cart)

Thread began 12/16/2013 2:02 pm by sublucent | Last modified 12/17/2013 7:52 am by Jason Byrnes | 1305 views | 5 replies |

sublucentBeta Tester

Free Shipping option for product category if it's the only one in the cart (flat rate cart)

I dug through the forums but couldn't piece together what I needed.

The cart that I've setup is flat rate shipping for the whole cart with a drop down to pick between store pickup (free), domestic, domestic express international, and international express, so no weights are used. Now we have added gift cards to the store. The gift cards are in their own category (from a relational table). I've bound the category ID to the WA eCart AddToCart. The gift cards will be emailed so they need to be free shipping if gift cards are the only products in the cart.

The current shipping rules use session variables set from the shipping option drop down menu in the cart. I created a new rule for the gift cards using the trigger condition "Number of items with a specific column value" where Category of 52 (the category ID for gift cards) is > 0. It seems that I now need to add another trigger that checks the cart for any items that are not from Category 52 so it will use the other shipping rules and not make the whole cart free shipping. I haven't been able to figure out how to do this.

Thanks for you time!

php:
//eCart Rule

function WAEC_yoCart_USPS()  {
  $totalShipping = 0;
  if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "US") && ((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Standard"))) {
    $totalShipping += 6;//Result
  }
  return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_DomesticExpress()  {
  $totalShipping = 0;
  if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == "US") && ((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Express"))) {
    $totalShipping += 50;//Result
  }
  return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_International()  {
  $totalShipping = 0;
  if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") != "US") && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") != "") && ((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Standard"))) {
    $totalShipping += 18;//Result
  }
  return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_InternationalExpress()  {
  $totalShipping = 0;
  if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") != "US") && ((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") != "") && ((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Express"))) {
    $totalShipping += 50;//Result
  }
  return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_EmptyShipping()  {
  $totalShipping = 0;
  if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_country'])?$_SESSION['eCartCheckoutForm_shipping_country']:"") == ""))) {
    $totalShipping += 0;//Result
  }
  return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_StorePickup()  {
  $totalShipping = 0;
  if (true && (((isset($_SESSION['eCartCheckoutForm_shipping_method'])?$_SESSION['eCartCheckoutForm_shipping_method']:"") == "Store Pickup"))) {
    $totalShipping += 0;//Result
  }
  return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_yoCart_GiftCertificate()  {
  $totalShipping = 0;
  if (true && (($this->ConditionalTotal("Quantity", "Category", "52") > 0))) {
    $totalShipping += 0;//Result
  }
  return WA_eCart_FormatNumber($totalShipping, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
Sign in to reply to this post

Jason ByrnesWebAssist

createing a shipping rule with a 0 dollar value will not cancel the other rules out, the shipping rules are cumulattive.

to offer free shipping, you need to add a condition to the other rules so they will not apply.

on the calculations tab, add a new calculation as:

applyShipping:
abs([Category] == 52)?0:1

then in your shipping rules add an additional trigger:

AND
"Subtotal for any cart column"
if the subtotal for column "applyShipping" is ">" a value of "0"

Sign in to reply to this post

sublucentBeta Tester

Does this: abs([Category] == 52)?0:1 only trigger if only Category 52 is in the cart? So if category 52 and category 51 are in the cart will it return 1 for false and then the regular shipping will apply? Or does it just check if 52 is in the cart category array and return 0 for true?

Thanks for your help!

Sign in to reply to this post

Jason ByrnesWebAssist

calculations are performed on a line item basis,

so if you have 3 items in the cart, the calculation will be preformed 3 times.

on the first line, if the Category is 52, the calculation will return 0, if not it will return 1

Same for the second line and the third line.

in your shipping rules the added trigger:
AND
"Subtotal for any cart column"
if the subtotal for column "applyShipping" is ">" a value of "0"

will apply shipping if there is an item that is not in the 52 category in the cart.

Sign in to reply to this post

sublucentBeta Tester

That did it! Thank you so much for your quick responses. Life saver!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

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