Blog posts tagged with 'Restricted'

RSS
Vendor can only ship to certain cities- Sunday, August 17, 2014

In this scenario, our requirement is to prevent shipping certain products to cities that a vendor does not ship to.  In SD, we check if both the shipping address city is not a permitted city and the cart contains an item for Vendor 1.  If this condition occurs, the ErrorExit line will cause the message like "Sorry, vendor1 does not deliver in your city" to appear to the customer, and prevent them from checking out. (The double quotes are required because Description Expression is an expression) 

Order

Type

Name

Expression

Description Expression

10

String

Vendor1 Cities

"Boston, Seattle, Las Vegas"

 

20

Boolean

Not a Vendor1 City

![Vendor1 Cities].Contains(ShippingAddress.City)

 

50

ErrorExit

Vendor1 Restriction

Items.Any(Product.VendorId = 1) and [Not a Vendor1 City]

"Sorry, vendor " + Items.First(Product.VendorId = 1).GetVendor().Name + " does not deliver in your city"

60

Option

 

 

 

  Order Line 60 would be whatever Option(s) you would want to offer.  However, if there are multiple items in the cart, the customer may wonder which product is sold by Vendor1 -so, we can let them know with a message like:  "Sorry, HP Pavilion Artist Edition DV2890NR 14.1-inch Laptop is sold by vendor1, whom does not deliver in your city" .  Use this expression instead:

"Sorry, " + Items.First(Product.VendorId = 1).Product.Name + " is sold by " + Items.First(Product.VendorId = 1).GetVendor().Name + ", whom does not deliver in your city"

You can download the above configuration that you can then import into Shipping Director.

Tags :  VendorRestricted
Comments (2)
Restricted Products Can’t Ship to Outside of Certain Countries.- Tuesday, August 7, 2012

In this scenario, our requirement is to prevent shipping certain products to countries outside of the European Union (EU 27).  Similar to the last blog, you should set up an unpublished category for the restricted products.  Then, in SD, we check if both the shipping address is outside the permitted countries and the cart contains restricted products.  If this condition occurs, the ErrorExit line will cause the message "Sorry, we can't ship restricted products outside the EU" to appear to the customer, and prevent them from checking out. (The double quotes are required because Description Expression is an expression) 

Order

Type

Name

Expression

Description Expression

30

String

EU_27

"AT,BE,BG,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IE,IT,LV,LT,

LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,GB,"

 

40

Boolean

IsRestrictedCountry

![EU_27].Contains(ShippingAddress.Country.TwoLetterIsoCode)

 

50

ErrorExit

 Restricted Products

[IsRestrictedCountry] and Items.Any(Product.HasCategory("Restricted Shipping"))

"Sorry, we can't ship restricted products outside the EU"

60

Option

 

 

 

  Order Line 60 would be whatever Option(s) you would want to offer.

(The above blog was updated 9/8/2013.  Older versions of Shipping Director did not have HasCategory() function, and used a more complex expression to get the Category:

Order

Type

Name

Expression

Description Expression

10

Reference

categories

 ProductVariant.Product.ProductCategories

 

20

Reference

categoriesAny_Restricted

 [@categories].Any(Category.Name = "Restricted Shipping")

 

30

String

EU_27

"AT,BE,BG,CY,CZ,DK,EE,FI,FR,DE,GR,HU,IE,IT,LV,LT,

LU,MT,NL,PL,PT,RO,SK,SI,ES,SE,GB,"

 

40

Boolean

IsRestrictedCountry

![EU_27].Contains(ShippingAddress.Country.TwoLetterIsoCode)

 

50

ErrorExit

 Restricted Products

 [IsRestrictedCountry] and Items.Any([@categoriesAny_Restricted])

"Sorry, we can't ship restricted products outside the EU"

60

Option

 

 

 


Tags :  Restricted
Comments (1)