Jump to content

Add backoffice columns products list in the table to display more fields


manivannanba

Recommended Posts

 

hi,
 
I am looking for steps and query to display more fields in backoffice product list table like meta title and meta keyword. 
 
I have found the place to edit for replicate in product list table Catalog/Admin/AdminProductsController.php. [/size]
 
But dont know how fetch and display. 
 
Please refer the below screenshot for more descriptive position

TchKhKO.png
In the above attached screenshot it got an extra field for manufacture. but i am looking for steps to display meta title and meta keyword of the product. 

 

I am using prestashop version 1.6.0.9

Thanks
Please help me to resolve this issue.

post-784963-0-83821400-1421759024_thumb.png

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

Found a solution to this problem 

 

Open file controller/admin/AdminProductsController.php. approx line number(177)

 

 

$id_shop = Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP? (int)$this->context->shop->id : 'a.id_shop_default';
$this->_join .= ' JOIN `'._DB_PREFIX_.'product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = '.$id_shop.')
 
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (a.id_product = pl.id_product)  // added extra line here
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON ('.$alias.'.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = '.$id_shop.')
LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = '.$id_shop.') 
LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = '.$id_shop.')
LEFT JOIN `'._DB_PREFIX_.'product_download` pd ON (pd.`id_product` = a.`id_product`)'; // added extra line here also
 
 
$this->_select .= 'shop.name as shopname, a.id_shop_default,';
$this->_select .= 'MAX('.$alias_image.'.id_image) id_image, cl.name `name_category`, '.$alias.'.`price`, 0 AS price_final, a.`is_virtual`, pd.`nb_downloadable`,pl.`meta_title` as meta_title, sav.`quantity` as sav_quantity, '.$alias.'.`active`, IF(sav.`quantity`<=0, 1, 0) badge_danger';
 
 
And also add this lines in code
 
 
 
if (Configuration::get('PS_STOCK_MANAGEMENT'))
$this->fields_list['sav_quantity'] = array(
'title' => $this->l('Quantity'),
'type' => 'int',
'align' => 'text-right',
'filter_key' => 'sav!quantity',
'orderby' => true,
'badge_danger' => true,
//'hint' => $this->l('This is the quantity available in the current shop/group.'),
);
 
// added extra lines 
$this->fields_list['meta_title'] = array(
'title' => $this->l('Meta Title'),
'align' => 'left',
'width' => 40
 
);
 
// end of it added extra lines 
$this->fields_list['active'] = array(
'title' => $this->l('Status'),
'active' => 'status',
'filter_key' => $alias.'!active',
'align' => 'text-center',
'type' => 'bool',
'class' => 'fixed-width-sm',
'orderby' => false
);
 
 
Now save and refresh thats all. 
Link to comment
Share on other sites

  • 3 weeks 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...