4

I have 4 stores with different stores with some similar and some different products.

I want different inventory for all stores, I tried to add the inventory of stores it changes Globally, I'm using the below code.

$sku='123asd';
$qty=12;
$exitProduct = Mage::getResourceSingleton('catalog/product')->getIdBySku((string)$sku); 

if ($exitProduct) {

        $product = Mage::getModel('catalog/product')->load($exitProduct);
        $product->setStoreId(2)->setPrice($xmlDatas['preco'])->save();

        $productId = $product->getId();
        $stockItem = Mage::getModel('cataloginventory/stock_item')->loadByProduct($productId);
        $stockItem->setData('manage_stock', 1);
        $stockItem->setData('qty', (integer) $qty]);
        $stockItem->save();
} else {
    continue;
}

How can I set different Qty for different stores?

3 Answers 3

4

Store and storeview are used interchangeably in many documents, but this is the part where it matters. You have four storeviews and from your description they have the same root catalog.

From Magento's point of view, you only have one store. Think of a store as a brand name. They all have the same products and are supplied by the same central warehouse. Your storeviews are the different shops in the country.

While in practice these shops have their own stock, Magento doesn't operate at that level. This affects a number of things, such as base price and stock.

There are extensions available that change this behavior or add additional stock management features at the storeview level. Be sure to do your research on the extensions you can choose from. Whichever method is used to provide these features, the extension will have to rewrite some core classes that are used throughout Magento and when done incorrectly it can have nasty side effects both in performance and correctness of values.

0

Another solution to making this work would to use slight variations of SKU for each store such as 123asd-storeid, that way you can set different quantity for each store. Although this might complicate things from a business perspective but i would imagine that since you want different quantities for each store then the stock should be divided per business.

0

Magento by default does not support your requirement, however, there are free and paid plugins that could help you achieve this. For more information, I suggest you take a look at The Magento Stock object.

You could look at the following extensions that could be of assistance: https://github.com/careysizer/Magento-StoreLevel-Stockhttps://github.com/DemacMedia/Magento-Multi-Location-Inventory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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