Jump to content

How to edit Product list in Backoffice?


guysmiley43

Recommended Posts

Hello Prestashop community,

 

May I seek your help on how to edit the Products list? I'd like to change the Base Column and make the pre-wholesale price display instead. I hope someone can point me to the right direction.

 

Please see photo to see which column I'd like to modify. Thanks!

post-242220-0-64221000-1358325837_thumb.jpg

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

override getlist in AdminProductsController

 

/**
* AdminController::getList() override
* @see AdminController::getList()
*/
public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
{
  parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);

  $nb_items = count($this->_list);
  for ($i = 0; $i < $nb_items; ++$i)
  {
     $item = &$this->_list[$i];
     $item['your_column_name'] = 'your column value';
  }
}

 

have fun !

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

Hey BigZ!

 

Thanks very much for pointing me to the controllers directory. I didn't realize Admin controllers were transferred there. I kept looking inside the admin directory. :)

 

Anyway, I managed to configure what I needed.

 

Just for reference, this is what I did.

 

In AdminProductsController.php, I modified the join tables under __construct() to pull from database wholesale_price instead of price.

 

Original:

$this->_select .= 'cl.name `name_category` '.($join_category ? ', cp.`position`' : '').', '.$alias_image.'.`id_image`, '.$alias.'.`price`, ('.$alias.'.`price` * ((100 + (t.`rate`))/100)) AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`';

 

 

Modified:

$this->_select .= 'cl.name `name_category` '.($join_category ? ', cp.`position`' : '').', '.$alias_image.'.`id_image`, '.$alias.'.`wholesale_price`, ('.$alias.'.`price` * ((100 + (t.`rate`))/100)) AS price_final, sav.`quantity` as sav_quantity, '.$alias.'.`active`';

 

Next, a few lines under, there's the field settings. Change to desired label and input data to wholesale_price.

 

Original:

$this->fields_list['price'] = array(
'title' => $this->l('Base Price'),
'width' => 90,
'type' => 'price',
'align' => 'right',
'filter_key' => 'a!price'

 

 

Modified:

 

$this->fields_list['wholesale_price'] = array(
'title' => $this->l('Wholesale Price'),
'width' => 90,
'type' => 'price',
'align' => 'right',
'filter_key' => 'a!price'

 

 

It works as desired now. My other problem, however, is I modified the core files. If I try to put the public function __construct() in the override file it just comes up empty. I wonder why that's the case?

Link to comment
Share on other sites

Solved it.

 

This seems to be the culprit in the override file.

parent::__construct();

 

It was pointing back to AdminProductsControllerCore when it should be pointing to AdminController.

 

change it to

AdminController::__construct();

 

and all is well.

 

Thanks!

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