Jump to content

Add backoffice "Manufacturers" to columns products list


ibrahimovich87
 Share

Recommended Posts

Hello,

You can add new columns with this function in your module:

public function hookActionAdminProductsListingFieldsModifier($params)
  {
    if (isset($params['select'])) {
		//get data
      $params['select'] .= ', a.new_field as new_field';
		//add new column in list
      $params['fields']['new_field'] = array(
          'title' => $this->trans('Custom field', array(), 'Admin.Global'),
          'align' => 'text-center',
          'class' => 'fixed-width-xs',
          'search' => true,
          'havingFilter' => true,
          'filter_key' => 'a!new_field'
      );
    }


If you have more questions, ask me.

Regards

 

Share this post


Link to post
Share on other sites

1 hour ago, FuenRob said:

Hello,

You can add new columns with this function in your module:

public function hookActionAdminProductsListingFieldsModifier($params)
  {
    if (isset($params['select'])) {
		//get data
      $params['select'] .= ', a.new_field as new_field';
		//add new column in list
      $params['fields']['new_field'] = array(
          'title' => $this->trans('Custom field', array(), 'Admin.Global'),
          'align' => 'text-center',
          'class' => 'fixed-width-xs',
          'search' => true,
          'havingFilter' => true,
          'filter_key' => 'a!new_field'
      );
    }


If you have more questions, ask me.

Regards

 

Hi thanks for your answer,

but the problem it's that i'm really a newbye....wich file i have to modify?

Share this post


Link to post
Share on other sites

On 24/4/2018 at 5:31 PM, ibrahimovich87 said:

Sorry but it's too difficult in this mode...we've sorry but i need this but i'm a completely newbie programmer..can you help me more?

 

I can make this module. Wait.

Share this post


Link to post
Share on other sites

2 hours ago, ibrahimovich87 said:

It was a problem if you make this one for me? ...you are my only salvation

 

Do you want me to add the field? Sorry, but I can not help you until next week.

Share this post


Link to post
Share on other sites

59 minutes ago, rygar said:

Is this for adding manufacturer filter field on the catalog product list or I got it all wrong?

 

This is to add a new field to the product list. If you do not see that new field, can you tell me your version of prestashop?

Share this post


Link to post
Share on other sites

Hello @rygar, i'm happy that my module works well in your prestashop. 

Hello, @ibrahimovich87, you can download new version in my github. Remember that you have to replace the files located in src/PrestaShopBundle/Resources/views/Admin/Product/ by the modules, located in view/PrestaShop/Admin/Product/

view/PrestaShop/Admin/Product/ -> src/PrestaShopBundle/Resources/views/Admin/Product/

Please, you must make a backup of the originals.

Regards

Thanks

 

Edited by FuenRob (see edit history)

Share this post


Link to post
Share on other sites

On 30/4/2018 at 6:44 PM, FuenRob said:

Hello @rygar, i'm happy that my module works well in your prestashop. 

Hello, @ibrahimovich87, you can download new version in my github. Remember that you have to replace the files located in src/PrestaShopBundle/Resources/views/Admin/Product/ by the modules, located in view/PrestaShop/Admin/Product/

view/PrestaShop/Admin/Product/ -> src/PrestaShopBundle/Resources/views/Admin/Product/

Please, you must make a backup of the originals.

Regards

Thanks

 

I've replaced it but nothis appened,

so i have upgraded module and after this i 've re-replaced files, but no changes

Share this post


Link to post
Share on other sites

3 hours ago, ibrahimovich87 said:

I've replaced it but nothis appened,

so i have upgraded module and after this i 've re-replaced files, but no changes

 

Hello, i've uploaded a new realease. I've probed in 1.7.2 and 1.7.3

What files have you replaced?

Regards

Share this post


Link to post
Share on other sites

35 minutes ago, FuenRob said:

 

Hello, i've uploaded a new realease. I've probed in 1.7.2 and 1.7.3

What files have you replaced?

Regards

1.7.2.5 have replaced all file in your github-->addcolums list
so have replaced php in modules, all in hook

and > src/PrestaShopBundle/Resources/views/Admin/Product/

Share this post


Link to post
Share on other sites

29 minutes ago, ibrahimovich87 said:

1.7.2.5 have replaced all file in your github-->addcolums list
so have replaced php in modules, all in hook

and > src/PrestaShopBundle/Resources/views/Admin/Product/

 

You must replace the files:

-catalog.html.twig
-list.html.twig

From the folder: src /PrestaShopBundle/Resources/views/Admin/Product/ by those in /views/Prestashop/Admin/Product/

Regards

Share this post


Link to post
Share on other sites

15 hours ago, FuenRob said:

 

You must replace the files:

-catalog.html.twig
-list.html.twig

From the folder: src /PrestaShopBundle/Resources/views/Admin/Product/ by those in /views/Prestashop/Admin/Product/

Regards

Ok i've  replaced this file but only see categories not brand

2.png

Share this post


Link to post
Share on other sites

4 hours ago, ibrahimovich87 said:

Yes...now it's function ;-) for me it's resolved.....so vert thank you Fuen

 

Yujuuuu!! it's perfect. Please, edit the title for add "Solved", and you can choose what was the answer for you that solved your problem. In this way, we help other users.

 

Thanks

Share this post


Link to post
Share on other sites

  • 1 month later...
On 3/5/2018 at 1:58 PM, FuenRob said:

 

Yujuuuu!! it's perfect. Please, edit the title for add "Solved", and you can choose what was the answer for you that solved your problem. In this way, we help other users.

 

Thanks

Hi fuen...i've update to 1.7.3.o but i cannot see manufactrerr i've cleared cache...can you help me pleasE?

Share this post


Link to post
Share on other sites

On 2/5/2018 at 5:07 PM, ibrahimovich87 said:

1.7.2.5 have replaced all file in your github-->addcolums list
so have replaced php in modules, all in hook

and > src/PrestaShopBundle/Resources/views/Admin/Product/

 Hii,
Have you tried to restart the module?

Share this post


Link to post
Share on other sites

  • 2 weeks later...
  • 2 months later...

Hello!. I'm trying to do the same, followed the steps, Replaced the files in  src/PrestaShopBundle/Resources/views/Admin/Product/   but I have troubles intalling the Module. I've got an error message as I drag and drop the Module Folder onto the "upload module"box.

Where should I copy template folders files and addcolumlist.php?

Thanks

Share this post


Link to post
Share on other sites

  • 3 months later...

Hello,

I'm trying the module in a PS 1.7.4.2, but nothing changes on catalog product list. I've already check cache and restart module. 

I'm wondering if this module works with 1.7.4 version. The file tree is a little bit different :

src/PrestaShopBundle/Resources/views/Admin/Product/

changes to:

/httpdocs/src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/catalog.html.twig

and 

/httpdocs/src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/list.html.twig

 

I've already try to replace the files on github on this path, but nothing changes.

Please, I need to add some extra columns but I can't find where to modify the files.

 

Thanks in advance!!

 

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 weeks later...
  • 2 weeks later...
On 2/15/2019 at 12:04 PM, ibrahimovich87 said:

Hi fuen thank's it's redy for 1.7.5? 

I cannot make it work in 1.7.5, throws error 500 (twig error loader): Template "PrestaShopBundle:Admin/Product/Include:catalog_order_carrets.html.twig" is not defined in PrestaShop/Admin/Product/CatalogPage/catalog.html.twig at line 255. 😥

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 1 month later...
  • 2 weeks later...
On 6/4/2019 at 6:20 PM, PrestaRob said:

Hello,

try attached module - it adds Manufacturers & Suppliers to product list in admin.

 

adminmodifications.zip

Hi

after uploading new code, Manufacturer and Supplier filters appeared, but they don't work and the old filter tabs does not work, they are inactive.

Capture.thumb.PNG.f15d709e291ef73bb6d7c9465e72acd5.PNG
 

Edited by hands0me (see edit history)

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Little update:

{% include 'PrestaShopBundle:Admin/Product/Include:catalog_order_carrets.html.twig' with {

I didn't find any catalog_order_carret.html.twig in my src folder, maybe the error comes from this.

But, I don't know by which file is replaced.

 

Thanks,

Ludo

Share this post


Link to post
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 3 weeks later...

Edit: sorry for the up but it's the first result on google

prestashop 1.7.3+

I think it's a clean example (adapt to your need, here it' is for manufacturer in products admin list)

After install https://www.prestashop.com/forums/applications/core/interface/file/attachment.php?id=226225, modify AdminFilter.php in /admin/autoupgrade (make a search on this folder) and open AdminFilter.php

After the line

'filter_column_name_category' => '',

add the line

'filter_column_manufacturer' => '',

And after the line

'filter_column_name_category' => FILTER_SANITIZE_STRING,

Add the line

'filter_column_manufacturer' => FILTER_SANITIZE_STRING,

Clean your cache in /var/.../dev + prod (delete dev & prod folders)

Reload the page Catalog > products

Joyeux noël

overrideproductslistwithmanufacturer.zip

Edited by Stigz (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

18 hours ago, Stigz said:

Edit: sorry for the up but it's the first result on google 

prestashop 1.7.3+

I think it's a clean example (adapt to your need, here it' is for manufacturer in products admin list)

After install https://www.prestashop.com/forums/applications/core/interface/file/attachment.php?id=226225, modify AdminFilter.php in /admin/autoupgrade (make a search on this folder) and open AdminFilter.php

After the line

'filter_column_name_category' => '',

add the line

'filter_column_manufacturer' => '',

And after the line

'filter_column_name_category' => FILTER_SANITIZE_STRING,

Add the line

'filter_column_manufacturer' => FILTER_SANITIZE_STRING,

Clean your cache in /var/.../dev + prod (delete dev & prod folders)

Reload the page Catalog > products

Joyeux noël

overrideproductslistwithmanufacturer.zip

try in 1.7.4 and work, but... i can't find anything, if I try, look for price, category, manufacturer, whatever ... it does not work and returns me to the administrator's main :(

and this step I have not done because I do not understand .. (modify AdminFilter.php in /admin/autoupgrade

can help me?

  • Thanks 1

Share this post


Link to post
Share on other sites

AdminFilter.php is in \admin\autoupgrade\latest\src\PrestaShopBundle\Entity\

You can add the lines in this file as mentioned before

Clean your cache + delete /dev and /prod folder in /var/cache

reload your admin page at BO > Catalog > products

If it does not work already, now go to \src\PrestaShopBundle\Entity\ to find the other AdminFilter.php and add also the lines as mentioned before

Re-clean your cache.

If the module continue to not working correctly with prestashop 1.7.4, I make a try with prestashop 1.7.4...

1394198627_Screenshot_2019-08-30Produits.thumb.png.518c9b434f5efe19cd008487138e7442.png

 

Edited by Stigz
private values on screenshot (see edit history)

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Hello I installed the module on Pres 1.7.5.1. Everything works ok. I only have problems remembering new filters. Editing the AdminFilter .php file throws out the

Quote

Warning: Invalid argument supplied for foreach () error in the /.../Admin / ProductController .php on line 307 file

 

Share this post


Link to post
Share on other sites

This si a free addon for 1.7.3+ https://www.prestashop.com/forums/applications/core/interface/file/attachment.php?id=226225

with some configuration needed

If you need only to go on the market place, it's here for module https://addons.prestashop.com/en/2-modules-prestashop

and here for theme https://addons.prestashop.com/en/3-templates-prestashop

Edited by Stigz (see edit history)

Share this post


Link to post
Share on other sites

  • 1 month later...

hello, if I wanted to insert a different column that I have in a different table... how can I do?

ES.
I have an additional table with "id_product" and "date". I would like to insert the "date" column associated with the product, thanks

Share this post


Link to post
Share on other sites

  • 4 weeks later...
  • 4 weeks later...
  • 6 months later...
On 8/30/2019 at 10:39 AM, fercarazo said:

try in 1.7.4 and work, but... i can't find anything, if I try, look for price, category, manufacturer, whatever ... it does not work and returns me to the administrator's main :(

and this step I have not done because I do not understand .. (modify AdminFilter.php in /admin/autoupgrade

can help me?

TESTED IN  1.7.6.4

WORKED ! 

Edited by Bzkofficiel (see edit history)

Share this post


Link to post
Share on other sites

  • 1 month later...

Implemented this on 1.7.6.5 (made my own module).

There are 3 "steps" to doing this:

  1. Hook into "actionAdminProductsListingFieldsModifier" (the attached topic module does this for you).
  2. Modify the template files (as per the attached topic module - you need only copy&paste the template files included in the module).
  3. Modify the "AdminFilter.php" file under /src/PrestaShopBundle/Entity/ by adding your new values to the arrays starting on lines #249 & #352 so that the filter actually works.

The files that needed modification were as follows:

  1. /modules/overrideproductslistwithmanufacturer/overrideproductslistwithmanufacturer.php - (included in the attached module)
  2. /src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/catalog.html.twig - (included in the attached module)
  3. /src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/list.html.twig - (included in the attached module)
  4. /src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/products_table.html.twig - (included in the attached module)
  5. /src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Forms/form_products.html.twig - (included in the attached module)
  6. /src/PrestaShopBundle/Entity/AdminFilter.php

I hope my post helps clarify & structure what you need to do.

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 1 month later...
  • 1 month later...
  • 2 weeks later...
  • 2 months later...
  • 3 weeks later...

Hello, I would like to create a column with the last update as shown in the attached screenshot (most recent status). In version 1.5 I did it, in 1.7.4.4 it is complicated.
Any solution?

 

 

Schermata 2021-02-17 alle 11.06.00.png

  • Like 1

Share this post


Link to post
Share on other sites

  • 1 month later...
Posted (edited)

About solution of Stigz

Its ok for me

Tested in 1.7.7 and its fine. Only problem is with pagination. Just stop work (stack in 20 products and the number of page dont work). 

Any idea? 

Edited by soilets (see edit history)

Share this post


Link to post
Share on other sites

Ok i found the solution for the pagination 

i replace the code at the bottom in file --->  modules/overrideproductslistwithmanufacturer/views/PrestaShop/Admin/Product/CatalogPage/Forms/form_products.html.twig

from this 

<div class="col-md-12">
        {{ render(controller('PrestaShopBundle:Admin\\Common:pagination',
        {'limit': limit, 'offset': offset, 'total': product_count_filtered, 'caller_parameters': pagination_parameters, 'limit_choices': pagination_limit_choices}))
        }}
      </div>

to this

<div class="col-md-12">

        {{ render(controller('PrestaShopBundle:Admin\\Common:pagination', {
          'limit': limit,
          'offset': offset,
          'total': product_count_filtered,
          'caller_route': app.request.attributes.get('_route'),
          'caller_parameters': pagination_parameters,
          'limit_choices': pagination_limit_choices
          })) }}
      </div>

and all its perfect now :)

Share this post


Link to post
Share on other sites

  • 4 weeks later...

The @Stigz option works great on 1.7.6.1 Only had to edit the AdminFilter.php

ps: the only "inconvenience" is that if you want to filter by manufacturer, you have to input the exact name of the manufacturer, it won´t show up anything if you miss a letter. Is there any way to fix it?

Share this post


Link to post
Share on other sites

Im having an error when i use this module, it works fine but some times it get stuck in a filter and when i try to reset the filter , it goes back to the dashboard, i used the debug mode an this is the error i recieved:

 

An exception has been thrown during the rendering of a template ("Parameter "orderBy" for route "admin_product_catalog" must match "last|id_product|name|reference|name_category|price|sav_quantity|position|active|position_ordering" ("manufacturer" given) to generate a corresponding URL.").

 

Someone is having that same issue? by the way , great work @Stigz 

Prestashop 1.7.6.4

image_2021-04-27_185008.png

Share this post


Link to post
Share on other sites

Something like that happened to me and I had to take a backup file of my database and replace some values in the ps_admin_filter.filter

image.png.0abf60162a74870606c150dcbfc5e01e.png

Dunno if it will help, but you can give it a try.

Share this post


Link to post
Share on other sites

  • 2 weeks later...
On 3/23/2021 at 5:24 PM, soilets said:

About solution of Stigz

Its ok for me

Tested in 1.7.7 and its fine. Only problem is with pagination. Just stop work (stack in 20 products and the number of page dont work). 

Any idea? 

I have PS 1.7.7.0 but the module didn't show any column in the products page.

How did you do it ?

Share this post


Link to post
Share on other sites

  • 1 month later...

hello, if I wanted to insert a different column that I have in a different table... how can I do?

ES.
I have an additional table with "id_product" and "date". I would like to insert the "date" column associated with the product, thanks

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 3 months later...