Jump to content
5haun

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

Recommended Posts

Posted (edited)

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)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More