About the client
The client owns an online store selling home appliances and lighting equipment. The store works with different brands — manufacturers and suppliers. Brands store information about their products in virtual, automatically updated warehouses. From there, the client’s website gets the data in the form of an .xml file.
Problem with inventory tracking
When a supplier ran out of a goods type in a warehouse, a 0 was put next to this product in the generated .xml file. However, the client's site still indicated the same number of items.
To simplify, the client's site could not read the zero sign.
When studying the issue, we realized that the website ran on very poorly written custom code, which could be replaced with Drupal modules. The purpose of the code was to track the import of goods and run various checks. The code was added gradually as new suppliers arrived. It did not always coincide with the previous code written for another supplier. This code accumulated and duplicated, and as a result, the logic of the suppliers’ work got messed up.
Fixing database query logic and search
When the client's site made a query to the database, the search was performed based on the wrong fields. The database contains fields with product ID numbers and supplier identifiers. The request logic of the 1C system was also incorporated into the request since the 1C online warehouse uses product data from the suppliers’ .xml files, too. As a result, the data from the supplier’s warehouse system and the 1C warehouse system got mixed up, and the query was processed incorrectly.

Suppliers were not handled in the process because the search for them was performed not by the supplier ID field but by the supplier alias field — this supplier name was used in the browser link and could change over time. This was why the request was formed incorrectly, but we corrected it by adding the supplier prefix.
Then we found another problem. The tracking of stock changes did not work correctly; it was always finding some changes and launching a new import every time. The function did not work due to outdated code, which was only revised when something broke. We replaced the outdated function with a new one that takes into account the latest versions of Drupal and PHP.
Results
Although we tend to believe that supported modules are better than custom code in the long run, we fixed everything the way the client requested. Further support and development is provided by the in-house team.