Post by djordje » Fri Jan 22, 2021 7:18 pm

Hi everyone,

I'm would like to modify the results that appear when you are entering a name of a product that you wish to set as a related product (img1 in attachment).

More specifically I would like to know if it is possible to display the product ID next to the product name? Or if that is not possible can the search be modified so it recognizes an entered product ID and then displays that name?

Attachments

img1.png

Multiple products have the same name, so an ID would help differentiate them. - img1.png (14.26 KiB) Viewed 234 times

Last edited by djordje on Tue Jan 26, 2021 6:30 pm, edited 1 time in total.

User avatar
New member

Posts

Joined
Fri Oct 14, 2016 4:23 pm


Post by grgr » Sun Jan 24, 2021 5:04 pm

Can do it a couple of way, one of which is to update the ../admin/view/template/catalog/product_form.twig

you are looking for the autocomplete function section:

Code: Select all

  // Related
  $('input[name=\'related\']').autocomplete({
  .....
  .....
Then change this line:

Code: Select all

						  label: item['name'],
into this:

Code: Select all

						  label: item.model + ' - ' + item.name,
You can use item.product_id also.

-
Image Image Image Image
VIEW ALL EXTENSIONS * EXTENSION SUPPORT * WEBSITE * CUSTOM REQUESTS


User avatar
Active Member

Posts

Joined
Mon Mar 28, 2011 4:08 pm
Location - UK

Post by djordje » Tue Jan 26, 2021 6:28 pm

It works perfectly. Thanks a lot!

User avatar
New member

Posts

Joined
Fri Oct 14, 2016 4:23 pm

Who is online

Users browsing this forum: No registered users and 19 guests