Shipping Director - Packing: Requires Own Box and Sender

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
Leave your comment
:
sample@email.tst
Created on: 6/26/2023 5:32 PM
1