Restock Shelves
Copyright © 2001, William Weiland
Overview
The MIVA Corp inventory management system for Merchant 4.0 and newer has resulted in numerous stores having their shelves temporarily cleared. As customers place products in their baskets, the store inventory level is decremented. If the customer decides not to buy at that time and leaves the store, the products in that abandoned basket remain unavailable. When the store owner manually deletes expired baskets in admin, those basket contents are reclaimed and the products are placed back in the store inventory. Stores which have one-of-a-kind or low inventory levels of products are significantly impacted as the products are not available for purchase by other customers until the store is manually restocked. Stores which have high traffic are similarly impacted when many baskets are abandoned. This module eliminates the need for the store owner to manually restock. At a frequency determined by the store owner, this module will reclaim the expired baskets and restock the shelves.
Initial Setup
1) In admin, click Add Modules link (fig 2)
2) Click the file upload button
3) Browse to find the restock.mvc file on your hard drive and upload (fig 3)
4) Click Add to add it to the domain
5) Then in admin click on the plus to the left of Stores
6) Click the plus to the left of your store name
7) Click on the word Utilities under your store (fig 4)
8) Check the box next to Restock Shelves
9) Click Update
10) Click the plus to the left of Utilities under your store
11) Click the Delete Shopping Baskets link and then delete the expired baskets. This will clear any huge backlog which may have existed before you install this module. Follow this up with Pack Data Files to ensure you do not have pre-existing index corruption.
12) Click on the Logging Configuration link
13) Check the box to the left of Restock Shelves and select Update
14) FTP the bluebox.gif and whitebox.gif to the mm5/ directory on your server
15) Click on the word Utilities under your store, then click the Restock Shelves link to configure the module (fig 4)

Configuration Settings
Enter data into the applicable input fields.

Run restock every XXX minutes
The module uses this time (in minutes) to determine if it is time to restock. When a customer clicks on a product screen and this time has been reached, the restocking will execute. A slight delay may be noticed by the customer at the time this occurs. The timer will be reset. Hence, if you set the restock timer to 120 minutes, every two hours one customer may experience a slight delay displaying one product screen.

Optionally send email to
The module can send an email every time it runs the restock routine. If you leave this blank it will not send the email. If you fill in an email address, it will send to that address. Here's an example email from Merchant 4.14 and newer. Normally you would use this email to decide if you want to contact the customer and entice them back to your store. Beginning with Restock Shelves module version 5.013 you can have the module automatically send the customer an email. See these instructions on how to do that.


Customer Opt Out of Emails
You will need Emporium Plus Tool Kit version 5.270 or newer and Restock Shelves version 5.025 or newer in order to implement this feature. The Tool Kit maintains a registry of customers who have told you they only want order emails from you. First setup the Tool Kit functionality. See the functions "donotemail" and "donotemail_e" in the functions list.

Here is example code you can put in the Restock Shelves email to allow them to unsubscribe from emails.
If you want to be placed on the Do Not Email registry and only receive emails when you place an order or when there is a product recall, click the email address <a href="http://www.YOURDOMAIN.com/NOEMAIL.html?Action=add&email=%DoNotEmail_E%">%DoNotEmail%</a>

The Restock Shelves module version 5.025 or newer has code in it that will replace the tokens %DoNotEmail% and %DoNotEmail_E% with the 'to' address the email is being sent to. If the email recipient clicks the link they will land on the page NOEMAIL and pass the 'add' action and email address to the Tool Kit donotemail_e (or donotemail) function. With the Restock Shelves module four things need to happen to prevent someone from receiving those emails. a) You need to be using Tool Kit 5.270 or newer, b) You need to be using Restock Shelves 5.025 or newer, c) The tokens %DoNotEmail% and %DoNotEmail_E% must be in the RESTOCK_E email template, d) The customer would have to click the link to be placed on the Do Not Email registry.

This registry can be used for any module written to interface with it. So, as example, you might use the Follow-on Contact module to send emails to customers XX days after an order. If you have a version of the module that supports it, you can include the tokens %DoNotEmail% and %DoNotEmail_E% in the email template and it will know to check the registry before sending emails. If you do not include that token, the module will skip the registry check and send them emails even if they opted from the Restock Shelves emails. This may upset customers who've told you they only want order emails from you. So if you are going to offer a Do Not Email option, you probably should do it with all modules which send non-order emails.
Usage
When customers visit your store the timer will be checked to determine the last time expired baskets were deleted. If deletion is due, the next customer who clicks to a product screen will launch the shelf restocking routine.

As a clean up, periodically you should put the store in maintenance mode, then go to Admin > Store > Utilities > Delete Shopping Baskets, select All Shopping Baskets, then Delete. Then go to Admin > Utilities and Pack Data Files. Packing should be done weekly; more often if you have a busy store.
Frequently Asked Questions
Q: The module runs and sends me an email. It is only finding one abandoned basket each time. It does not seem to be deleting all the expired baskets.
A: You need to make sure your global timeout is set for 90 seconds (Miva's default) or more. If it is set for 60 or less, it will only delete one basket and then quit.

Still have a question?

Fig 1: Main admin screen

Fig 2: Add a new module

Fig 3: Upload the module to the server

Fig 4: Assigning a module to the store