Advanced Inventory Module
Buy
Now at MvCool!
Summary
The NetPush Advanced Inventory Module allows Miva Merchant store owners to track inventory within Miva Merchant all the way down to the attribute/option level. The module has numerous configuration settings that should allow the admin to display and track any simple or complex inventory configuration. Inventory levels are only adjusted at checkout time so there is no need to worry about old baskets causing inventory problems. The module comes with an import and export module that allows administrators to easily update inventory levels by using csv files.
We suggest using template modules like Viking Coder's Product Templates and Category Templates if you want better control of the look and feel of your pages with regards to inventory. This will allow you to use tokens for display. Otherwise, you will have to settle for built in hook point displays that are built into the module and are configurable through the administration area.
The Advanced Inventory Module will send email when stock goes below certain
configurable low stock level and can disable products when stock goes below
the out of stock level. Administrators can also customize every message shown
to the user. Fine grain customizations are made easy because the module allows
product level configuration settings the ability to override global inventory
configuration settings. This allows Miva Merchant Administrators the ability
to customize inventory configurations for every product, if he or she wishes.
Notes:
- OpenUI Tokens
This module can be used with OUI OpenTokens. To use the module with Viking Coders template modules, see the OpenToken instructions and examples at the bottom of the page. Currently, you will need to use a category screen template module and tokens to show product level inventory on category page product lists.
- Product Upsell
This module does not show stock information on the product upsell screens at this time. Stock is still tracked in the basket and checkout, but no current stock level is shown on the upsell screens during checkout unless you are using alternatives like tokens in templates.
- Basket Redirect and Error Message
The user is automatically redirected to the basket screen if he or she adds items to the basket that makes the product go out of stock or if the product is already out of stock. The error message is shown above the basket screen using a hook point in the Open UI. The message is configurable in the admin area.
- Checkout Screen Error
If configuration is setup to do so, the module will block a user from checking out if their basket has an item that is out of stock. This message is shown automatically at the top of the screen. The message is configurable in the admin area.
- Pipes ( | )
Product codes, attribute codes, and option codes must not contain the pipe character. NetPush Advanced Inventory uses the pipe to delimit for lookups. Pipes in your codes will cause the module not to work correctly.
Requirements:
- Open UI 4.723+
This module requires that you have OpenUI installed in your store. The module uses hook points in the OpenUI. You must have OpenUI version 4.723 or higher if you plan to use the OpenToken functionality available in this module. Please see the OpenUI site for information about latest versions and bug fixes.
- Miva Empressa 3.96+
This module requires that you have Miva Empressa 3.96 or higher. The module uses functionality that is only available in newer versions of the Empressa Engine. Miva regularly releases new versions of Miva Empressa and the Virtual Machine to add new functionality and fix bugs. If you are on an older version, consider contacting your hosting company. You can find the Miva Empressa version at the top left hand of your Store Administrator when you first login. It should show your Miva Merchant version and your Miva Empressa version.
- Miva Merchant 2.x, 3.x, and 4.x
This module should work with most versions of Miva Merchant. In order to use the deactivate product option, you must be on version 3.0+. All testing and development was done on versions 4.13+.
Installation Instructions
The Advanced Inventory Modules comes with the main inventory module, an import
module, and an export module.
Installing the NP_Inventory modules:
1. Save and extract the ZIP file that contains the ReadMe and Modules.
2. Run the Miva administration program (admin).
3. Click on the arrow next to Modules.
4. Click on "Add Modules"
5. Click on the "Upload" graphic button.
6. Enter (or browse for) the filename of the module on your system.
7. Click on the "Upload" button
8. Click on the "Add" button.
Do this for the NP_Inventory, NP_InventoryImp, and NP_InventoryExp
[The modules will now be installed on your site.]
Installing the NP_Inventory module in your Store:
1. Run the Miva administration program (admin).
2. Click on the arrow next to Stores.
3. Click on the arrow next to "Your Store Name".
4. Click on "System Extension Configuration".
5. Check the box next to NetPush Inventory.
6. Click on "Update".
[The module will now be installed in your store.]
Configuring the NP_Inventory module in your Store:
1. Click on the name of the module (NetPush Advanced Inventory).
2. Configure as needed.
3. Click on "Update".
[The module will now be active in your store.]
Global Configuration Screen
All inventory settings will use the global configuration settings found in the Miva Merchant Administration area under Stores > Your Store > System Extension Configuration > NetPush Advanced Inventory. One may override these settings for products (see product level settings below). Each product must also be manually turned on before tracking starts. See product settings below.
Configuration Settings
- Use NetPush Inventory
You must set this to "Yes" if you want the module to be turned on. If this is set to "No", the module will not do anything.
- Amount considered out of stock
Usually this would be 0, but it can be set to any number, including negative numbers. Once the stock level reaches this number, it will be considered out of stock.
- Deactivate when product level is out of stock
In Miva Merchant versions that support it, the module will turn the Active flag for a product to off, if the product reaches the out of stock level. This only works on the product level, not for the attribute/option level.
- Allow purchase even after out of stock
Turning this on will allow customers to purchase products even after they go below the out of stock level. This could be a backorder situation.
- Automatically remove from basket
When a user adds products to the basket, the products will be removed if it makes the inventory go below the out of stock level and the admin is not allowing purchases when products are out of stock. Please take note that this option could cause problems if other modules are installed that also act on the basket.
- Send Low Inventory Notices
Turn this on to receive email warnings when inventory goes below the low inventory level.
- Amount considered low
The level that is considered low. Use this setting to trigger emails that will warn you when inventory is hitting a low level.
- Low Email To Address
Set this to the email address of the person who should be receiving emails when stock is at a low level.
- Low Email From Address
Set this to the email address that should be set as the from address in low stock emails.
- Low Email Subject
The subject of the low stock email. This field has token replacement.*
- Low Email Body
This is the body of the low stock email. This field has token replacement.*
- Automatically change stock levels
Turn this on if you want the system to subtract stock when a user purchases. If this is set to "No", the system will not update stock levels.
- Show out of stock messages
Turn this on to show out of stock messages on the product page when stock goes below the out of stock level.
- Show in stock messages
Turn this on to show how much stock is left on the product page.
Out of Stock Messages*
- Product Level
This message is shown to the user on the product page below the shipping weight.
- Attribute Level - Checkbox
This message is shown to the user on the product page next to a checkbox option.
- Attribute Level - Radio Buttons
This message is shown to the user on the product page next to each radio button option.
- Attribute Level - Select Box
This message is shown inside of the drop down on a select box. HTML should not be used here.
In Stock Messages*
- Product Level
This message is shown to the user on the product page below the shipping weight.
- Attribute Level - Checkbox
This message is shown to the user on the product page next to a checkbox option.
- Attribute Level - Radio Buttons
This message is shown to the user on the product page next to each radio button option.
- Attribute Level - Select Box
This message is shown inside of the drop down on a select box. HTML should not be used here.
Other Messages*
- Out of Stock - Basket Line Marker
This helps the user to see which products have gone out of stock when looking at the basket. A red asterisks may be a good indicator for the user.
- Out of Stock - Basket
This message is shown to the user above the basket when a product has gone out of stock when adding, updating, or looking at the basket. Products can go out of stock at anytime, even after a user adds it to their basket. This is because stock levels only change after checkout.
- Out of Stock - Checkout
This message is similar to the out of stock basket message. It is shown on the payment screen during checkout. This should be considered one final inventory check before allowing the user to purchase.
* Token Replacement
This module has a few built in tokens for messages that allow you to give yourself and the user more detailed information. Some of the tokens below can only be used on certain screens, or in emails.
%%stock%% - Displays the current stock level. (1,2,3)
%%basket_quantity%% - Displays the amount in the basket and is unlikely to be used. (1,2)
%%available%% - Displays the amount of stock left before hitting the out of stock level. (1,2,3)
%%oos_level%% - Displays the out of stock level. (1,2,3)
%%line_items%% - Displays a list of line items that are effected. (1,2)
%%product_id%% - Displays the product id. (1,2,3)
'%%product_code%% - Displays the product code. (1,2,3)
%%product_name%% - Displays the product name if available. (3)
%%attribute_code%% - Displays the attribute code, or None if the effected product is only being tracked at the product level. (1,2)
%%option_code%% - Displays the option code, or None if the affected product is only being tracked at the product level. (1,2)
1. Is used for the low stock email body and subject
2. Is used for the out of stock basket message and out of stock checkout message
3. Is used for the in stock and out of stock messages on the product pages.
Product Configuration Screen
All inventory settings will use the global configuration settings found in the Miva Merchant Administration area under Stores > Your Store > System Extension Configuration > NetPush Advanced Inventory. To override these settings at the product level, go to the product in the administration area and click on "NetPush Advanced Inventory". You will see the settings below.
Configuration Settings
- Use NP Inventory on this Product
You must set this to "Yes" if you want to track inventory on the product. You must manually set this to "Yes" for every product that you want to track. If this is not set to "Yes", no inventory tracking will take place. By default, no product is tracked.
- Override Global Settings
If this is set to "Yes" the configurations settings will be taken from the individual product screen instead of from the Global configuration settings found under under system extension configuration. If set to "No", the module will use the global settings from above when doing inventory for the product. The default is to use the global settings.
- Amount considered out of stock
Overrides same setting under Global Configuration.
- Deactivate when product level is out of stock
Overrides same setting under Global Configuration.
- Allow purchase even after out of stock
Overrides same setting under Global Configuration.
- Automatically remove from basket
Overrides same setting under Global Configuration.
- Send Low Inventory Notices
Overrides same setting under Global Configuration.
- Amount considered low
Overrides same setting under Global Configuration.
- Low Email To Address
Overrides same setting under Global Configuration.
- Low Email From Address
Overrides same setting under Global Configuration.
- Low Email Subject
Overrides same setting under Global Configuration.
- Low Email Body
Overrides same setting under Global Configuration.
- Automatically change stock levels
Overrides same setting under Global Configuration.
- Show out of stock messages
Overrides same setting under Global Configuration.
- Show in stock messages
Overrides same setting under Global Configuration.
Out of Stock Messages*
- Product Level
Overrides same setting under Global Configuration.
- Attribute Level - Checkbox
Overrides same setting under Global Configuration.
- Attribute Level - Radio Buttons
Overrides same setting under Global Configuration.
- Attribute Level - Select Box
Overrides same setting under Global Configuration.
In Stock Messages*
- Product Level
Overrides same setting under Global Configuration.
- Attribute Level - Checkbox
Overrides same setting under Global Configuration.
- Attribute Level - Radio Buttons
Overrides same setting under Global Configuration.
- Attribute Level - Select Box
Overrides same setting under Global Configuration.
Other Messages*
- Out of Stock - Basket Line Marker
Overrides same setting under Global Configuration.
- Out of Stock - Basket
Overrides same setting under Global Configuration.
- Out of Stock - Checkout
Overrides same setting under Global Configuration.
Setting Product Inventory Levels
The administrator can set product inventory levels by going to the product
page within the Miva Merchant admin area and clicking on NetPush Advanced
Inventory. This is the same screen as the product level configuration. Product
inventory levels are shown below the configuration area. To add new inventory,
use the yellow add button. To edit inventory, click white add button next
to the inventory entry.
The module checks inventory by looking at a unique combination of Product
Code, Attribute Code, and Option Code. When entering stock levels, you enter
the codes separated by a pipe. For example, shirt1|color|red, where
shirt1 is the product code, color is the attribute code,
and red is the option code. If you do not set an inventory level
for an existing product attribute combination, no tracking is done. Setting
a stock level of -9999 has the same effect.
Inventory at a product level
You may choose to only track inventory at a product level in combination with or not at an attribute level. To enter a stock level for a product, simply use prodcode||. This tells the system that you are tracking the product code, but not the attributes or options by leaving them blank. Using -9999 for a stock level will temporarily turn inventory tracking off.Inventory at the attribute level (checkbox, select box, radio buttons)
Checkbox - prodcode|attrcode| (the last field should be left blank, as checkboxes have no options)
Select Box and Radio Buttons - prodcode|attrcode|optcode All 3 are required and must be unique, even if you are using attribute templates. If you are using normal templates in combination with attribute templates, make sure you do not give them duplicate code names.
Using Advanced Inventory with Template Modules and OpenTokens
The Advanced Inventory Module can be used with 3rd party template
modules like the ones from Viking Coders by using Open UI tokens on product
pages to display current inventory levels. Please note that token support
has not been completely tested as of yet.
%module|npinventory|stock_level%
Returns the stock level for the product, attribute, option combination. To ensure that this works correctly, you should set g.NPI_Product_Code, g.NPI_Attribute_Code, and g.NPI_Option_Code to the current product code, attribute code, and option code. On a checkbox, make sure to set g.NPI_Option_Code = ''. On a product level, make sure to set the attribute and option variables to ''. After these globals are set, call the token. If the return value is -9999, the item is not being tracked.
%module|npinventory|stock_available%
Same as above but shows the amount available.
%module|npinventory|oos_level%
Same as above but shows the out of stock level.%module|npinventory|stock_list%
This token will set a global variable that contains an array of structures. You must set g.NPI_Product_Code equal to the current product code before calling the token. This array contains all of the product code, attribute code, and option code combinations for a specific product. It also contains the available stock, out of stock level, and other information shown below. This token makes it easy to create a stock table using OpenUI tokens in Viking Coders templates or in a product header or footer. See Example 2 and 3 below.
Array Structure:
g.NP_Inventory_StockList[i]:attribute_code - Attribute Code
g.NP_Inventory_StockList[i]:option_code - Option Code
g.NP_Inventory_StockList[i]:stock_level - Stock Level
g.NP_Inventory_StockList[i]:oos_level - Out of stock level
g.NP_Inventory_StockList[i]:available - Stock Level minus out of stock level
g.NP_Inventory_StockList[i]:allow_pur - Allow purchases even if out of stock from admin settings
g.NP_Inventory_StockList[i]:low_amount - Low amount from admin settings
g.NP_Inventory_StockListLen - Variable that tells you how many items are in the array (represented by i above)
Example 1
This is an example of showing the stock amount available in a product header. Since you don't have access to a loop of attribute and options, you could only show the product level. Therefore, you set the global product code variable to the correct code, and the attribute and option global variable to blank. If the return value is -9999, this means that the item is not being tracked. If the return value is 0, the product does not have any stock available. Otherwise, the product has stock, and we show the amount.
This code should be used as a starting point for other pages, if using some sort of page templates like modules available from Viking Coders. You can show attribute/option level stock by changing the global variables during a loop of product information from within the template. You could change the globals on each loop, and then call the module each time.%OUI%
--- Example of tokens in the product header ---
<br>
%ASSIGN(g.NPI_Product_Code|%prodcode%)%
%ASSIGN(g.NPI_Attribute_Code|'')%
%ASSIGN(g.NPI_Option_Code|'')%
%ASSIGN(g.MyStockAmount|%module|npinventory|stock_available%)%
%IF((g.MyStockAmount EQ 'ERROR'))%
TESTING: Something did not work correctly
%ELSE%
%IF((g.MyStockAmount EQ 0))%
Product is out of stock
%IFEND%
%IF(g.MyStockAmount EQ -9999)%
TESTING: Stock is not being tracked on this product
%ELSE%
%IF(g.MyStockAmount)%
Quantity Available: %VAR(g.MyStockAmount)%
%IFEND%
%IFEND%
%IFEND%
<br>
--- End Example ---
<br>
Example 2
This is an example of showing a stock table on the product page when using Viking Coder's product template module. The stock table is a nice way to show the user stock levels at an attribute/option level. It is a good alternative to using the built in hook points to show stock levels next to radio buttons and inside drop down lists. You can do something similar in the header or footer of a normal product pages if you do not have a template module. You can use more complex token code if you need to call functions to grab the attribute name and option name instead of the codes. See the token documentation on the OpenUI site for more information.%ASSIGN(g.NPI_Product_Code|%prodcode%)%
%ASSIGN(g.trash|%module|npinventory|stock_list%)%
%IF(g.NP_Inventory_StockListLen)%
<table border=1 cellpadding=5 cellspacing=1>
<tr>
<td colspan="3"><b>Inventory Available for %prodname%</b></td>
</tr>
<tr>
<td>Attribute Code</td><td>Option Code</td><td>Stock Available</td>
</tr>
%SET(g.loop|1)%
%WHILE(g.loop LE g.NP_Inventory_StockListLen)%
%IF(g.NP_Inventory_StockList[%VAR(g.loop)%]:stock_level NE -9999)%
<tr>
<td>
%IF(g.NP_Inventory_StockList[%VAR(g.loop)%]:attribute_code)%
%VAR(g.NP_Inventory_StockList[%VAR(g.loop)%]:attribute_code)%
%ELSE%
ANY
%IFEND%
</td>
<td>
%IF(g.NP_Inventory_StockList[%VAR(g.loop)%]:option_code)%
%VAR(g.NP_Inventory_StockList[%VAR(g.loop)%]:option_code)%
%ELSE%
ANY
%IFEND%
</td>
<td>%VAR(g.NP_Inventory_StockList[%VAR(g.loop)%]:available)% </td>
</tr>
%IFEND%
%SET(g.loop|%EXPR(g.loop + 1)%)%
%WHILEEND%
</table>
%IFEND%
Inventory Available for Product A Attribute Code Option Code Stock Available Food Fries 0 Food Hamburger -2 Food Hotdog 6 Tour ANY 5 ANY ANY 12

