Blog posts tagged with 'Vendor'

RSS
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 :  Vendor
Comments (0)
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 (1)