Skip to main content
With “BackInStockMail”, a buyer leaves their contact details for a product that is currently not available. If the availability status improves, the shop automatically sends a personalized email with a deep link directly to the product. If the product has dependent variants, the link leads directly to the desired variant. Backinstockmail
The feature was formerly called “OrderNow service”. The old name still appears in the technical identifiers, for example in the configuration section <OrderNowMail>.

When an email is sent

The email is not triggered by a schedule but by the improvement of the availability status compared to the moment of registration.
No distinction is made between “red not orderable” (red-hard) and “red orderable” (red-soft). No email is therefore sent when switching from red-hard to red-soft.
The service is most useful when you cannot give a foreseeable date for the return to availability. In this case, the product should have the status “red not orderable” (red-hard) at red stock levels. Instead of the shopping cart button, you then show the button for the BackInStockMail.

Requirement

Dynamic stock management must be activated. Without it, the shop does not know an availability status whose change it could react to. Guide: Displaying stock levels

Overview of the building blocks

The function consists of three templates, one email, and two configuration sections. Get this overview first, then the integration steps fall into place on their own. How the registration form appears is then up to your design. Possible options are a redirect to a dedicated shop page, a pop-up or layer, or a Bootstrap modal. The technical integration is the same in all three cases.

Step 1: Activate the service

In the shop configuration shop.config, set the Allow parameter to yes in the <OrderNowMail> section. If the section is missing, create it. It will later also contain the settings for the notification email.
Reference: Section OrderNowMail

Step 2: Set a minimum stock level (optional)

Without this specification, the shop sends the notification as soon as a single unit is available. With multiple registered buyers, the product is then immediately out of stock again. With a minimum stock level, you delay sending until enough goods are available. To do this, add the OrderableMailStockLimit-Value parameter to the <Inventory> section in the shop.config.
Reference: Section Inventory

Step 3: Configure the email

Subject, sender, and the template to be used are also in the <OrderNowMail> section.
SenderAddress and Subject-Txt are mandatory. If either is missing or empty, the shop aborts sending and writes an error to the log. The buyer then does not receive an email, without this being visible in the shop.
Reference: Section OrderNowMail

Step 4: Create the email template

Create a template under exactly the name that appears after Template in the <OrderNowMail> section, and save it in the template directory of the respective sub-shop, for example under benutzer/templates/<Subshop>/.
The mail is always sent as an HTML mail. You do not need to add anything for this, the shop marks the content accordingly itself.

Which tags are allowed

The content of automatically generated emails depends on which feature they originate from. The BackInStockMail comes from the OrderNow module, so exactly the data that this module supplies when sending is available. Other tags remain unreplaced in the text.
The same tags are also replaced in the subject. Subject-Txt = ~PR-Name~ ist wieder verfügbar is therefore possible.
If you want to append your own parameters to ~PR-DeepLink~, first add the optional parameters Referer and SubReferer in the <OrderNowMail> section.
From these, the shop appends ref= and subref= to the link. This guarantees that the link ends on a parameter, and you can attach further ones in the form &parameter=value.
SubReferer only takes effect if Referer is also filled. If Referer is empty, the link remains unchanged.
Materials: URL parameters

Step 5: Add the button to the product detail view

Using the PR-InventoryState() bracket, you control at which availability status the registration is offered. In the following example, the registration link appears at “red not orderable” (red-hard), and the regular shopping cart button in all other cases.
~PR-InventoryRegisterLink~ leads to the registration template from Step 7 and passes along the product.

Step 6: Assign the templates in the shop configuration

Two templates are assigned in the <Templates> section of the shop.config: one for the collection of the contact data, one for the confirmation.
Reference: Section Templates

Step 7: Collect the contact data

Create the template under the name that appears after InventoryRegister. The only mandatory field is the email address, because only it is needed for sending. All other fields are optional in accordance with the EU General Data Protection Regulation. If the buyer is logged in and has thereby consented to the use of their data, the other fields are already pre-filled. If they subsequently register for another product, all fields are filled and they do not have to enter anything again. You can additionally include product information. In the following example, product name and price appear above the form.
~MSG-InventoryRegister_Notify~ outputs the shop’s messages, for example when the email address is missing or invalid. Without this tag, a rejected registration remains inexplicable to the buyer. The IR- tags come in pairs: ~IR-Fieldname_input~ provides the field name for the form, ~IR-Fieldname~ the value already entered.

Step 8: Confirm the registration

Create the template under the name that appears after InventoryRegisterConfirm. No special tags are needed here, a confirming text is enough.

Step 9: Test the notification email

The test runs in two stages, because the display and the tag replacement are checked separately.

Check the display

Open the email template in the browser to see whether the CSS rules take effect. To do this, append the tpl parameter with the template name to a sample product.
This call only shows the view. The tags are not replaced, and the link to the product cannot be clicked.

Check the function

Create a test product with the stock level for which you have integrated the service. Call it up, fill in the form, and then set the stock level to “green”. You will then receive the notification at the specified address, with replaced tags and an active product link.

Show registered products in the shop

Optionally, you show the buyer a list of the products for which they have registered, along with the option to unsubscribe from individual notifications.

Create the overview template

Create a template with any name, for example ws_inventory_register_overview.htm. An assignment in the shop.config is not necessary, the template is loaded via a link.
Three places in the example deserve an explanation:
  • {CAT-AdvData($InventoryRegister,999)} returns the registrations as a product list, here up to 999 entries. The {@PR-Data} loop iterates through them.
  • The free parameter DC-FPAdvData remembers that the list had entries. Only in this way can a text be output below the list when it was empty, since the bracket itself is already closed at this point.
  • ~PR-DeleteIRListEntry(...)~ generates the unsubscribe link. As a parameter you specify the template to which the shop returns after deletion, in this case the overview itself.
The {PR-SetParent} block is only needed for set products. It lists the contained sub-products. The obvious choice is the customer account ws_user_account.htm. Since a buyer does not have to be logged in to register, however, you can place the link anywhere.
The bracket ensures that the link only appears when registrations actually exist. Finally, check both: the sending of the BackInStockMail and the display of the registered products.
  • Guide: Displaying stock levels
  • Guide: Displaying dependent variants