I recently migrated from Volusion to Magento using Cart2Cart. Most of my products are configurable and are showing "Out of Stock" and quantities set to zero. I have 5,000 products (including variations). My question is, is there a way to do a either do a bulk update, or at least have access to a page where I can see all products at once with the option of setting stock values from that page?
Magento – Bulk update configurable products
product
Related Solutions
Step 1
Build an array with your new website ids.
$websiteIds = array(5,6,7);
Step 2
Now get all the product ids.
$productIds= Mage::getResourceModel('catalog/product_collection')->getAllIds();
Step 3
Assign all the products to the new websites:
Mage::getModel('catalog/product_website')->addProducts($websiteIds, $productIds);
Step 4
Feel good about yourself.
Oh this is an odd one, it does appear that there is a "bug" or maybe just a "difference" in opinions as to when a product should show in the review.
Product View
So currently the catalog product view page uses Mage_Catalog_Helper_Product
to help init and render the product. Sounds good and it does a couple of good checks.
$product = Mage::getModel('catalog/product')
->setStoreId(Mage::app()->getStore()->getId())
->load($productId);
if (!$this->canShow($product)) {
return false;
}
if (!in_array(Mage::app()->getStore()->getWebsiteId(), $product->getWebsiteIds())) {
return false;
}
The canShow function when looked into deeper simply returns the results of $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility()
the the product has loaded correctly.
Now this all seems to work well, good job Magento.
Review List
So let's see how the review list does it.
Well firstly it does not use the same helper, which is a bit odd as I would assume that this to limit a lot of duplicate code such as checking if a product can be displayed, which seems to be the issue we are looking at here :(
So we know what it does not do so let's check what it does do.
Well it classifies a product as allowed with the following check:
if (!$product->getId() || !$product->isVisibleInCatalog() || !$product->isVisibleInSiteVisibility()) {
Which we have seen before in the helper's canShow function, but sadly that is all it checks and so does not do a further check for websites. Now I am not sure if this is actually a bug or the desired results, but but it should be fairly simply to sort out.
Fix
To fix this it appears to be fairly simple, luckily there are two events that can be hooked onto. They are both fired in the Mage_Review_ProductController::_initProduct
.
Mage::dispatchEvent('review_controller_product_init', array('product'=>$product));
Mage::dispatchEvent('review_controller_product_init_after', array(
'product' => $product,
'controller_action' => $this
));
So I would suggest creating an observer that works with one of these events and checks the websites attached to a product and if it is not allowed to be shown on the current website simply call clearInstance
Best Answer
You can do it programatically via a script or an extension. What you need is to load magento object, load product collection
For more information check this thread (perhaps you need to set Manage Stock=Yes, Qty etc.)
After @Marius brilliant answer I decided to update my answer by providing few alternatives in case you don't need the same QTY for ALL products.
1) What you can do is to use Magento Dataflow - Import/Export Profile. You need to export your products, change Qty field and if you enabled the stock control in the administration area I believe this would solve the problem. 2) Also you could check Magmi Mass Importer as it allows to update products 3) And here you can check MASS UPDATE STOCK LEVELS IN MAGENTO – FAST by @Sonassi