Packing algorithms to put your basket/order products inside boxes.
You can create packages from an order or even a basket:
# add some constraints
constraint1 = SimplePackageDimensionConstraint(340, 230, 100, 1000)
constraint2 = WeightPackageConstraint(12000)
packager = SimplePackager()
packager.add_constraint(constraint1)
packager.add_constraint(constraint2)
packages = packager.pack_order(order)
# or
packages = packager.pack_basket(request.basket)
# do something with the packages
print(packages[0].width)
print(packages[0].height)
print(packages[0].length)
print(packages[0].weight)
print(packages[0].volume)
print(packages[0].count)
print(packages[0]._products)
packages
is a list of AbstractPackage
which you can check its width, length, height, weight and which products is inside.
You can also create a custom Package and Constraint objects to fit you needs.
Our built-in SimplePackage just stack products inside, this way the final package size will be a kind of bounding-box of all products, taking into account constraints to limit the size/weight of the package.
- Shuup v0.5.0
- Tested on Python 3.4 and 3.5
Copyright (C) 2016 by Rockho Team
Shuup Shipping Table is published under the GNU Affero General Public License, version 3 (AGPLv3) (see the LICENSE file).