1
votes

So, I'm trying to find out what changes in the database tables when an enabled product (i.e. available in catalog_product_flat_1) goes to quantity 0 or to quantity X > 0.

I didn't find anything related to stock in catalog_product_flat_1, but I did find that tables cataloginventory_stock_item, cataloginventory_stock_status, cataloginventory_stock_status_idx have related columns.

I see that cataloginventory_stock_status has qty and status reflected in the admin (i.e. when you update stock qty in admin, it gets reflected here), but cataloginventory_stock_status_idx doesn't change with stock update in the admin. I'm guessing this gets updated when the re-index happens? I tried changing cataloginventory_stock_status_idx's qty and status, but an out-of-stock item on the front-end doesn't immediately become available.

So, my question is:

What are the changes made in the DB tables when an enabled product (i.e. listed on front-end) becomes available (qty>0) or unavailable (qty=0)? I'm trying to see if we can update stock levels and have changes reflected immediately without re-indexing the products. We use Magento EE 1.12.

1

1 Answers

0
votes

One way to determine this would be to enable the MySQL general_query_log - then you can see the actual DML statements.

You'll first need to enable general_log and then you can specify the actual file:

See: http://dev.mysql.com/doc/refman/5.1/en/server-system-variables.html#sysvar_general_log