-->
Welcome, Guest
Username: Password: Remember me
You can also tweak your setup of Dolibarr by setting hidden configurations found in Dolibarr Setup Other

TOPIC: SOLVED: Search all criteria in Complementary attributes

Search all criteria in Complementary attributes 1 year 9 months ago #31620

  • Withheld
  • Withheld's Avatar
  • OFFLINE
  • Expert
  • Posts: 124
  • Thank you received: 32
  • Karma: 9
Hello everyone!

We have about 20 Complementary attributes in the Products and Services module but when searching e.g. C3” @ 4.1# in Products or services, I do not get any results from label "Size NOM. (Inches)" Attribute code "siznomin".

However, I do a search criteria message, 'C3” @ 4.1#' into fields Ref., Ref. supplier, Product label, Description, Note, Bar code.

We have under 5000 products and would like to know, is there is a way to expand search criterial to all Products Complementary attributes?.
The administrator has disabled public write access.

Search all criteria in Complementary attributes 1 year 9 months ago #31643

  • Withheld
  • Withheld's Avatar
  • OFFLINE
  • Expert
  • Posts: 124
  • Thank you received: 32
  • Karma: 9
To add custom search criteria for Complimentary attributes, locate /htdocs/product/list.php and around line 129 you'll see
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
	'p.ref'=>"Ref",
    'pfp.ref_fourn'=>"RefSupplier",
	'p.label'=>"ProductLabel",
	'p.description'=>"Description",
    "p.note"=>"Note",

Enter your Product's Complimentary Attributes in the oder you'd like but extactly as shown here 'YourAttributeCode'=>"Your Label",

Also, remeber that using wildcards may not work well. Example if searching multiple attribubes like "Primered 4'x8'x1/4" Steel" you should try Primered 4 8 1 4 Steel to narrow searches.

Another thing to remeber, if you upgrade, you may have to update list.php again so keep these in a text file under the products directory.
The administrator has disabled public write access.
The following user(s) said Thank You: planpc, aljawaid, diybiscuits

Search all criteria in Complementary attributes 1 year 9 months ago #31645

  • aljawaid
  • aljawaid's Avatar
  • OFFLINE
  • Moderator
  • Learning to be open, one source at a time.
  • Posts: 726
  • Thank you received: 117
  • Karma: 14
Thank you, that really helped a lot!

FYI, on my v5.0.4, this is how it looks and works perfectly:
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
	'p.ref'=>"Ref",
    'pfp.ref_fourn'=>"RefSupplier",
	'p.label'=>"ProductLabel",
	'p.description'=>"Description",
    "p.note"=>"Note",
    'ef.pricetag'=>"Price Label",
    'ef.bulkbarcode'=>"Bulk Barcode",
);

ef.pricetag = custom field
ef.bulkbarcode = custom field
The administrator has disabled public write access.
The following user(s) said Thank You: Withheld

Search all criteria in Complementary attributes 1 year 9 months ago #31661

  • Withheld
  • Withheld's Avatar
  • OFFLINE
  • Expert
  • Posts: 124
  • Thank you received: 32
  • Karma: 9
Glad it worked aljawaid! We're using 6.0.3 and now, our search works as expected with the 20 complimentary attributes.
The administrator has disabled public write access.
Time to create page: 0.059 seconds