Using the Tinx connector, one can send stock from BC to a webshop using various methods. In this article, we first explain how the stock is set up using our default mapping and after this explain how to use our own custom stock tables.
Stock via default mapping
By default, the mapping that is added when installing a Tinx webshop connector will have the stock sent using a quantity field as well as a formula. You can find this in the XX-020 message in the top line. Look for quantity/stock_quantity/qty.
The standard formula is shown below.
Stock via custom report
The second most used method for Tinx connectors for sending stock values, is by using a report. Using a report that loops through items to check for any changes to stock has various benefits.
- You can have multiple stock calculations at the same time.
- You can filter based on specific locations, even multiple ones.
- You can set conditions that must be met before sending stock, even looking at different tables, such as the attributes table.
In order to set this up, there are three areas in the connector that need changing. Editing the Sales Channel Card, adding an additional report to the job queues and adding or changing mapping.
Sales Channel Card
For the card, select in the banner Sales Channel > Stock Formula.
There, you can add a code for the formula (e.g. Stock Formula 1) and a description. There, select the quantity field to use.
The standard formula that Tinx uses is based on the following:
Item table (27): Inventory (field 68) - Qty. on Sales Order (85)
Again, you are free to change the formula based on your needs.
Message / mapping
If a consultant has worked on your project, it is possible that the message already exists and is found in the PRODUCT-OUT code. Below an example from a Magento connector, where the message is called M2R-020-STOCK. You can see the table from which we get the data in the message definition.
If you this is a new feature, however, you can also set the flow up as follows. Go to the XX-020 message, for sending products. There, in the first line of the message (usually with element name product), add another line underneath the existing ones with the below values:
Next, to ensure that a product is updated with the correct stock whenever a change happens in the system (e.g. positive adjustments to the item journal or sales orders for that product), we need to add an extra order event to the product update message.
Make sure you select the second line in the XX-OUT-PRODUCTS dashboard. The first one is used for creating products (hence the REST method is set to POST). The second one (with PUT method) is used for updating products. Select that line and go to Event / Triggers in the banner under Manage and add the following line.
The relation (between product and Tinx stock tables) is as follows:
To add the report that is needed to calculate stock, head to 'Job Queue Entries'. There, select New in the banner and then select Object Type to Run to Report and Object ID to Run to 11205302.
Then choose which days and time slots you'd like the stock to be updated under Recurrence. Then add a Earliest Start Date (e.g. TODAY). Turn it on via Process > Set Status to Ready (if all the other steps have been completed).