Blog posts of '2012' 'January'

RSS
Remove "Additional Shipping Charge" for In Store Pickup- Sunday, January 8, 2012

[updated 10/2014 - replaced ProductVariant with Product]

In the NopCommerce forums, someone had noticed that if you use Fixed Rate shipping but some of your products have "Additional Shipping Charge", that In Store Pickup would still include those charges:

    "...One gotcha - We have items that may individually use the "Additional Shipping Charge" field, and that still factors in.  I had to modify the code and recompile to set this to zero for in-store pickup..."

To remedy this, the user had to modify some code in the core ShippingService module to zero out the rate.    With the Shipping Director, it's easy to modify the rate.

Let's say we have set up Fixed Shipping rate for In Store Pickup ($0.00) and Ground ($9.95).   Then, we set up a Shipping Director option to use the Shipping.FixedRate plugin

If we have a product with an Additional Shipping Charge of $0.99, and add two of those in my shopping cart and estimate shipping I see:

In-Store Pickup ($1.98)
Pick up your items at the store
By Ground ($11.93)
Cost-effective ground shipping

We can negate the Additional Shipping Charge easily by using the Surcharge Expression with a minus sign prefix:

 -(Items.Where(Product.AdditionalShippingCharge > 0).Sum(Quantity * Product.AdditionalShippingCharge))

But, we only want to negate it when the rate option name is "In-Store Pickup", so we use the ternary if-then-else operator "  ?  :  "

  [$Name].Contains("Pickup") ? -(Items.Where(Product.AdditionalShippingCharge > 0).Sum(Quantity * Product.AdditionalShippingCharge)) : 0

In-Store Pickup ($0.00)
Pick up your items at the store
By Ground ($11.93)
Cost-effective ground shipping

Tags :  InStorePickup
Comments (2)
Shipping Director - Packing: Requires Own Box and Sender- Sunday, January 1, 2012

When Packing "FirstFit", the Shipping Director will put an item in the first open box that will fit it.   Sometimes, though, you want an item to be packed in its own box.  This might be the case if the item already has its own box suitable for shipping - i.e. it does not need to be shipped inside another box.  Setting a "Requires Own Package Expression" will tell the Packing to put the item it its own package, and consider the box "full", so that no other items will be packed in the same box.

Another scenario that might pertain to you or your client is shipping from multiple source addresses - e.g. direct from your supplier/distributor, or from different warehouses.  If the order contains mutiple items from different senders, then setting a "Sender Expression" will tell the Packing not to mix items from different senders in the same box.

UPDATE 2019  - There's a helper method for Product.HasCategory(), so you don't need the below category Reference any more.  Your Packing rule's "Requires Own Package Expression"  can look like this

Product.HasCategory("ShippingRequiresOwnBox")

Also, nopCommerce now supports Warehouses, so you probably won't need that "Sender Expression".  See the other blogs about warehouses.  We'll write some new blogs soon.

In the following example, we will use a Category "ShippingRequiresOwnBox", and a Product SpecificationAttribute "Shipping Warehouse"

The Category is set up with Published=False, so that it is not visible to customers:

A Product Specification Attribute is setup for "Shipping Warehouse", and a "Warehouse One" option is created in it.  Also, Show on Product Page is set to false, so the customer won't see it.


Now, in Shipping Director, we use Reference types as shortcuts to the category and attribute properties:

(Note, that the 'sender' reference will be set to "Main" if the product does not have a Shipping Warehouse attribute)

and set up appropriate packing expressions:



Also note above the $Debug special variable.  During packing, and during calls to other shipping plugins, extra debug information will be logged in the system log.  (Since logged messages are plain text and not HTML, they will not appear nicely in the Log page - right click the page and choose view source, then on the source page scroll down about half way and look for the formatted message)

 

Tags :  Packing
Comments (1)
Shipping Director - Reference type- Sunday, January 1, 2012

Beta 2 introduced the "Reference" type.  A reference is a type of variable that is really just a shortcut.  References will typically be used to specify the NopC objects you want to use in your expressions; it makes the expressions more readable, and also prevents you from having to repeatedly type the same object path.    You define a Reference variable with the Reference type, and you access a Reference by prefixing the variable name with "@".  For example:

Order

Type

Name

Expression

5

Reference

product

ProductVariant.Product

6

Reference

categories

[@product].Categories

You can see above that references can themselves access references.  And they can also be used in other expressions like when Packing:

Tags :  ReferenceType
Comments (1)