11

I see that in the default Magento versions 1.0 to 1.8 (ce) There is a table called cataloginventory_stock that contains only one record.

stock_id    stock_name
1           Default

Related to this, in the Mage_CatalogInventory_Model_Stock_Item model there is this method

public function getStockId()
{
    return 1;
}

with a comment above it @todo multi stock.

I guess someone wanted to implement multi stock functionality and decided not to (like many other "features") but I'm not sure.

So my question is... Is there any other purpose to this table, does it affect other sections of the code or is just there as a starting point for a new feature?

1
  • Magento 2 has released. That table is still there and useless.
    – minhducck
    Feb 22, 2018 at 9:20

1 Answer 1

7

Having a look at this table's indexes it does seem to function completely as a standalone addition to the database, for the time being.

If you look at the assignProduct() method around line 263 of app/code/core/Mage/CatalogInventory/Model/Stock/Item.php you'll notice that it references the method itself:

 Mage::getSingleton('cataloginventory/stock_status')
        ->assignProduct($product, $this->getStockId(), $this->getStockStatus());

I'm assuming yes, as you mentioned, for the future platform to be able to handle an inventory system of multi-stock nature.

Edit: to expand on my answer, Magento references the getStockId() method in a total of 5 files, namely:

  • app\code\core\Mage\CatalogInventory\Model\Observer.php on line 204,
  • app\code\core\Mage\CatalogInventory\Model\Indexer\Stock.php on line 37,
  • app\code\core\Mage\CatalogInventory\Model\Resource\Stock\Item.php on line 57,
  • app\code\core\Mage\CatalogInventory\Model\Stock\Item.php on line 167 and 275, and finally
  • app\code\core\Mage\CatalogInventory\Model\Stock\Status.php on lines 36, 191, 192, 265, 266 and 376

Please note that this is as of Magento 1.7.0.2

1
  • Thanks to the your opinion and the code digging. You just confirmed my suspicions.
    – Marius
    Mar 25, 2014 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.