I’m writing a script that copies the stock levels found on my server to a local database with have instore which our tills read off.
Trouble is we have over 4000 products, so copying stock levels several times a minute seems rather resource intensive.
I was thinking of modifying magento so that every time stock levels changed on magento it would log the change in a seperate table, then my local script can read off only the changes rather than the whole table.
Is there a function magento uses for making stock changes? I could then add my code to be called everytime stock levels change.
You can observe the event
cataloginventory_stock_item_save_before. Also read how to observe an event.