How to enable all products in all stores

I am using Magento (1.7) and I just expanded my old store (store1) with storage2 to several stores. I have many products (about 1500) and they are all visible in Store1, but not in the new store (store2). Is there an easy way to include all products for all stores?

+5
source share
2 answers

In the product grid in admin, select all products using the "Select All" button. In the drop-down menu "actions"; Select Update Attributes. On the tab "Websites"; select the sites you want and click "Save." Then reindex all the data:

"" > " ".
, .

+8

. -, admin. , " ", , " " "". - , " -" "".

, , - PHP script Magento:

<?php

require_once('app/Mage.php');
umask(0);
Mage::app('admin');

$website_ids = array(1, 2); // I'm assuming your website IDs are 1 and 2.
// $website_ids = getWebsitesArray();

$product_collection = Mage::getModel('catalog/product')->getCollection();
foreach($product_collection as $product) {
    $product->setWebsiteIds($website_ids);
    $product->save();
}

, , - programatically:

/* @return array */
function getWebsitesArray() {
    $ret = array();
    $website_collection = Mage::app()->getWebsites(true);
    foreach($website_collection as $website) {
      $ret = array_push($website->getId());
    }

    return $ret;
}
+2

All Articles