Blog posts tagged with 'Packing'

RSS
More about Packing- Friday, October 12, 2012

As per the blog that discusses Shipping Director built-in variables:

Rate Request Type - When Packaging, can be set by user to indicate the way that rate requests are made to other rate calculation methods when Packaging

Note that the Rate Request Types pertain when rate requests are made to other rate calculation methods (i.e. external methods like FedEx, UPS, etc.)

An external method like FedEx does its own "packing" - it will take the items in the cart, and "approximate" the number of packages based on dimensions/weight.   I've posted nopCommerce forum topics about how poor the algorithm is, and that's why I provide here at nopTools.com a modified version of the FedEx plugin(which was adopted by nopCommerce in version 2.50), and also created SD’s First Fit Single Box packing.

“OneRequestForAllPackages” is the default setting - it calls the external shipping plugin just once, and that plugin will do its own approximation of the number of packages.  That's when it's useful to use the new FedEx plugin which supports "PackByOneItemPerPackage" - then, the packing done by SD is respected by the FedEx plugin (no additional "approximate packing" is done).

With “OneRequestPerPackage”, SD will make multiple requests (one per package) to the external plugin, and aggregate the like named carrier options.   Liked named aggregation means that when FedEx returns a "Ground" rate for each separate request, they are added together, and the customer sees a single "Ground" option/rate.

“OneRequestPerSender” is used when using the Packing record type’s Sender Expression.  Here too, SD will make multiple requests (one per sender) to the external plugin, and again does liked named aggregation.  This blog about Packing by Warehouseprovides a good explanation.

Tags :  Packing
Comments (1)
Packing removes Free Shipping items- Monday, April 23, 2012

When configuring a product variant you can select "Free Shipping:".   However, there are a few caveats you should know.

1) If ALL the items in the cart are marked Free Shipping, then the shipping charge will be $0 regardless of any shipping method or configuration (country/weight, etc).  Even Shipping Director cannot override this, as it is calculated in the core system.

2) Free Shipping is currently not respected by online rate methods (FedEx, UPS, USPS, etc.).  It is respected by the offline methods ByTotal, and ByWeight.  And, it's also respected by Shipping Director's Packing.

By "respected", I mean that all the product items will be counted in the weight/dimensions.  To get an accurate rate, you need to only get a rate based on the weight/dimensions of the non-free-shipping items.

So, a simple setup to use the product variant Free Shipping with an online method looks like this

Type

Name

Expression

Rate Expression

Packing

Pack ignores items marked FreeShipping

true

Packing.FirstFitSingleBox

OptionExit

FedEx only sees packed items

true

Shipping.Fedex

However, the above will (for items that are not free shipping) calculate rates  for ALL the shipping methods - Ground, Priority, Standard, etc.

If you want to only offer Free Ground Shipping then it is necessary to first get a rate quote for all items, and then get a rate quote for just the non-free-shipping items for just the Ground method.  But, as pointed out above, if ALL items are marked Free Shipping in the product variant, then we always get a $0 rate.  So, we can't use the Free Shipping checkbox on the variant.  Instead, I recommend using a Category.  Set up a "Free Ground Shipping" Category, and mark it as unpublished (i.e. uncheck "Published" check box).  If the category is unpublished, you can still put products in the category, but it won't appear in the category navigation tree or elsewhere.   (If you need free ground on only a specific variant of a product, then you'll have to use some other mechanism; we won't cover that here.)

To get Ground only rates, we need to exclude certain methods (e.g. Priority, Standard).  For that we need to use the Option record type's ability to modify the shipping method Name returned by the offline shipping method; if the Name Expression evaluates to blank (""), then the entire method/rate is excluded.    Also, we need to replace the the first Ground rate calculated on all the product items.  For that, we use the new OptionReplace type.  The "Option" type adds rates to existing same-Name methods, whereas "OptionReplace" will replace the rate.

So, assuming we are not using product variant Free Shipping and instead using Categories, it looks like this - Get rates for all methods, pack only the non-Free Shipping items (by excluding Free-Shipping items), get the rates again but only keep the Ground rate replacing the original Ground rate.

EvalType

Name

Expression

Rate Expression

Name Expression

Description Expression
(Exclude)

Reference

hasFreeGroundShipping

Product.HasCategory("Free Ground Shipping")

 

 

 

Option

FedEx All Items

true

Shipping.Fedex

 

 

Packing

Pack exclude free-ground items

Items.Any([@hasFreeGroundShipping])

Packing.FirstFitSingleBox

 

[@hasFreeGroundShipping]

OptionReplace

FedEx Ground Only

Items.Any([@hasFreeGroundShipping])

Shipping.Fedex

[$Name].Contains("Ground")
? [$Name] : ""

 

Don't forget, you can use the $Debug variable as your first record, and this will provide detailed processing messages in the System Log (view source of page for readability).

EvalType

Name

Expression

Boolean

$Debug

true


(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 – it had two References rather than one:

EvalType

Name

Expression

Reference

HasCategory

ProductVariant.Product.ProductCategories.Any

Reference

hasFreeGroundShipping

[@HasCategory](Category.Name =
 "Free Ground Shipping")


Tags :  PackingFreeShipping
Comments (0)
Packing by Warehouse (Sender Expression with Ship From Information)- Friday, March 16, 2012

It’s valuable to pack items in separate boxes to calculate rates per box (package), and using the Package record type’s Sender Expression is one way to do it.  The Sender Expression calculates a Sender Identifier on a package, and the real power of using Sender Expression when packing is to override the default sending location (ZipCode & Country).    NopCommerce has defined Ship From fields in the shipping rate request, and Shipping Director supports them.   In Shipping Director, the Ship From fields can be set up when packing by using the Sender Expression; when the special tags “ZipCode=” and “Country=” are seen in the string result of the Sender Expression, then when passing packages to other shipping plugins, the tag values are used to set the Ship From fields.  The tags are of the form “tag=value;” – the value is everything between the “=” and the terminating “;”.  For example, “ZipCode=10021;Country=US;”.

By default, when a Sender identifier is seen on the first package, then the Shipping Rate Request type is “One Request per Sender” - i.e. $ShippingRateRequest=OneRequestPerSender.  This means that all the packages with the same sender identifier are sent in a single request to the other shipping plugin.  If there are multiple sender identifiers, then multiple requests are made. Then, the rates for the same shipping option name (e.g. “FedEx Ground”) are summed together.

The above Sender Expression “ZipCode=10021;Country=US;” illustrates that the expression is of String type, but isn’t a very useful example.   In the real world, you need some way of calculating the Ship From location based on some data in the system.  In the below example, two “warehouse” Categories have been configured with Published not checked so that the Categories do not appear to the customer.  The Names of the categories have in them the Ship From tags as described above:

Warehouse 1:ZipCode=48126;Country=US;

Warehouse 2: ZipCode=11735;Country=US;

Then, Products have been assigned to the Categories.

Here’s what the Shipping Director records look like – we use Reference types to reference the product’s categories that have “ZipCode” in the name.  The ‘sender’ reference will evaluate using a condition (the ternary  “ ? : “ operator) - If a product is not in a “warehouse” category, then the expression evaluates to “Main”, and since “Main” does not have the tags in it, the plugin’s own configured ship from information will be used.  - If a product is in a “warehouse” category, then the expression evaluates to the Name of the Category which has the Ship From tags in it.


Order

Type

Name

Expression

Rate Expression

Name Expression

100

Reference

warehouseCategories

ProductVariant.Product.ProductCategories .FirstOrDefault(Category.Name.Contains("ZipCode="))

 

 

110

Reference

sender

[@warehouseCategories] = null ? "Main" : [@warehouseCategories].Category.Name

 

 

120

Packing

Pack By Warehouse

true

Packing.FirstFitSingleBox

[@sender]

130

OptionExit

FedEx

true

Shipping.Fedex

 

Final Note: Not all of the external shipping rate methods built into nopCommerce allow for dynamically changing the Ship From address; some shipping plugins only use the fields specified on their configuration screens.  The only shipping plugins that currently support overriding the shipping location are UPS, USPS, and the modified FedEx available on this site.  [Update 2012-Sept: nopC 2.50 Fedex added this capability]

Tags :  WarehousePacking
Comments (1)
Shipping Director 1.02 can Exclude Items from Packing- Tuesday, January 31, 2012

(This is an old blog.  If using nopCommerce 3.x or greater, note that "ProductVariant." should be removed if you copy these expressions)

You can exclude items from packing - the Packing option now has a "Exclude Item Expression" (shows in Description Expression column).  It should evaluate as a boolean (true, false).  Items that are not packed do not contribute to the weight/dimensions of a package, therefore you can create complex free shipping scenarios like "Free shipping for product x if quantity n or more".   Note that Packing expressions are always with respect to the item as it's being packed (unlike other record types where expressions relate to the entire cart - e.g. Items).  So, if you need to count the quantity of something in the cart to determine if exclusion should apply, then you need to do it with a variable before you pack.  Then, use that variable in the Exclude Item Expression with any other item specific expression.  For example, below, we sum the quantity of a particular item and if greater than 10, the "Exclude From Packing" variable is true.  Then in packing expression, we use the variable to check if exclusion should be considered, and then check the item condition.

Note also, that we initially check for Free Shipping - no point in checking expressions, packing, etc., if all items in cart are free shipping.  (An alternate, and better although a little slower, way to check free shipping for the entire cart is to use the $IsFreeShipping variable; this uses the nopC core OrderTotalCalcService.IsFreeShipping to check all the possible cart ships free possibilities including customer roles).  Also, we check variable $PackageCount after we pack - [$PackageCount is set by the system with the # of packages that result from packing - if nothing was packed (everything was excluded), then the entire cart ships free.

Order

Type

Name

Expression

Rate Expression

Surcharge Expression

Name Expression

Description Expression

10

OptionExit

Free Shipping

Items.All(ProductVariant.IsFreeShipping)

0

 

 

 

100

Reference

productName

ProductVariant.Product.Name

 

 

 

 

110

Boolean

Exclude From Packing

Items.Where([@productName] = "my product name").Sum(Quantity) > 10

 

 

 

 

120

Packing

First Fit

true

Packing.FirstFitSingleBox

 

 

[Exclude From Packing] and [@productName] = "my product name"

130

OptionExit

Free Shipping

[$PackageCount] = 0

0

 

 

 

Tags :  Packing
Comments (0)
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 does Packing!- Friday, December 30, 2011

The packing method built in to Shipping Director is FirstFitSingleBox - Packing is based on "First Fit" using a Single Box Size.  Products fit into first avail box that will take the volume and weight of products.  If no existing box will fit the product, then a new box is started.  It does check that the product will fit in the box's dimensions, but otherwise fit is based on volume of product vs. volume remaining in box, or weight of product vs weight remaining in the box.  (If the product item's dimensions don't fit the box's dimensions, then a new box is created with the product's dimensions, and is considered "full" - no other items will go in that box.)

Here is a sample setup for Shipping Director to do packing.

Order

Type

Name

Expression

Rate Expression

0

Boolean

$Debug

true

 

10

Decimal

$PackageBoxMaxWeight

20

 

20

Decimal

$PackageBoxHeight

15

 

30

Decimal

$PackageBoxWidth

15

 

40

Decimal

$PackageBoxLength

19

 

50

Decimal

$PackageBoxWeight

0.5

 

60

Decimal

$PackageItemAddWeight

0

 

70

Decimal

$PackageItemAddDimension

0

 

80

Decimal

$PackageShrinkPercent

0

 

90

String

$ShippingRateRequest

"OneRequestPerSender"

 

100

Packing

FirstFitSingleBox

true

Packing.FirstFitSingleBox

200

OptionExit

FedEx

true

Shipping.Fedex

All should be marked Active, and be sure to spell exactly as above including case, and quote or leading $ if any.  The items with 0 in Expression can be left out if you like - their defaults are 0 anyway, but shown above so you know what all the special variable names (packing parameters) are.   When adding the Packing-type record the Add Form will say "Packing Method" rather than Rate.  (It always says Rate in the grid).

I think most special $ prefix variable names should be obvious, but here's a brief description of each:

Name

Expression

$Debug

Turns on debugging.  Debugging messages appears in the System Log.   Because log messages are not HTML formatted, they can be hard to read in the browser.  So, on a System Log record, click View to see the log detail page.  Then,  Right click the page and "View Source".  Scroll down (a bit more than half way) until you see the plain text messages.

$PackageBoxMaxWeight

Maximum Weight that the package will hold.  If a product item does not fit in an existing box, then a new box is started.

$PackageBoxHeight

Height dimension of the box.

$PackageBoxWidth

Width dimension of the box.

$PackageBoxLength

Length dimension of the box.

$PackageBoxWeight

The weight of the box itself (empty).  This is added to weight of contents for the total weight sent to FedEx.

$PackageItemAddWeight

The weight of any packing material, per item.

$PackageItemAddDimension

The dimension of packing material.  This is added to each of the product item's dimension (H,W,L).

$PackageShrinkPercent

After packing, "Shrinking" adjusts the dimensions of the package if the package is not at least n% full by volume.   The cubed root of the used volume is used as the new dimensions (HxWxL).   This allows for a "smaller" package when package is not full.  $PackageShrinkPercent should be a number from 0 to 100 (it's a %).  If 0 (not present), then no shrinking takes place.

$ShippingRateRequest

This tells the Shipping Director how to call other shipping plugins when retrieving rate options:
 "OneRequestForAllPackages"
 "OneRequestPerSender"
 "OneRequestPerPackage"
If not specified, then "OneRequestPerSender" is the default if there is a SenderExpression, and "OneRequestForAllPackages" is the default otherwise.

If box dimensions are not specified by above variables, then all items are packed in one box.

Update:

The $PackageBox variable is a shorthand for setting many package attributes in one line.
 e.g. $PackageBox   "MaxWeight:40,Height:15,Width:15,Length:15"
 Here's how each shorthand attribute corresponds to the built in variable:
    MaxWeight    => $PackageBoxMaxWeight
    Height       => $PackageBoxHeight
    Width        => $PackageBoxWidth
    Length       => $PackageBoxLength
    Weight       => $PackageBoxWeight
    AddWeight    => $PackageItemAddWeight
    AddDimension => $PackageItemAddDimension
    ShrinkPercent=> $PackageShrinkPercent

The /APPENDPACKAGES Switch (Update 10/6/2018)

If a Packing rule is called multiple times, then each time it is called the set of packages are cleared and new packages are generated.  To override that behavior and instead append addiitonal packages to the current set of packages, then use the /AppendPackages option following the packing method name:

   Packing.FirstFitSingleBox /APPENDPACKAGES

Typically, you you append packages, you would also use the Packing method "Packing.ClearPackages" and/or use the Exclude Expression.  Otherwise, you would double-pack the same items and that would increase the shipping rates that are caclulated by weight/dimensions.  An example scenario for the AppendPackages would be to use a different $PackageBoxWeight for different types of items; be sure to use the Exclude Expression on each packing rule.

Tags :  Packing
Comments (1)