Don't want to delete products, because i just assigned my products to my next store like adding another root category and assigned to categories, Same products assigned to two stores. How can i bulk Unassigned products from second store categories?
1 Answer
If you are a developer, you can try below code.
IMPORTANT: You should try this on a test environment with backup first as I haven't tested this code
To run this, create a php file in shell directory in magento root and save below code.
<?php
require_once 'abstract.php';
class Mage_Shell_ProductSave extends Mage_Shell_Abstract
{
public function run()
{
//Change this before you run
$websiteIdToRemoveProducts = 1;
$resource = Mage::getSingleton('core/resource');
$writeConnection = $resource->getConnection('core_write');
$tableName = $resource->getTable('catalog/product_website');
$query = "DELETE FROM `{{$tableName}` WHERE `website_id` = {$websiteIdToRemoveProducts}";
$writeConnection->query($query);
}
}
$shell = new Mage_Shell_ProductSave();
$shell->run();
Change the $websiteIdToRemoveProducts
value before your run.
Once you saved the code, run:
php yourFilename.php
From command line
After that run below command from the same path:
php indexer.php --reindexall
Then Flush your cache.
-
Fatal error: require_once(): Failed opening required 'abstract.php' (include_path='.;C:\php\pear') in C:\wamp\www\abc\mu.php on line– zusCommented Jan 3, 2018 at 11:45
-
-
-
-
In my case, Don't want to delete products, because i just assigned my products to my next store like adding another root category and assigned to categories, Same products assigned to two stores. How can i bulk Unassiged products from second store categories?– zusCommented Jan 22, 2018 at 6:25
.csv
with the Filtered rows - Re-import with the Delete Command - if you're wanting to do this via the UI?