Currently, for every product the attribute "Inventory" > "Maximum Qty Allowed in Shopping Cart" is defined in global scope for one article.

How can I change this scope to have the maximum quantity in the product defined for each webpage?

Everything I find is about changing the system configuration but does not affect the article: product[stock_data][max_sale_qty]

enter image description here

| improve this question | | | | |

This field is stored in the table cataloginventory_stock_item which does not have a store_id field - so you basically could extend this table and adding a store ID.

Then you have to modify \Mage_CatalogInventory_Model_Stock_Item::getMaxSaleQty via a model rewrite.

In case you have the same max sale qty for all items of one store, it should work if you just modify the system configuration for max_sale_qty in app/code/core/Mage/CatalogInventory/etc/system.xml (also in a custom module with the same XML node)

   <max_sale_qty translate="label">
        <label>Maximum Qty Allowed in Shopping Cart</label>
| improve this answer | | | | |

I ended up writing a module that overwrites getMaxSaleQty() as needed. Ignoring the config value.


class My_Modul_Model_Stock_Item extends Mage_CatalogInventory_Model_Stock_Item
    public function getMaxSaleQty()
        $max = parent::getMaxSaleQty();
        if (Mage::app()->getStore()->getStoreId() == 1)
            if ($this->getProduct()->getFinalPrice() == 0)
                $max = 1;
        return $max;

and in app/code/local/My/Modul/etc/config.xml


You could also add a custom attribute to control this.

| improve this answer | | | | |

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.