Jump to content

[Tutorial] How to add Manufacturer, Supplier and Supplier Reference filters to the product list page in the Back Office


Recommended Posts

image.thumb.png.e2885d92eec644e22eb1273b4b0d07c4.png

  1. Create AdminProductsController.php in /override/controllers/admin/
  2. Copy and paste this code in the file:
<?php
/*
Override AdminProductsController.php to show Manufacturer, Supplier and Supplier Reference 
column filters on the product list controller
*/

class AdminProductsController extends AdminProductsControllerCore
{
    public function __construct()
    {
        parent::__construct();
        
        $this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = a.`id_manufacturer`)
				LEFT JOIN `'._DB_PREFIX_.'supplier` AS supp ON (supp.id_supplier = a.`id_supplier`)
				LEFT JOIN `'._DB_PREFIX_.'product_supplier` ps ON ( a.id_product = ps.id_product AND ps.id_product_attribute = 0 )';

        $this->fields_list['manufacturer_name'] = array(
            'title' => $this->l('Manufacturer'),
            'filter_key' => 'm!name',
            'orderby' => true,
        );
        $this->fields_list['supp'] = array(
            'title' => $this->l('Supplier'),
            'filter_key' => 'supp!name'
        );
		$this->fields_list['product_supplier_reference'] = array(
			'title' => $this->l('Supplier Reference'),
			'align' => 'left',
			'filter_key' => 'ps!product_supplier_reference'
		);
    }
}

    3. Clear cache in Advanced Parameters > Performance

Only tested in 1.6.1.x

Edited by 5haun
Added image (see edit history)
Link to comment
Share on other sites

  • 1 year later...
  • 3 months later...

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...