Jump to content

Deleting products from specific manufacturer (mass change)


Recommended Posts

Hi,

 

I am trying to delete 300+ products from specific manufacturer and only way I could figure out is via Catalog>Manufacturers. Only drawback of this way is that I couldn't delete all 300+ product and it seems I would have to delete them one by one!?

 

Is the only alternative in order to delete products from specific manufacturer? phpMyAdmin (how)?

 

Thanks in advance.
Adi

Link to comment
Share on other sites

Hi,

 

I can do that also via phpMyAdmin too but I am not sure which tables should I delete. For example, if I want to delete 10 products, I should create query which would select those 10 products, then delete them from 'ps_product' table, and that is it? I shouldn't touch tables like 'ps_product_attributes', 'ps_product_tag' etc?

 

With kindest regards.
Adi

Edited by adi_2016 (see edit history)
Link to comment
Share on other sites

Actually, you do need to delete the products from all the tables starting with ps_product and also tables like ps_category_product and ps_order_detail. I would recommend not doing this if possible, since it's error prone. A better solution would be to add a "Manufacturer" column to the Catalog > Products tab by creating override/controllers/admin/AdminProductsController.php with the following:

<?php

class AdminProductsController extends AdminProductsControllerCore
{
    public function __construct()
    {
        parent::__construct();
        $this->fields_list['id_manufacturer'] = array(
			'title' => $this->l('Manufacturer'),
			'width' => 90,
			'filter_key' => 'a!id_manufacturer',
            'callback' => 'displayManufacturer'
		);
    }
    
    public function displayManufacturer($id_manufacturer)
    {
        return Manufacturer::getNameById((int)$id_manufacturer);
    }
}

Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override.

 

You should then see a new "Manufacturer" column on the Catalog > Products tab. You can then enter the manufacturer ID in the text field at the top of the column and then click the Search button to view only products by that manufacturer. Then you can delete up to 300 products from a manufacturer at a time.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...