Jump to content
m3w

[SOLVED] Add backoffice columns products list

Recommended Posts

Hi,

i need help to add custom columns in product list in backoffice, what i'd like is get Features value and Manufacturer beside Category column.

 

I'm editing AdminProductsController.php and found:

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

With this code i get the id of manufacturer, how can i get the name?

 

Hope someone can help to figured it out

  • Like 1

Share this post


Link to post
Share on other sites

<a href="{$manufacturer.link}"> on tpl

php

$manufacturers = Manufacturer::getManufacturers(false,$language['id_lang'], true);

 

I'm talking in backoffice not in frontend, how can i impement it on my code above?

Share this post


Link to post
Share on other sites

what ps version you use? everything depends on it

You're right... 1.5.4.1

Share this post


Link to post
Share on other sites

open file: controllers/admin/AdminProductsController.php

 

you've got there $this->field_list definition:

	$this->fields_list = array();
		$this->fields_list['id_product'] = array(
			'title' => $this->l('ID'),
			'align' => 'center',
			'type' => 'int',
			'width' => 40
		);
		$this->fields_list['image'] = array(
			'title' => $this->l('Photo'),
			'align' => 'center',
			'image' => 'p',
			'width' => 70,
			'orderby' => false,
			'filter' => false,
			'search' => false
		);
		$this->fields_list['name'] = array(
			'title' => $this->l('Name'),
			'filter_key' => 'b!name'
		);
		$this->fields_list['reference'] = array(
			'title' => $this->l('Reference'),
			'align' => 'left',
			'width' => 80
		);

		if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
			$this->fields_list['shopname'] = array(
				'title' => $this->l('Default shop:'),
				'width' => 230,
				'filter_key' => 'shop!name',
			);
		else
			$this->fields_list['name_category'] = array(
				'title' => $this->l('Category'),
				'width' => 'auto',
				'filter_key' => 'cl!name',
			);
		$this->fields_list['price'] = array(
			'title' => $this->l('Base price'),
			'width' => 90,
			'type' => 'price',
			'align' => 'right',
			'filter_key' => 'a!price'
		);
		$this->fields_list['price_final'] = array(
			'title' => $this->l('Final price'),
			'width' => 90,
			'type' => 'price',
			'align' => 'right',
			'havingFilter' => true,
			'orderby' => false
		);
		if (Configuration::get('PS_STOCK_MANAGEMENT'))
			$this->fields_list['sav_quantity'] = array(
				'title' => $this->l('Quantity'),
				'width' => 90,
				'type' => 'int',
				'align' => 'right',
				'filter_key' => 'sav!quantity',
				'orderby' => true,
				'hint' => $this->l('This is the quantity available in the current shop/group.'),
			);
		$this->fields_list['active'] = array(
			'title' => $this->l('Status'),
			'width' => 70,
			'active' => 'status',
			'filter_key' => $alias.'!active',
			'align' => 'center',
			'type' => 'bool',
			'orderby' => false
		);

		if ($join_category && (int)$this->id_current_category)
			$this->fields_list['position'] = array(
				'title' => $this->l('Position'),
				'width' => 70,
				'filter_key' => 'cp!position',
				'align' => 'center',
				'position' => 'position'
			);

you can edit it, just remove / add new fields. everything depends on you :)

 

best regarads

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

open file: controllers/admin/AdminProductsController.php

 

you've got there $this->field_list definition:

	$this->fields_list = array();
		$this->fields_list['id_product'] = array(
			'title' => $this->l('ID'),
			'align' => 'center',
			'type' => 'int',
			'width' => 40
		);
		$this->fields_list['image'] = array(
			'title' => $this->l('Photo'),
			'align' => 'center',
			'image' => 'p',
			'width' => 70,
			'orderby' => false,
			'filter' => false,
			'search' => false
		);
		$this->fields_list['name'] = array(
			'title' => $this->l('Name'),
			'filter_key' => 'b!name'
		);
		$this->fields_list['reference'] = array(
			'title' => $this->l('Reference'),
			'align' => 'left',
			'width' => 80
		);

		if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP)
			$this->fields_list['shopname'] = array(
				'title' => $this->l('Default shop:'),
				'width' => 230,
				'filter_key' => 'shop!name',
			);
		else
			$this->fields_list['name_category'] = array(
				'title' => $this->l('Category'),
				'width' => 'auto',
				'filter_key' => 'cl!name',
			);
		$this->fields_list['price'] = array(
			'title' => $this->l('Base price'),
			'width' => 90,
			'type' => 'price',
			'align' => 'right',
			'filter_key' => 'a!price'
		);
		$this->fields_list['price_final'] = array(
			'title' => $this->l('Final price'),
			'width' => 90,
			'type' => 'price',
			'align' => 'right',
			'havingFilter' => true,
			'orderby' => false
		);
		if (Configuration::get('PS_STOCK_MANAGEMENT'))
			$this->fields_list['sav_quantity'] = array(
				'title' => $this->l('Quantity'),
				'width' => 90,
				'type' => 'int',
				'align' => 'right',
				'filter_key' => 'sav!quantity',
				'orderby' => true,
				'hint' => $this->l('This is the quantity available in the current shop/group.'),
			);
		$this->fields_list['active'] = array(
			'title' => $this->l('Status'),
			'width' => 70,
			'active' => 'status',
			'filter_key' => $alias.'!active',
			'align' => 'center',
			'type' => 'bool',
			'orderby' => false
		);

		if ($join_category && (int)$this->id_current_category)
			$this->fields_list['position'] = array(
				'title' => $this->l('Position'),
				'width' => 70,
				'filter_key' => 'cp!position',
				'align' => 'center',
				'position' => 'position'
			);

you can edit it, just remove / add new fields. everything depends on you :)

 

best regarads

 

 

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?

Share this post


Link to post
Share on other sites

so in this case you have to add new join to this:

	$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_.'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 manufacturers table (join based on id_manufacturer)

then in field definition use 'filter_key' => 'ALIAS!name', where ALIAS is manufacturers table alias

  • Like 1

Share this post


Link to post
Share on other sites

so in this case you have to add new join to this:

	$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_.'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 manufacturers table (join based on id_manufacturer)

then in field definition use 'filter_key' => 'ALIAS!name', where ALIAS is manufacturers table alias

 

i tried but with no luck.... can you please write me the correct LEFT JOIN?

Share this post


Link to post
Share on other sites
$this->_join .= ' INNER JOIN `'._DB_PREFIX_.'manufacturer` AS manu ON (manu.`id_manufacturer` = a.`id_manufacturer`) ';

+

 

$this->fields_list['manufacturer'] = array(
'title' => $this->l('Manufacturer name:'),
'width' => 230,
'filter_key' => 'manu!name',
);

=

 

 

TchKhKO.png

 

 

:)

  • Like 7

Share this post


Link to post
Share on other sites

glad to hear that it works as you expected :)

im goign to mark this topic as [solved]

 

best regards

  • Like 1

Share this post


Link to post
Share on other sites

Ok, just a little question: if a product hasn't a manufacturer, you can't see it in the list!

Do you know how solve this problem?

Share this post


Link to post
Share on other sites

instead of INNER JOIN use LEFT JOIN

$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'manufacturer` AS manu ON (manu.`id_manufacturer` = a.`id_manufacturer`) ';
  • Like 5
  • Thanks 1

Share this post


Link to post
Share on other sites

Hi,

I have a similar problem, but I am using the 1.4.8.2 version, and I can't find the AdminProductsController.php file anywhere.

 

My problem is that I have to add a column in which you can check or uncheck  (like the one for "displayed"), in order to make a product available or unavailable. (view image to see what settings I am talking about). Is that possible?

 

exemplu.jpg

Share this post


Link to post
Share on other sites

Hi!

thanks for the istruction. 

I want to add also carriers. How can I do it?

thanks!

 

where you want to add carriers?

Share this post


Link to post
Share on other sites

Hi,

I have a similar problem, but I am using the 1.4.8.2 version, and I can't find the AdminProductsController.php file anywhere.

 

My problem is that I have to add a column in which you can check or uncheck  (like the one for "displayed"), in order to make a product available or unavailable. (view image to see what settings I am talking about). Is that possible?

 

exemplu.jpg

I know this is not my topic, but please don't ignore my question. :)

Share this post


Link to post
Share on other sites

your question is not related to main case in this topic,

this is why no replies here. please follow forum rules

Share this post


Link to post
Share on other sites

Sorry about that. It really seemed a very similar problem to me... 

I created a new topic about that. :rolleyes:

Share this post


Link to post
Share on other sites

what you want to have in this column? ;) selected carrier?

Share this post


Link to post
Share on other sites

ok i will write guide for this, but efore i will do that please share information about your prestashop version

Share this post


Link to post
Share on other sites

Hi vekia!

I tried to add Producers column to my BO as you describe, but nothing change:-/ I have Prestashop 1.5.4.1. What could be wrong? I would like to column producers, and column with regular price or something which show me is this price is regular or pricedrop. Can you help me please?

Regards

Share this post


Link to post
Share on other sites

Hi vekia!

I tried to add Producers column to my BO as you describe, but nothing change:-/ I have Prestashop 1.5.4.1. What could be wrong? I would like to column producers, and column with regular price or something which show me is this price is regular or pricedrop. Can you help me please?

Regards

sorry it is a bit old thread, may i know what you exactly did?

Share this post


Link to post
Share on other sites

Hi vekia, thanks for your answer.

I would like to add producers tab in my BO as you describe in this topic.

I've put this code:

$this->fields_list['manufacturer'] = array(
'title' => $this->l('Manufacturer name:'),
'width' => 230,
'filter_key' => 'manu!name',
);

to controllers/admin/AdminProductsController.php but nothing was changed:-/ Can you tell me what should I do? I would like to add also tab which will show regular price (without price drop) or something like that. Is there a chance to do that?

Regards

Share this post


Link to post
Share on other sites

have you also extended the query ? there is a part to add queries ($this->_join)

Share this post


Link to post
Share on other sites

post #14 here

$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'manufacturer` AS manu ON (manu.`id_manufacturer` = a.`id_manufacturer`) ';

Share this post


Link to post
Share on other sites
$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)

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 = a.id_shop_default)

LEFT JOIN `'._DB_PREFIX_.'shop` shop ON (shop.id_shop = a.id_shop_default) 

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=a.id_shop_default)';

}

$this->_select .= 'shop.name as shopname, ';

}

else

{

$alias = 'a';

$alias_image = 'i';

$this->_join .= '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 = 1)';

}

 

$this->_select .= 'MAX('.$alias_image.'.id_image) id_image,';

 

 

Somewhere there?:-)

Share this post


Link to post
Share on other sites

yesss exactly there, hope that this will work for you, have you tried?

Share this post


Link to post
Share on other sites

It works:-) Thank you:-). But there is one issue, if a product is not related to a producer is does not display in BO. Can it be fixed somehow? And can you help me with one more tab? I would like to add tab that will show if the product is in pricedrop or regular price. Or maybe table with regular price. I need to see which products are in pricedrop.

Best regards!

Edited by nikczemnik (see edit history)

Share this post


Link to post
Share on other sites

How can you do this, but instead of Manufacturer to show

 

AVAILABLE FOR ORDER

 

and

 

ONLINE ONLY in BO Product Listing?

 

Thanks

Edited by perusi (see edit history)

Share this post


Link to post
Share on other sites

Hi all.


I would like to add the manufacturer name in front of product in Back office/order detail tab/product line. It is the line which shows


what product customer bought. Please see attachment. I run PS 1.5.3. Thank you very much for help.manufacturer-name.jpg


Share this post


Link to post
Share on other sites

Any help?

to fields list add

        $this->fields_list['product_supplier_reference'] = array(
			'title' => $this->l('Suuplier Reference'),
			'filter_key' => 'supp!product_supplier_reference'
		);

k01UCAk.png

 

 

and extend query with this left join:

LEFT JOIN `'._DB_PREFIX_.'product_supplier` supp ON sa.id_product = supp.id_product

effect:

 

Share this post


Link to post
Share on other sites

to fields list add

        $this->fields_list['product_supplier_reference'] = array(
			'title' => $this->l('Suuplier Reference'),
			'filter_key' => 'supp!product_supplier_reference'
		);

k01UCAk.png

 

 

and extend query with this left join:

LEFT JOIN `'._DB_PREFIX_.'product_supplier` supp ON sa.id_product = supp.id_product

effect:

 

 Thank you so much! That worked!

Share this post


Link to post
Share on other sites

I realize this table don't always store all supplier reference because some attributes are 0. There is another table which contains more accurate data.

 

How do I get supplier_reference field of ps_product_attribute table instead? I tried replacing the table and fields using your solution but keep getting 

 

  • Bad SQL query
    Column 'reference' in field list is ambiguous

 

 

Any help would be great!

Edited by Pressed0024 (see edit history)

Share this post


Link to post
Share on other sites

hello

it just mean that you have to define alias for table you included

may i know what code you used to include ps_product_attribute ?

Share this post


Link to post
Share on other sites

The exact same code you recommended, just that I swap the table and fields accordingly. That apparently didn't work.

$this->fields_list['supplier_reference'] = array(
            'title' => $this->l('Suplier Reference'),
            'filter_key' => 'supp!supplier_reference'
        );
LEFT JOIN `'._DB_PREFIX_.'product_attribute` supp ON sa.id_product = supp.id_product

Share this post


Link to post
Share on other sites

Ehi Vekia!Sorry for the question,

 

but if i want to show an icon if in the order there is a NOTE, how can i do?!

$this->fields_list['herewhatdoIput?!'] = array(
            'title' => $this->l('herewhatdoIput?!'),
            'width' => 40
                        
        
);

Share this post


Link to post
Share on other sites

I have a area "bigimage" in my database (ps_image)

 

"bigimage" is tinyint(1), inside have just "0" or "1".  And basicly i use that value to make photo bigger size (1) or normal size (0).

 

I just want to change the "bigimage" value in database from that product-list on backoffice. Just like green "status" button. I know how to add a column to show a data but i dont know how to do that. Do you know?

 

 

CIClGVD.jpg

Edited by ajnglagla (see edit history)

Share this post


Link to post
Share on other sites

Hello,

 

I would like to ask you for extending your solution.

 

I am using Prestashop 1.5.6 with products combinations.

So for one product with ID 18 for example i have 3 supplier_references and i would like to see all of them in product list and best way to show them also in search list.

 

Thank you very much

 

to fields list add

        $this->fields_list['product_supplier_reference'] = array(
			'title' => $this->l('Suuplier Reference'),
			'filter_key' => 'supp!product_supplier_reference'
		);

k01UCAk.png

 

 

and extend query with this left join:

LEFT JOIN `'._DB_PREFIX_.'product_supplier` supp ON sa.id_product = supp.id_product

effect:
 

Share this post


Link to post
Share on other sites

Hi guys,

 

i am successful to integrate the column CATEGORY, with this code in AdminOrderController:

 

$this->_select = '
		a.id_currency,
		a.id_order AS id_pdf,
		CONCAT(LEFT(c.`firstname`, 1), \'. \', c.`lastname`) AS `customer`,
		osl.`name` AS `osname`,
		os.`color`,
        od.`product_reference`,
        cl.`name` AS `cat_name`,
		IF((SELECT COUNT(so.id_order) FROM `' . _DB_PREFIX_ . 'orders` so WHERE so.id_customer = a.id_customer) > 1, 0, 1) as new,
		GROUP_CONCAT(od.product_name separator \', \') as products';

        $this->_join = '
		LEFT JOIN `' . _DB_PREFIX_ . 'customer` c ON (c.`id_customer` = a.`id_customer`)
		LEFT JOIN `' . _DB_PREFIX_ . 'order_state` os ON (os.`id_order_state` = a.`current_state`)
		LEFT JOIN `' . _DB_PREFIX_ . 'order_state_lang` osl ON (os.`id_order_state` = osl.`id_order_state` AND osl.`id_lang` = ' . (int)$this->context->language->id . ')
		LEFT JOIN `'._DB_PREFIX_. 'order_detail` od ON (od.id_order = a.id_order )
        LEFT JOIN `'._DB_PREFIX_. 'product` p ON (p.id_product = od.product_id )
        LEFT JOIN `'._DB_PREFIX_. 'category_lang` cl ON (cl.id_category = p.id_category_default )';
        $this->_orderBy = 'id_order';
        $this->_orderWay = 'DESC';
        $this->_group = 'GROUP BY a.id_order';

        $statuses_array = array();
        $statuses = OrderState::getOrderStates((int)$this->context->language->id);

        foreach ($statuses as $status)
            $statuses_array[$status['id_order_state']] = $status['name'];

        $this->fields_list = array(
            'id_order' => array(
                'title' => $this->l('ID'),
                'align' => 'center',
                'width' => 25
            ),
            'reference' => array(
                'title' => $this->l('Reference'),
                'align' => 'center',
                'width' => 65
            ),
            'product_reference' => array(
                'title' => $this->l('Reference'),
                'align' => 'center',
                'width' => 65
            ),
            'new' => array(
                'title' => $this->l('New'),
                'width' => 25,
                'align' => 'center',
                'type' => 'bool',
                'tmpTableFilter' => true,
                'icon' => array(
                    0 => 'blank.gif',
                    1 => array(
                        'src' => 'note.png',
                        'alt' => $this->l('First customer order'),
                    )
                ),
                'orderby' => false
            ),
            'customer' => array(
                'title' => $this->l('Customer'),
                'havingFilter' => true,
            ),
            //viewproductsoforder
            'products' => array(
                'title' => $this->l('Products'),
                'align' => 'center',
                'width' => 150,
                'filter_key' => 'od!product_name'
            ),
             'cat_name' => array(
                'title' => $this->l('Categoria'),
                'align' => 'center',
                'width' => 100
            ),
            'gift' => array(
                'title' => $this->l('Fattura'),
                'havingFilter' => true,
                'align' => 'center',
                'icon' => array(
                    0 => 'blank.gif',
                    1 => array(
                        'src' => 'note.png',
                        'alt' => $this->l('Richiede Fattura'),
                    )
                ),
                
                'width' => 35
            ),
          

            'total_paid_tax_incl' => array(
                'title' => $this->l('Total'),
                'width' => 70,
                'align' => 'right',
                'prefix' => '<b>',
                'suffix' => '</b>',
                'type' => 'price',
                'currency' => true
            ),
            'payment' => array(
                'title' => $this->l('Payment: '),
                'width' => 100
            ),
            'osname' => array(
                'title' => $this->l('Status'),
                'color' => 'color',
                'width' => 280,
                'type' => 'select',
                'list' => $statuses_array,
                'filter_key' => 'os!id_order_state',
                'filter_type' => 'int'
            ),
            'date_add' => array(
                'title' => $this->l('Date'),
                'width' => 130,
                'align' => 'right',
                'type' => 'datetime',
                'filter_key' => 'a!date_add'
            ),
            'id_pdf' => array(
                'title' => $this->l('PDF'),
                'width' => 35,
                'align' => 'center',
                'callback' => 'printPDFIcons',
                'orderby' => false,
                'search' => false,
                'remove_onclick' => true),
        );

But in the order list, the product is repeated 6 times!Where is my error?


 

Edited by giorinsrl (see edit history)

Share this post


Link to post
Share on other sites

Thank you, but it doesn't work!look forward to great leaders..
 

it prints 6 times the same product name!!!

Share this post


Link to post
Share on other sites

Sorry for digging up this topic but i'm trying to do the same on PS 1.6 but the width parameter is not working. Whatever i put as width is not taken into account.

You can find below my code as i can't seem to find anything related to this for PS 1.6.

class AdminFormulaireController extends ModuleAdminController
{    

    public function __construct()
    {

        $this->table = 'formulaire';
        $this->className = 'Formulaire';

        $this->fields_list = array();
        $this->fields_list['id_formulaire']= array(
            'title' => 'id_formulaire',
            'width' => 25);
        $this->fields_list['id_customer']= array(
                'title' => 'ID Client',
                'width' => 'auto');
        $this->fields_list['Prix']= array(
                'title' => 'Prix HT',
                'width' => 40);
        $this->fields_list['desc']= array(
                'title' => 'Description',
                'width' => 50);
        
        $this->identifier='id_formulaire';
        $this->simple_header=false;
        $this->actions = array('delete','view','edit');
    
        parent::__construct();
    }
    
 
}

And when i look into AdminProductsController.php, i cannot find any width parameter for the fields_list. Here's part of the code

		$this->fields_list = array();
		$this->fields_list['id_product'] = array(
			'title' => $this->l('ID'),
			'align' => 'center',
			'class' => 'fixed-width-xs',
			'type' => 'int'
		);
		$this->fields_list['image'] = array(
			'title' => $this->l('Photo'),
			'align' => 'center',
			'image' => 'p',
			'orderby' => false,
			'filter' => false,
			'search' => false
		);

Found the solution here in french. Now we have to use bootstrap classes to do it.

Edited by kaamyi (see edit history)

Share this post


Link to post
Share on other sites

Hi vekia,

 

How to sort the product listing page using reference ? in the reference field i am giving the number only, but it is not sorting properly. i have attached the screen shot. in the screen shot you can see after the number 1 it shows the product with the number 10 not 2 . whether i need to change the reference field type to int ?

post-453398-0-21769200-1405409300_thumb.png

Share this post


Link to post
Share on other sites

can you show a part of your code where you defined reference field? how it looks like?

Share this post


Link to post
Share on other sites

i have not modified any code in adminproductscontroller,  the sorting through reference no is already part of prestashop. i have found out the reference datatype is varchar so that it is not sorting while giving numbers, and i changed the datatype of reference field to int and it  sorts correctly, if i am not filling the reference field i am getting 0 filled automatically, how to avoid that ? is this method correct or through coding i need to change ?

Share this post


Link to post
Share on other sites

glad to hear that it works as you expected :)

im goign to mark this topic as [solved]

 

best regards

How to add new fields in product back office for prestashop 1.6.0.8.

Share this post


Link to post
Share on other sites

im affraid that you have to shed some more light on your question

Share this post


Link to post
Share on other sites

Hello,
And how do I make a column eg supplier are linked to the website supplier ???

Regards

Share this post


Link to post
Share on other sites

Hello, 

 

I need to bring in the list "Condition" but if i add this code:

 

$this->fields_list['condition'] = array(
'title' => $this->l('Condition'),
'align' => 'left',
'width' => 40
 
);
 
its not workin! Any idea? 

Share this post


Link to post
Share on other sites

 

Hello, 

 

I need to bring in the list "Condition" but if i add this code:

 

$this->fields_list['condition'] = array(
'title' => $this->l('Condition'),
'align' => 'left',
'width' => 40
 
);
 
its not workin! Any idea? 

 

 

can you show a whole part of fields_list ?

how it looks like with code that you applied?

Share this post


Link to post
Share on other sites

Please vekia help.

If we add product with no selected manufacturers. and go to product list, we cant see the new added product.

Can modification something to get it work, because some product with no selected manufacturers cant viewed in product list.

 

Share this post


Link to post
Share on other sites

Please vekia help. If we add product with no selected manufacturers. and go to product list, we cant see the new added product. Can modification something to get it work, because some product with no selected manufacturers cant viewed in product list.

 

can you please show what exactly you modified?

and also in what ps verison

Share this post


Link to post
Share on other sites

can you please show what exactly you modified?

and also in what ps verison

 

Thanks Vekia. im use prestashop 1.6.0.8 and in backoffice we adding manufacturer on product list and last update product with display time,  

Did you try for adding new product with no manufacturers selected and you can see product list in admin product?

Share this post


Link to post
Share on other sites

yes i see because there is LEFT JOIN, not inner join

Share this post


Link to post
Share on other sites

Sorry to bring up and old topic, but this was the closest match to what I want to accomplish, but can't quite get it to work.

 

I would like to add a column in the back office products section to search and filter by EAN13 code. I've successfully tried and added the Supplier column, but not sure what code I need to enter to show the EAN13 column. 

 

Can you help?

 

Version 1.5.6.1

Share this post


Link to post
Share on other sites

Sorry Guys,

 

but for add column products in order list (backoffice) - Prestashop 1.6 ?

 

Thanks  :)

Share this post


Link to post
Share on other sites

hello,

 

I hope I'm in the right topic. I'm looking at my BO catalog > products, and I would like to see the Suppliers name in there, for every product. When I've imported the products, I have named the supplier in Supplier reference as: ABCDATA, NOD, ROYAL and so on.

 

Can I display this field in the desired area, and if so, how ?, attached an image in order for a better understanding.

supplier.jpg

P.S. - the shop is in Romanian Language.

 

 

Thank you

Edited by fpopiku (see edit history)

Share this post


Link to post
Share on other sites

Hi,

I having a problem after adding a new column to my product list. I'm using prestashop 1.5.4.0.

For the new column, I edited the AdminProductsController.php file and I manage to get the column that I want, but then I realise that after save new product details, my screen goes blank, reload page will give same blank page and I need to go back one page for the product list page. I figured that my AdminProductsController.php file cannot be edited, even a space added to the file will cause the same blank space after save new product detail. Only when I inserted the original file that i didn't encountered the blank page. Hope you can help with my problem.

Thank You.

Share this post


Link to post
Share on other sites

Hi all

 

I'm trying to add a column with Supplier reference to the products table in AdminSearchController, to be displayed when you search for a product in the BO (using the search box at the top of the panel).

I have successfully added the column, but the column only shows '--' where i want the values to be displayed.

I have modified AdminSearchController.php to add the column, but I don't know what to modify for displaying the values. I'm guessing AdminProductsController.php?

 

Vekia provided some code for adding the supplier reference to product_list, but I need it in the search results page.

 

Please can someone help?

Share this post


Link to post
Share on other sites

Hi, i need to add to my backoffice the column with the field date_add of the table ps_product. but when i try to do this i receive the message: " prestashop Column 'date_add' in field list is ambiguous "

what can i do? thank you

Share this post


Link to post
Share on other sites

No work on my version, 1.5.4.1

to fields list add

        $this->fields_list['product_supplier_reference'] = array(
			'title' => $this->l('Suuplier Reference'),
			'filter_key' => 'supp!product_supplier_reference'
		);

k01UCAk.png

 

 

and extend query with this left join:

LEFT JOIN `'._DB_PREFIX_.'product_supplier` supp ON sa.id_product = supp.id_product

effect:
 

Share this post


Link to post
Share on other sites

I have similar problem like m2net, but with column advanced_stock_management. I know cause of this problem. But I dont know how can I add alias like a.advanced_stock_management into sql query.

 

Code:

$this->fields_list['advanced_stock_management'] = array(
'title' => $this->l('Advanced stock'),
'align' => 'text-center',
'filter_key' => $alias.'!advanced_stock_management',
'class' => 'fixed-width-sm'
);

 

Error: Column 'advanced_stock_management' in where clause is ambiguous

 

Sql query:

SELECT SQL_CALC_FOUND_ROWS			a.`id_product`,b.name as name,`reference`,a.price as price,sa.active as active			, shop.name as shopname, a.id_shop_default, MAX(image_shop.id_image) id_image, cl.name `name_category`, sa.`price`, 0 AS price_final, a.`is_virtual`, pd.`nb_downloadable`, sav.`quantity` as sav_quantity, sa.`active`, sa.`advanced_stock_management`, IF(sav.`quantity`<=0, 1, 0) badge_danger			FROM `ps_product` a			LEFT JOIN `ps_product_lang` b ON (b.`id_product` = a.`id_product` AND b.`id_lang` = 2 AND b.`id_shop` = 1)					LEFT JOIN `ps_image` i ON (i.`id_product` = a.`id_product`)		LEFT JOIN `ps_stock_available` sav ON (sav.`id_product` = a.`id_product` AND sav.`id_product_attribute` = 0		 AND sav.id_shop = 1  AND sav.id_shop_group = 0 )  JOIN `ps_product_shop` sa ON (a.`id_product` = sa.`id_product` AND sa.id_shop = a.id_shop_default)				LEFT JOIN `ps_category_lang` cl ON (sa.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang` AND cl.id_shop = a.id_shop_default)				LEFT JOIN `ps_shop` shop ON (shop.id_shop = a.id_shop_default)				LEFT JOIN `ps_image_shop` image_shop ON (image_shop.`id_image` = i.`id_image` AND image_shop.`cover` = 1 AND image_shop.id_shop = a.id_shop_default)				LEFT JOIN `ps_product_download` pd ON (pd.`id_product` = a.`id_product`) 						WHERE 1  AND `advanced_stock_management` = 1			GROUP BY sa.id_product

Share this post


Link to post
Share on other sites

I solved my problem. The correct code (for me) is:

        $this->fields_list['product_supplier_reference'] = array(
            'title' => $this->l('Supplier Reference'),
            'filter_key' => 'supp!product_supplier_reference'
        );

And the querry
 

$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'product_supplier` supp ON a.`id_product` = supp.id_product ';
Edited by Krauser (see edit history)

Share this post


Link to post
Share on other sites

has anyone ever managed to show multiple columns of product features?

 

In AdminProductsController.php I have:

		$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'feature_product` fp ON (fp.`id_product` = a.`id_product` AND fp.`id_feature` = '.ID_FEATURE.') ';
		$this->_join .= ' LEFT JOIN `'._DB_PREFIX_.'feature_value_lang` fl ON (fp.`id_feature_value` = fl.`id_feature_value` AND b.`id_lang` = fl.`id_lang`) ';
		
		$this->fields_list['feature'] = array(
		'title' => $this->l('Artist'),
		'width' => 100,
		'filter_key' => 'fl!value',
		);

But when you have more than 1 feature, it lists each product twice or 3 times (depending how many features there are). Ideally we'd like to have 1 column per feature and only show the same product on 1 single line.

 

How do I add more columns for each feature?

 

Thank you PS community!

Share this post


Link to post
Share on other sites

Hi All..

 

if i want to change on header when product edit. there is a product name. i want to change it name to reference how to do this?

Please Help Me.

Thank You

Share this post


Link to post
Share on other sites