Hello,
Is there any way to run a php command via ssh to delete certain vendor products ? I have vendors that have over 30.000 products which I need to delete but deleting the vendor will put me in trouble as it will stop at some point and though the vendor name will be gone from vendors list , thousands of products will be left who knows where… Or maybe there is an addon on that can do that ?
Unfortunately, no. But you can create a simple script which does what you need.
Something like this:
<?php
define('AREA', 'A');
define('ACCOUNT_TYPE', 'admin');
require(dirname(__FILE__) . '/init.php');
$company_id = 100; // the ID of the company which products required to be removed
$products_to_delete = db_get_fields('SELECT product_id FROM ?:products WHERE company_id = ?i', $company_id);
foreach ($products_to_delete as $product_id) {
fn_delete_product($product_id);
}
fn_echo('Finished');
1 Like