Automatically update records depending on a table reference

Answered

Hey, hope you are doing well. I'm working on a multiple stores management for products.

Each product has a stores attribute which allows to display the stock by store. I have linked the store table (store_id) as you can see. When a new store is added to the store table, I would like it to be automatically added to the store list for each product.

The only way I think of doing this is through the API, but that seems very complicated and tedious since I have to go through each product record. Also, I want this to work even when adding a store via the database admin panel.

Is there a clean way to tell the table to always retrieve all available stores?

2 replies