LocalizingInventoryManager is an implementation of the InventoryManager interface that is used when you want to have more than one set of inventory data (and therefore more than one InventoryManager). LocalizingInventoryManager determines which data/manager set to use based on your customer’s locale.

LocalizingInventoryManager contains the following properties:

LocalizingInventoryManager implements all the InventoryManager methods twice:

The methods with the InventoryManager signatures call the second implementations, passing the value of the defaultLocaleKey property as the extra parameter.

The second methods retrieve the proper InventoryManager by calling the getInventoryManager method with the localeKey as the parameter. Then, they call the corresponding method in the InventoryManager that was retrieved.

LocalizingInventoryManager is compatible with the InventoryManager interface because you can pass it the same parameters and it will use the default InventoryManager to perform operations. You also can make your calls with the extra pLocaleKey parameter, and use LocalizingInventoryManager to handle multiple InventoryManager instances.

The getInventoryManager method takes the localeKey parameter and checks the inventoryManagers map for a corresponding InventoryManager. If it finds one, it is returned. Otherwise, it checks the useDefaultInventoryManager property. If true, it returns the DefaultInventoryManager. If false, an error is thrown.

loading table of contents...