Blog posts of '2015' 'October'

RSS
"Saturday Delivery" method, but only show it on Friday- Sunday, October 11, 2015


You can use the day of week in your expressions.  For example, if you need to have Saturday Delivery, but only want to show that option on Friday, here's an example using Shipping By Weight. You can create another Shipping Method (e.g.  "Saturday Delivery"), and Shipping Director can exclude it conditionally (when not Fri) by using Name Expression.

The Name Expression would look like this (assuming your method name has the word "Saturday" in it - e.g.  "Saturday Delivery") :

    [$Name].Contains("Saturday") and DateTime.Today.ToString("ddd") <> "Fri" ? "" : [$Name]

Note, though, that you may also want to check the Time too (because if they place the order Fri at 11pm, you may not be able to get it there Sat ;)

Another example would be to show an additional set of shipping options with a surcharge.  For example, if you use Shipping By Weight, you can call it twice with the Option type. The 2nd call would check if the country is Belgium and the day of the week is Thu or Fri; it would have a Surcharge Expression, in this case just a fixed 2.50:

Order

Type

Name

Expression

Rate Expression

Surcharge Expression

110

Option

By Weight

true

Shipping.ByWeight

 

100

Boolean

AllowSaturday

Country = "BE" and "Thu,Fri".Contains(DateTime.Today.ToString("ddd"))

 

 

120

Option

By Weight Sat

[AllowSaturday]

Shipping.ByWeight

2.50

Tags :  Day-of-week
Comments (2)
Prevent checkout if the cart has products that don't all have the same vendor- Thursday, October 1, 2015

There are a few blogs that show how to use ErrorExit to prevent the customer from checking out; like this one.

Here's how to prevent checkout if the cart has products that don't all have the same vendor:


 ErrorExit        Items.Select(Product.VendorId).Distinct().Count() > 1                  "Your cart contains products that don't all have the same vendor"

Tags :  VendorErrorExit
Comments (2)