Blog posts of '2014' 'August'

RSS
Surcharge for Multiple Manufacturers- Sunday, August 31, 2014

A simple concept, with a tricky Count expression :)   We count distinct manufacturers for all the products in the cart.  The base shipping rate is 10.00 (includes up to one manufacturer), and then 3.00 extra surcharge for each manufacturer beyond the first.

Order

Type

Name

Expression

Rate Expression

Surcharge Expression

10

Integer

ManufacturerCount

Items.Select(Product.ProductManufacturers.Any() ? Product.ProductManufacturers.First().Manufacturer.Name : "").Distinct().Count() -1

 

 

20

Decimal

Surcharge

[ManufacturerCount] <= 1 ? 0 : [ManufacturerCount] * 3.00

 

 

100

Option

Shipping

true

10.00

[Surcharge]

Note, that in nopCommerce, Products can have more than one manufacturer, so we only get its first one.  The " -1 " compensates for those products that don't have any manufacturer.  (You can remove that if you want to also count for "the store").  If you want to surcharge even for the first manufacturer, then  change the Surcharge expression to just  [ManufacturerCount] * 3.00

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

Tags :  Manufacturer Fee
Comments (5)
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)