Magento stock management
I have created new product type whose aim is to sell goods such as digital photos, serial codes or other multimedia files via email. The idea is similar to build-in downloadable product type but in my implementation each file must be different. The problem is to calculate stock levels, which indicate how many files remain available for sale. How can I calculate product stock data based on count of associated rows in foreign table开发者_Python百科 instead of user input in product editor?
I think the best solution will be to update stock data on each sale or adding of the rows into foreign table. If you will join your foreign table and will calculate it on the fly, you just will have performance problems. Just overview the following classes: Mage_CatalogInventory_Model_Indexer_Stock
and Mage_CatalogInventory_Model_Stock
for clarifying of stock functionality in Magento.
精彩评论