chameleon-system-private/shop-multi-warehouse-bundle

Adds multi warehouse handling to chameleon. Products can be supplied by different warehouses with different delivery times and permitted target countries.

8.47.1 2025-12-15 14:05 UTC

README

Todo

  • replace all \ChameleonSystem\ShopBundle\ProductInventory\Interfaces\ProductInventoryServiceInterface::[addStock/setStock] calls with \ChameleonSystem\ShopMultiWarehouseBundle\ProductStock\ProductStockWriterInterface
    • The methods that now update the stock do not have warehouse support. If we can somehow add this in a non-breaking manner, we would be all set.

How this bundle works

The bundle replaces the warehouse agnostic stock management by one, that is warehouse aware. That means,

  • Orders will include information about which quantities of a product will be supplied from which warehouse and with which delivery time.
  • Stock updates will removed/re-added to the correct warehouse when a product is ordered ot canceled.
  • shop_article_stock will be used to store the available quantity for a product.

Limitations

  • Changing the quantity or product of an order item that is using more than one warehouse will not update the warehouse quantity

Installing the bundle

  • The service that is usually used to add/change/remove stock for a product will be disabled by the bundle, since it does not take into consideration which warehouse to use. Please search for all usages of the \ChameleonSystem\ShopBundle\ProductInventory\Interfaces\ProductInventoryServiceInterface::addStock and \ChameleonSystem\ShopBundle\ProductInventory\Interfaces\ProductInventoryServiceInterface::setStock method in your code, and replace them by the new Warehouse Stock Service (\ChameleonSystem\ShopMultiWarehouseBundle\ProductStock\ProductStockWriterInterface)
  • Since an item may now have multiple entries in the stock table, you need to make sure that this table is not joined into the backend product list - otherwise products may appear multiple times. Alternative - you may add a distinct.
  • Bundle will overwrite \TShopStockMessage::GetShopStockMessage without calling the parent method. This should not been an issue, as we hook in right after TShopStockMessage. If you do have any code with side affects in GetShopStockMessage, make sure it is called after \ChameleonSystem\ShopMultiWarehouseBundle\Bridge\Shop\TableObjectShopStockMessage::GetShopStockMessage

Backend Changes

  • There is a new menu option "Warehouse". Here you need to create your warehouses. The installation will create one warehouse.
  • In your shop configuration, you now need to define a default warehouse. The installation will assign the warehouse it created.
  • In each stock message, you need to define the warehouse priority (in which order will warehouses be processed)
  • In each stock trigger, you need to define which warehouse the trigger applies to.
  • Warehouses can be restricted to ship only to some countries.

Configure TargetAddress Provider

  • Provider needs to implement \ChameleonSystem\ShopMultiWarehouseBundle\TargetAddress\TargetAddressProviderInterface
  • Tag the service with chameleon_system_shop_multi_warehouse.target_address_provider
  • Assign a position in the tag using the attribute position (services with lower position are processed first).

Example

  <service id="ChameleonSystem\ShopMultiWarehouseBundle\TargetAddress\TargetAddressProviderCurrentUser">
      <tag name="chameleon_system_shop_multi_warehouse.target_address_provider" position="100" />
  </service>

Process the list of permitted warehouses

You can filter/sort the warehouse stock list for a product that will be considered for a request by adding processors.

  • Provider needs to implement \ChameleonSystem\ShopMultiWarehouseBundle\StockAccess\ProductWarehouseStockProcessorInterface
  • Tag the service with chameleon_system_shop_multi_warehouse.product_warehouse_stock_processor
  • Assign a position in the tag using the attribute position (services with lower position are processed first).

Example

  <service id="ChameleonSystem\ShopMultiWarehouseBundle\StockAccess\ProductWarehouseStockProcessorSortByWarehousePriority">
      <tag name="chameleon_system_shop_multi_warehouse.product_warehouse_stock_processor" position="10"/>
  </service>