9

Intro MSI stock works differently from the previous CatalogInventory stock. To explain how to get the stock properly i first need to explain how MSI works. However i will state this beforehand, it is impossible to get a different stock based on storeviews. It is only possible to get it per website, as i will explain below: In Magento 2.3 when using MSI you ...


8

I was struggling with the same issue, and got a clean solution to it. Mage_Index_Model_Indexer_Abstract has an inbuilt function called isVisible() If this function returns false, then the indexer is disabled completely. So you can extend class Mage_CatalogInventory_Model_Indexer_Stock and then add isVisible() function to it which returns false (hardcode /...


6

For Magento 2.1.x Goto Admin -> Stores -> Configuration For individual settings, go to product details Click Advanced Inventory


6

the cataloginventory_stock_status is the one that is used for reading in the frontend. In order to not interfere with the table reads, when the stock index is running it is writing in the _tmp and/or _idx table and when it's done, the values are moved to the main table. The temporary table used is determined by this method \Magento\CatalogInventory\Model\...


6

After migrating the site I got the above error on placing the order. The user that was trying to access the DB is an old server DB user which didn't exist in the new server. I searched for the user in DB and Code to make sure something wasn't hard coded and nothing was hardcoded. Finally, after googling a bit I found a solution : Problem: Magento creates a ...


4

This is a working example wich i use: $product = Mage::getModel('catalog/product'); $product->setWebsiteIds(array(1)); $product->setTypeId('simple'); $product->setName('name'); $product->setDescription('xyz'); $product->setShortDescription(' '); ...


4

Untill magento 2.2.6 you can not assign / allocate inventory on store level or website level basis. inventory is managed globaly so you will have single inventory across all stores / websites. However in magento 2.3 , MSI (MultiSource Inventory ) is introduced but as per devdocs that is available on website level not on store level. to manage inventory on ...


3

The only solution to deal with this problem is to put all indexers into the background. Re-indexation might not only make your store slow but also introduces a chance of deadlock when two concurrent orders bring your order out of stock. The best way to achieve it: Disable Mage_CatalogInventory observer for sales_model_service_quote_submit_success event. ...


3

let's say that $collection is your product collection that you build like this: $collection = Mage::getModel('catalog/product')->getCollection() ->...additional filters here...; now do this to your collection. This joins the collection with the stock status table. $website = Mage::app()->getWebsite(); Mage::getModel('cataloginventory/...


3

You are right. It does not seam to be a way to disable it via config.xml. The only option seams to be the overriding the stock index model. If this seams like an ugly way of doing it, there could be an other way. It's almost the same thing as rewriting the class but not quite. You can create your own model and replace the original model. This means that your ...


3

Magento2 uses the \Magento\CatalogInventory\Api\StockRegistryInterface to get stock information of a product: $stockItem = $this->stockRegistry->getStockItem($product->getId()); You should create an own implementation of this enterface which could gets it's data from a custom field. Register your implementation with the di.xml file in a module.


3

I got an issue. I found website_id = 1 instead of 0 in cataloginventory_stock table. I change website id to 0.


3

You cannot do this in 2.2.0 without custom extensions. On the database level a product has only global inventory settings stored in cataloginventory_stock_item table. I'd suggest to look for multi-stock extensions.


3

Add an after plugin to \Magento\InventoryApi\Api\SourceItemsSaveInterface::execute API


2

I checked in magento version 1.7 and it is definitely true there (that orphans should not exist in cataloginventory_stock_item). The cataloginventory_stock_item table's product_id column has a foreign key referencing catalog_product_entity.entity_id, with "ON DELETE CASCADE, ON UPDATE CASCADE" options set. That means that deleting products from ...


2

in the file app\design\frontend\default\YourTheme\template\catalog\product the following lines need to be changed. <div class="availability-only"> <?php echo $this->__('Only') ?> <?php echo (int)($qtyStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty());?> ...


2

What you can do is set /config/global/index/indexer/catalog_product_attribute/model which is catalog/product_indexer_eav at the moment to <model />. (of course you can do this with every other indexer) But I have no idea what the side effect is. At least, the indexer shouldn't run anymore (and I think it is not shown in the backend too) Or you can ...


2

The easiest way to disable this message in Magento 2 is to just set the threshold to -1 under Stores > Settings > Configuration > Catalog > Inventory > Stock Options > Only X left Threshold.


2

Your example does not take the value for "use config" into account. Let's have a look at how addInStockFilterToCollection works: public function addInStockFilterToCollection($collection) { $this->getResource()->setInStockFilterToCollection($collection); return $this; } OK, it's delegating to another method: public function ...


2

You can create a module that has an observer and depending on where you want to check the inventory, observer those events, like product_save_after and checkout_submit_all_after events. An observer would look like something below: In config.xml: <events> <checkout_submit_all_after> <observers> &...


2

Unfortunately Magento does not support email notifications for out of stock products. However, there is an RSS feed available out of the box in the backend to be notified about low stock products: To get notified via email, you can either develop your own custom module (which could be long and complex) or you can use a 3rd party service that automatically ...


2

I'm afraid the checkbox state is hardcoded in the template. So you need to remove all occurrences of the checked="checked" in the template app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml


2

I had a similar problem. My situation was different in a few respects: I'm using the V1 API. I'm passing SKUs instead of product IDs. Here was my original code: $skus = ['SKU001', 'SKU002', 'SKU003']; $results = $client->call( $sessionID, 'cataloginventory_stock_item.list', $skus); Just like the documentation says, right? But I ...


2

As mentioned in the answer below, the max qty allowed for a simple product can be controlled through Magento 2 by changing the Maximum Qty Allowed in Shopping Cart in the Advanced Inventory panel at the product level. However, in my case since I wanted to limit the max number of qty of configurable products I could add to the cart. I know that when a ...


2

You are right, it's a bug. Replace the following lines: $row = array_merge( $defaultStockData, array_intersect_key($existStockData, $defaultStockData), array_intersect_key($rowData, $defaultStockData), $row ); with $row = array_merge( $row, $defaultStockData, array_intersect_key($existStockData, $defaultStockData), ...


2

@Pawel some of dependencies you mention are fake ones. For example, Mage_Checkout and Mage_XmlConnect modules don't use any logic from Mage_CatalogInventory module. Mage_Rss uses only one class constant from the inventory module. You may try with Zookal Mock module. It removes fake dependency definitions and provides mocks for some classes. One of these ...


2

You can Turn off Low Stock Label via admin Stores > Configuration > CleverSoft Themes > Theme Settings > Product Labels. You may need to reindex the data and flush the cache Let me know if you don't find the option Thanks


2

In Magento 2 basically it happens Dynamically with afterSave() method public function afterSave() { $this->cleanModelCache(); $this->_eventManager->dispatch('model_save_after', ['object' => $this]); $this->_eventManager->dispatch('clean_cache_by_tags', ['object' => $this]); $this->_eventManager->dispatch($this-&...


2

I can see that your code does not contain any stock filter you can use this bit of code on the collection $oCollection = Mage::getModel('cataloginventory/stock_item') ->getCollection() ->addFieldToFilter('is_in_stock',0);


2

If you upgrade to 2.3 or 2.3.1 you can then set store stock on a website level using the new MSI stock system without the need for third party modules such as Wyomind. I have just replaced the Wyomind advanced inventory module with the new magento MSI


Only top voted, non community-wiki answers of a minimum length are eligible