Jaa


Inventory Pipeline Components

For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.

Commerce Server integrates the Inventory System into the ordering process through two pipeline components: CheckInventory and UpdateInventory. These components provide the current inventory state for products in the Inventory System and run-time depletions of on-hand quantities in response to purchases made by customers. This section describes these components.

CheckInventory

The CheckInventory pipeline component is part of the Basket pipeline. It checks the inventory status for items in the customer's basket. You must run the QueryCatalogInfo component before using the CheckInventory component. The following table lists and defines the keys that the CheckInventory component reads from the order form.

Key

Definition

product_catalog

The name of the product catalog. This weakly typed key is mapped to the strongly typed ProductCatalog property of a LineItem object.

product_id

The product ID. This weakly typed key is mapped to the strongly typed ProductId property of a LineItem object.

product_variant_id

The variant ID. This weakly typed key is mapped to the strongly typed ProductVariantId property of a LineItem object.

quantity

The quantity requested on the order form. This weakly typed key is mapped to the strongly typed Quantity property of a LineItem object.

CommerceResources

The CommerceResourceCollection object that contains all of the resources for the site.

MessageManager.pur_out_of_stock

The error message text.

The CheckInventory component checks the inventory and writes key values to the order form. The following table lists and defines these key values.

Key

Definition

_inventory_condition

A value that specifies the current condition of the specified product or variant in the inventory. The values can be BackOrdered, InStock, OutofStock, or PreOrdered.

This weakly typed key is mapped to the strongly typed InventoryCondition property of a LineItem object.

_inventory_in_stock_for_request

The available in-stock quantity to satisfy the request. This weakly typed key is mapped to the strongly typed InStockQuantity property of a LineItem object.

_inventory_back_order_for_request

The available back-order quantity to satisfy the request. This weakly typed key is mapped to the strongly typed BackorderQuantity property of a LineItem object.

_inventory_pre_order_for_request

The available preorder quantity to satisfy the request. This weakly typed key is mapped to the strongly typed PreorderQuantity property of a LineItem object.

_Basket_Errors

Error messages are written to the SimpleList object.

Each line item in the order form receives one of these values.

If an item is out of stock, the CheckInventory component writes a warning to the basket errors collection and returns a warning.

UpdateInventory

The UpdateInventory component is part of the Checkout pipeline. This component checks the inventory status for an array of stock-keeping units (SKUs) and updates the SKU quantities in the Inventory System. If the component cannot update an item because of a database error or an out-of-stock error, the basket process stops, the transaction rolls back, the UpdateInventory component writes an error to the purchase errors collection, and returns an error.

The following table lists and defines the values that the UpdateInventory component reads from the order form.

Key

Definition

product_catalog

The name of the product catalog. This weakly typed key is mapped to the strongly typed ProductCatalog property of a LineItem object.

product_id

The product ID. This weakly typed key is mapped to the strongly typed ProductId property of a LineItem object.

product_variant_id

The variant ID. This weakly typed key is mapped to the strongly typed ProductVariantId property of a LineItem object.

quantity

The quantity requested. This weakly typed key is mapped to the strongly typed Quantity property of a LineItem object.

_inventory_allow_backorder_and_preorder

If true, the requested quantity can be back-ordered and preordered if the in-stock quantity cannot meet the request completely. If this value is false and the in-stock quantity cannot meet the request, the UpdateInventory component considers the SKU to be out-of-stock and it writes an error to the purchase errors collection. The default is true.

This weakly typed key is mapped to the strongly typed AllowBackordersAndPreorders property of a LineItem object.

CommerceResources

The CommerceResourceCollection object that contains all of the resources for the site.

MessageManager.pur_out_of_stock

The error message text (optional).

The UpdateInventory component writes key values to the order form. The following table lists and defines these key values.

Key

Definition

_inventory_condition

A value that specifies the current condition of the specified product or variant in the inventory. The values can be BackOrdered, InStock, OutofStock, or PreOrdered.

This weakly typed key is mapped to the strongly typed InventoryCondition property of a LineItem object.

_inventory_in_stock_for_request

The available in-stock quantity to satisfy the request. This weakly typed key is mapped to the strongly typed InStockQuantity property of a LineItem object.

_inventory_back_order_for_request

The available back-ordered quantity to satisfy the request. This weakly typed key is mapped to the strongly typed BackorderQuantity property of a LineItem object.

_inventory_pre_order_for_request

The available preorder quantity to satisfy the request. This weakly typed key is mapped to the strongly typed PreorderQuantity property of a LineItem object.

_Purchase_errors

Error messages written to the SimpleList object.

The UpdateInventory component writes these values for each line item in the order form unless an out-of-stock condition occurs. If there are multiple line items and one is out of stock, the other items are not processed. If an out-of-stock condition occurs, the UpdateInventory component writes an error to the purchase errors collection and the return value is a warning.

This component updates the inventory values.

Inventory Computations

The quantity a customer requests may be available in full or in part, and can be fulfilled through back-ordering (if back-ordering is allowed) or preordering (if preordering is allowed).

If an item is both preorderable and back-orderable, Commerce Server uses the Pre-Order limit first, and then uses the Back-Order limit. If the _inventory_pre_order_for_request value can fulfill the request, the _inventory_back_order_for_request key is zero.

The preorder and back-order quantities are not stored. The pipeline component evaluates these quantities with each request. If the Preorder Quantity and the OnHand Quantity are less than zero, the Preorder Quantity is equal to the lesser of the OnHand Quantity or the Preorder Limit.

To determine whether it can fill a request, the pipeline component compares the requested amount with the OnHand Quantity minus the Stock-out Threshold. If the request is smaller, the component can fill request without back-ordering. The component writes the following values to the order form:

  • _inventory_in_stock_for_request = request

  • _inventory_pre_order_for_request = 0

  • _inventory_back_order_for_request = 0

  • _inventory_condition = InStock

If the requested amount is greater than or equal to the OnHand Quantity minus the Effective Stock-out Threshold, the request requires a back-order. To determine the back-order amount, the following computation occurs:

In_Stock_For_Request = max((OnHand Quantity – Effective Stock-out Threshold), 0); 
// If the OnHand Quantity is more than the Effective Stock-out
// threshold, the _inventory_in_stock_for_request is a positive number.
// Otherwise it is 0.
// Determine _inventory_pre_Order_For_Request.
if (Pre-Orderable) and (Stock Handling ==1) and (Pre-Ordered Quantity < Pre-Order Limit)
{
    Pre-Order_For_Request = Max (0, Min((Request- In_Stock_For_Request),  (OnHand Quantity –Pre-Order Limit)))
}
Else Pre-Order_For_Request = 0
Pre-Ordered_Quantity = Pre-Ordered_Quantity + Pre-Order_For_Request
If (Pre-Order_For_Request +In_Stock_For_Request ==Request) 
   Inventory_Condition = Pre-Ordered
// Now determine Back_Order_For_Request.
If (Back-Orderable) And (Stock Handling ==1) and (OnHand Quantity > Back-Order Limit +Pre-Order Limit*Pre-Orderable)
{
    // The Pre-order limit is used first if the SKU is preorderable.
    // Otherwise it is not considered.
    Back-Order_For_Request = Max (0, Min ((Request-   In_Stock_For_Request- Pre-Order_For_Request), (OnHand Quantity – Pre-Order Limit*Pre –Orderable - Back-Order Limit))) 
    If Pre-Order_For_Request+ Back-Order_For_Request+ In_Stock_For_Request ==Request
        Inventory_Condition = Back-Ordered
}
Else
{
    Back-Order_For_Request= 0
    Inventory_Condition = Out-Of-Stock
}

Example for the CheckInventory Component

The following table illustrates how the CheckInventory component computes the inventory values. For all items, Floor_Is_Stock-Out_Threshold is true, Back-Order Limit is -50, and Pre-Order Limit is -50.

Pre-Orderable

Back-Orderable

Request

OnHand Quantity

InStockQuantity

PreorderQuantity

BackorderQuantity

InventoryCondition

0

1

3

4

3

0

0

1 (InStock)

0

1

8

4

3

0

5

2 (BackOrdered)

0

1

60

4

3

0

51

0 (Out of Stock — Unable to fill completely)

0

1

60

1

0

0

51

0 (Out of Stock — Unable to fill completely)

0

1

60

0

0

0

50

0 (Out of Stock — Unable to fill completely)

1

0

3

4

3

0

0

1 (InStock)

1

0

8

4

3

5

0

2 (BackOrdered)

1

0

60

4

3

51

0

0 (Out of Stock — Unable to fill completely)

1

0

60

1

0

51

0

0 (Out of Stock — Unable to fill completely)

1

0

60

0

0

50

0

0 (Out of Stock — Unable to fill completely)

1

1

50

4

3

47

0

3 (Pre-Ordered)

1

1

60

4

3

51

6

2 (Back-Ordered)

1

1

104

4

3

51

50

0 (Out of Stock)

1

1

105

4

3

51

50

0 (Out of Stock — Unable to fill completely)

Example for the UpdateInventory Component

The following table illustrates how the UpdateInventory component computes the inventory values. For all items, Floor_Is_Stock-Out_Threshold is true, Back-Order Limit is -50, and Pre-Order Limit is -50.

Pre-Orderable

Back-Orderable

Request

OnHand Quantity

InStockQuantity

PreorderQuantity

BackorderQuantity

InventoryCondition

Decrement OnHand Quantity by

0

1

3

4

3

0

0

1 (InStock)

3

0

1

8

4

3

0

5

2 (BackOrdered)

8

0

1

60

4

3

0

51

0 (Out of Stock — Unable to fill completely)

0

0

1

60

1

0

0

51

0 (Out of Stock — Unable to fill completely)

51

0

1

60

0

0

0

50

0 (Out of Stock — Unable to fill completely)

0

1

0

3

4

3

0

0

1 (InStock)

3

1

0

8

4

3

5

0

2 (BackOrdered)

8

1

0

60

4

3

51

0

0 (Out of Stock — Unable to fill completely)

0

1

0

60

1

0

51

0

0 (Out of Stock — Unable to fill completely)

51

1

0

60

0

0

50

0

0 (Out of Stock — Unable to fill completely)

0

See Also

Other Resources

Managing Inventory Catalogs