Jump to content
m3w

[SOLVED] Add backoffice columns products list

Recommended Posts

Hi.

 

Any solution for - Available for order (status in list)


P.S. This, only show statuses but, filter_key and enable\disable not working.

$this->fields_list['Available_for_order'] = array(
            'title' => $this->l('Available For order'),
            'width' => 90,
            'type' => 'bool',
            'align' => 'right',
'active' => 'available_for_order',
            'filter_key' => $alias.'!available_for_order'
        );

Thank you for help.

Share this post


Link to post
Share on other sites

Great topic. Thanks for sharing.

 

How would I add fields to show shipping costs, Supplier reference and wholesale pricing?

Share this post


Link to post
Share on other sites

Hi there, 

I have one Idea. So let's do this :)


I want to add custom filter in Back Office products list for images. How to filter them in this way (YES / NO) . 

If you set NO, prestashop will list products WITHOUT image. Else, if you set YES, ps will list products with images.

 

 

What you think?
 

Share this post


Link to post
Share on other sites

Hi, In Backoffice I want to show  Product attributes in prouct listing in after Product name, I want to add the new column attribute and show the all attribute values seperated By comma How I should achieve this. I tried last two days but nothing happen.    

Share this post


Link to post
Share on other sites

how to add "date_update"  to product page?

i put this code:

$this->fields_list['date_upd'] = array(
            'title' => $this->l('Ultima Modificare'),
            'align' => 'left',

 

but i have this message:

 

Interogare SQL gresita
Column 'date_upd' in field list is ambiguous

Share this post


Link to post
Share on other sites

how to add "date_update"  to product page?

i put this code:

$this->fields_list['date_upd'] = array(

            'title' => $this->l('Ultima Modificare'),

            'align' => 'left',

 

but i have this message:

 

Interogare SQL gresita

Column 'date_upd' in field list is ambiguous

 

 

        $this->fields_list['date_upd'] = array(
            'title' => $this->l('Data actualizarii'),
            'align' => 'right',
            'class' => 'fixed-width-xs',
'filter_key' => 'a!date_upd'
        );
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi there!!

I'm a new user, working for the first time on a store. I'm using version 1.7.0.6, and in my back-office, the product list doesn't shows final price, only price before taxes. I've been reading some of the posts in this thread, but it looks like there has been a huge modification in the last Prestashop's release. When I check the AdminProcuctsController.php file  to find the fields_list array, this is how it looks like:

 

        $this->fields_list = array(
            'attributes' => array('title' => $this->l('Attribute - value pair'), 'align' => 'left'),
            'price' => array('title' => $this->l('Impact on price'), 'type' => 'price', 'align' => 'left'),
            'weight' => array('title' => $this->l('Impact on weight'), 'align' => 'left'),
            'reference' => array('title' => $this->trans('Reference', array(), 'Admin.Global'), 'align' => 'left'),
            'ean13' => array('title' => $this->l('EAN-13'), 'align' => 'left'),
            'isbn' => array('title' => $this->l('ISBN'), 'align' => 'left'),
            'upc' => array('title' => $this->l('UPC'), 'align' => 'left')
        );
 
So, what should I do to show final price in the list?? Where could I do it??
 
Thanks for the help!!

Share this post


Link to post
Share on other sites

Please can anyone help how we can add column VISIBILITY ? And i am also looking for solution to add column "Backorder allowed or not" . Thanks for help ;)

Share this post


Link to post
Share on other sites

Hi there,

 

how can I add invoice number in the admin order list?

 

I tried with this code but doesn't work:

 

$this->fields_list['id_invoice'] = array(
'title' => $this->l('Invoice'),
'align' => 'left',
'width' => 40
 
);
 
Thank you!
Edited by MrGun (see edit history)

Share this post


Link to post
Share on other sites

Please can anyone help how we can add column VISIBILITY

 

 

Hi Kaper,

In AdminProductsController.php

Add this line on SQL select :

$this->_select .= ', a.`visibility` as `visibility_state`';

And add this on Fields list :

 

$this->fields_list['visibility_state'] = array(
            'title' => $this->l('Visibility'),
            'align' => 'left',
            'class' => 'fixed-width-xs',
            'align' => center,
            'havingFilter' => true,
            'filter_key' => 'visibility_state'
);
            

  ^_^

Edited by François38 (see edit history)

Share this post


Link to post
Share on other sites

how can I add invoice number in the admin order list?

 

HI MrGun,

 

In AdminOrdersController.php

Add this line on SQL select :

$this->_select .= ', oi.`number` AS `invoice_number";

Add this line under the first, or under other line starting with $this->_join

$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'order_invoice` oi ON (oi.`id_order` = a.`id_order`)';

And add this on fields list :

$this->fields_list['invoice_number'] = array(
            'title' => $this->l('Invoice Number'),
            'align' => 'center',
            'width' => 100,
            'havingFilter' => true,
            'filter_key' => 'invoice_number'
        );

^_^

Share this post


Link to post
Share on other sites

Hi Kaper,

In AdminProductsController.php

Add this line on SQL select :

$this->_select .= ', a.`visibility` as `visibility_state`';

And add this on Fields list :

 

$this->fields_list['visibility_state'] = array(
            'title' => $this->l('Visibility'),
            'align' => 'left',
            'class' => 'fixed-width-xs',
            'align' => center,
            'havingFilter' => true,
            'filter_key' => 'visibility_state'
);
            

  ^_^

Thank you so much, appreciate, but can you help how make it work with "filter" option too?

Another thing -> can be "none / both / catalog " translated as it is in the admin -> catalog -> product -> TAB information ?

 

Thank youuu :)

 

EDIT: i got this error: 

  • You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'visibility_state`, sa.`active` AS `active` , , a.`visibility` as `visibility_' at line 2

Edit2: here is working code:

$this->_select .= $alias.'.`visibility` AS my_visibility, ';
$this->fields_list['my_visibility'] = array(
        'title' => $this->l('Visibility'),
        'align' => 'left',
            'class' => 'fixed-width-xs',
            'align' => center,
            'havingFilter' => true,
            'filter_key' => 'my_visibility'
        );

I just need to translate fields both, none etc...

Edited by Kaper (see edit history)

Share this post


Link to post
Share on other sites

Thank you so much, appreciate, but can you help how make it work with "filter" option too?

Another thing -> can be "none / both / catalog " translated as it is in the admin -> catalog -> product -> TAB information ?

 

Thank youuu :)

 

EDIT: i got this error: 

  • You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'visibility_state`, sa.`active` AS `active` , , a.`visibility` as `visibility_' at line 2

Edit2: here is working code:

$this->_select .= $alias.'.`visibility` AS my_visibility, ';

$this->fields_list['my_visibility'] = array(
        'title' => $this->l('Visibility'),
        'align' => 'left',
            'class' => 'fixed-width-xs',
            'align' => center,
            'havingFilter' => true,
            'filter_key' => 'my_visibility'
        );

I just need to translate fields both, none etc...

 

 

Ok, in fact, there was just one extra "," in my code, before a.`visibility`

 

For translate, use this fields_list :

$this->fields_list['my_visibility'] = array(
        'title' => $this->l('Visibility'),
        'align' => 'left',
            'class' => 'fixed-width-xs',
            'align' => center,
            'havingFilter' => true,
            'filter_key' => 'my_visibility',
            'callback' => 'my_visibility_function'
        );

And add this function under the fields list :

public static function my_visibility_function($my_visibility_function)
    {
        if ($visibility_state_lang == 'both')
            return '<span style="background-color : #0b9819; color : #ffffff; border-radius : 4px/4px"> všade </span>';
        elseif ($visibility_state_lang  == 'catalog')
            return '<span style="background-color : #009adf; color : #ffffff; border-radius : 4px/4px"> katalóg </span>';
        elseif ($visibility_state_lang  == 'search')
            return '<span style="background-color : #0020df; color : #ffffff; border-radius : 4px/4px"> vyhľadávanie </span>';
        else
            return '<span style="background-color : #6c6c6c; color : #ffffff; border-radius : 4px/4px"> nikde </span>';
    }

You can update the traduction because it is google translate for Slovensko.

The best would be to use the translation files but I could not use the variables.

 

Regards,

Share this post


Link to post
Share on other sites

Thank you so much François38 for your time!

 

I tried your code, but in the new column i see only "NIKDE" with grey backgr. (NONE in english) is there something wrong iin the code :unsure: ? 

Share this post


Link to post
Share on other sites

Yes, my mistake !

Use this function :

public static function my_visibility_function($my_visibility_function)
    {
        if ($my_visibility_function == 'both')
            return '<span style="background-color : #0b9819; color : #ffffff; border-radius : 4px/4px"> všade </span>';
        elseif ($my_visibility_function  == 'catalog')
            return '<span style="background-color : #009adf; color : #ffffff; border-radius : 4px/4px"> katalóg </span>';
        elseif ($my_visibility_function  == 'search')
            return '<span style="background-color : #0020df; color : #ffffff; border-radius : 4px/4px"> vyhľadávanie </span>';
        else
            return '<span style="background-color : #6c6c6c; color : #ffffff; border-radius : 4px/4px"> nikde </span>';
    }

 

Share this post


Link to post
Share on other sites

Hey Bro, you are just GENIUS, so many thanks to you :)))... It works like a CHARM!

 


If it is possible, it would still have one improvement.
If I want to filter the status, I have to type the word as it is in the database, ie "None, both ... etc"
 
But if this change is more complicated, it does not matter, I'm glad, even for this :).

Share this post


Link to post
Share on other sites

Hi,

I need to do a similar thing in PS 1.7.0.2

I would like to have a column with a carrier name in the orders list.

Can anybody help me?

Thanks!

Share this post


Link to post
Share on other sites

To add the carrier column to the Product List in Backoffice, you need to add the following to /controllers/admin/ProductController.php:
 

$this->_join.= 'INNER JOIN `'._DB_PREFIX_.'product_carrier` pc ON (pc.`id_product` = a.`id_product`)
	        			LEFT JOIN `'._DB_PREFIX_.'carrier` carrier ON (carrier.`id_carrier` = pc.`id_carrier_reference`)';

$this->fields_list['carrier'] = array(
	        'title' => $this->l('Transportista'),
	        'align' => 'text-right',
	        'filter_key' => 'carrier!name'
);

 

The only problem I can't solve witht his, is when I export products, I get an empty CSV file. If I remove this code, the exported file is perfect.

Any idea? Help please

Edited by vdonadio (see edit history)

Share this post


Link to post
Share on other sites
On 7/11/2016 at 12:09 AM, ELITIV said:

Hi.

 

Any solution for - Available for order (status in list)



P.S. This, only show statuses but, filter_key and enable\disable not working.

$this->fields_list['Available_for_order'] = array(
            'title' => $this->l('Available For order'),
            'width' => 90,
            'type' => 'bool',
            'align' => 'right',
'active' => 'available_for_order',
            'filter_key' => $alias.'!available_for_order'
        );

Thank you for help.

Hello, were you able to solve that? I mean check or unckeck the available for order option in the product list?

Thanks?

Share this post


Link to post
Share on other sites
On 01/11/2013 at 12:38 PM, franco.pentangeli said:
On 18/09/2013 at 9:06 AM, m3w said:

 

 

Thanks for the reply.

I know that is that part of code i have to work, infact i added this part of code inside it:



$this->fields_list['id_manufacturer'] = array(
			'title' => $this->l('Manufacturer'),
			'align' => 'left',
			'width' => 40
						
		);

This works, but print only the ID number, how can i show the manufacturer's name?

hi , i want to filtre my product list in backoffice by manufacturer current after create a profil and permission for this manufacture , in backoffice i want to show just the product List for this manuafcture . any help plz and thnks 

 

Share this post


Link to post
Share on other sites

Hello,

 

I have PS 1.6.1.19.

I have added:

$this->fields_list['location'] = array(
            'title' => $this->l('Location'),
            'width' => 30
        );

For the Location column to be visible in the Products list but the column is empty with no values.

How exactly the syntax for $this->_join should be? I know I need to add that query as well in order for the column to get values. Or not?

Thank you in advance!

Share this post


Link to post
Share on other sites

Hello Guys, i need to add 2 custom COLUMNs with 2 buttons with different links ... I need just button with href="#id_product..." . Can you please help me how?

I need link with ID product for example:

https://page.com/adminer/...../ID_PRODUCT/...

I need it as a shortcut to MYSQL querry trigger for OFF/ON product for backorder.

 

OR: Another solution is, i need to help how can i add define variable -> ID_PRODUCT here in this function:

 

    public static function my_visibility_function($my_visibility_function)    
    
    {

        if ($my_visibility_function == 'both')
            return '<span style="background-color : #0b9819; color : #ffffff; border-radius : 4px/4px; padding: 2px 3px 2px 3px;">&nbsp;Dostupné&nbsp; '.$id_product.'</span>HERE WILL BE PRODUCT_ID';
        elseif ($my_visibility_function  == 'catalog')
            return '<span style="background-color : #009adf; color : #ffffff; border-radius : 4px/4px; padding: 2px 3px 2px 3px;">&nbsp;katalóg&nbsp;</span>';
        elseif ($my_visibility_function  == 'search')
            return '<span style="background-color : #0020df; color : #ffffff; border-radius : 4px/4px; padding: 2px 3px 2px 3px;">&nbsp;vyhľadávanie&nbsp;</span>';
        else
            return '<span style="background-color : #6c6c6c; color : #ffffff; border-radius : 4px/4px; padding: 2px 3px 2px 3px;">&nbsp;Vypredané&nbsp;</span>';
    }

 

Appreciate ♥

Edited by Kaper (see edit history)

Share this post


Link to post
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...

Important Information

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