WebsiteBaker Support (2.12.x) > General Help & Support

Search for different variations of characters (a, á, à...)

<< < (4/5) > >>

Gast:
bakery_search/frontend_body.js was loaded on "the wrong place". in the actual script it will be loaded before JQuery is loaded

read the answer again

--- Quote from: jacobi22 on May 28, 2019, 10:18:02 AM ---Add this line as last line before this line with </body> (nearly at the end of the code from index.php of the used template)


--- Code: ---<?php
// if you want to include jquery before body end,
#register_frontend_modfiles_body('jquery');
// automatically include optional WB module file frontend_body.js) should be always set
register_frontend_modfiles_body('js');
?>
--- End code ---

--- End quote ---

svsanchez:
Hello Jacobi, thank you for that, I had missed the "last line before </body>" part. After moving the code to the correct place, the search seems to work, however it still shows the results in a dropdown manner instead of the standard search results page.

How do I change that?

svsanchez:
Hello, I am still trying to get WB to search for both accented and unaccented characters. I had already fixed this in WB 2.8.3, but it got broken after the upgrade to WB 2.12. The way it had been fixed was through a file named search_convert.php and search_convert_loca l.php

Crnogorac's plugin does the trick, however it shows the results on a dropdown and we need to show the results in the normal WB search results page so that they show all the information and can also be printed.

How do I tell the search function to show the search results in the normal WB search results page?

Gast:
(google translation)
the normal case: in WB the complete search is handled by the files in the folder / search.
Each module included in the project, which has a search.php file, prepares the records for it, that is, all the records for that module, regardless of the search term.
An example from me: Foldergallery - Image Search. I use keywords there, a period from - to, a title, a description, the picture category.
The search.php from the FG searches now all images from the database, plus the category, description, keywords, period. - and build a list. This list is sent to search / index.php, which compares all of my listed data with the search term and then filters out the relevant records.
This means that the intervention you have in mind can only be made in the files in the / search folder. There are already in the file search_convert.php or search_convert_ul.p hp such conversions as those Crnogorac makes in its file ajax.php, but in the originial only for the ecaxt letters, not for different variations

In the module bakery_search Crnogorac goes a different way. It generates its own output of the search results there and does not send this data to the search module.

The simplest and most sensible solution from my point of view would be to extend the search_convert..php with the missing parameters. But if this is not done by the developer, the next upgrade will be lost again.

The question is: why does it have to be the WB search for you?
At the beginning I suggested to integrate the search field of Crnogorac or this module above your bakery-sections. Then you have your shop pages as a "background" and the search hits from BakerySearch via Ajax on top of it.
On the current test page, it looks a bit empty of course because nothing else is there

Gast:
from my point (and dont forget, i'm not a developer)

/search / search_convert_ul.p hp

there, you have an array $search_table_ul_umlauts with definitions like this


--- Quote ---"\xc3\xb3" => "(\xc3\xb3|\xc3\x93)",
--- End quote ---

the red part in front of the line is utf8-literal for a special char, in this case for Ó

the second part are the possible matches in the search term

\xc3\xb3 = ó (lower letter)
\xc3\x93 = Ó (upper Letter)

the red pipe between the chars means = or

a better example

--- Quote ---\xc3\x9f" => "(\xc3\x9f|SS|ss)
--- End quote ---

ß is a german special char and means ss
the example means (in simple words) search for a match with ß or ss or SS

Use this List to found your needed special chars (for example = à), read in this line the utf8-literal value (= \xc3\xa0)

search for this literal in search_convert_ul.p hp and remember the line ( in my version WB 2.12.2!) in line 42 with

--- Quote ---"\xc3\xa0" => "(\xc3\xa0|\xc3\x80)",
--- End quote ---
two allowed chars - à in lower and upper form

now search in the list for your favorite different variation for this char, copy the literal and add it with a pipe to the definition in search_convert_ul.p hp
for example for à, á, â, ã, ä À, Á, Â, Ã, Ä
these is the definition of the upper and lower letter

--- Quote ---"\xc3\xa0" => "(\xc3\xa0|\xc3\xa1|\xc3\xa2|\xc3\xa3|\xc3\xa4|\xc3\x80|\xc3\x81|\xc3\x82|\xc3\x83|\xc3\x84)",
--- End quote ---

you have to change also the definition of the upper letter and this for every wished variation of a letter

tip:
- make a copy of this file search_convert_ul.p hp, rename it as (for example) search_convert_ul_t est.php
- search on this page in the list your favorite letter
- remember the literal from this list and search it in your copied file
- copy this line and add it directly in the next line, deactivate the first definition with a double slash in the front of this line, so that you have the untouched original code
- now add the variations like my example, for the variation of a in 10 lines

to test it, change this filename in search.php, Line 244

--- Code: ---require_once(WB_PATH.'/search/search_convert_ul.php');
--- End code ---

for a first test, i think, it is enough, to work with only one single char and his variations

P.S.: search.php has the possibility to add a own file, called search_convert_loca l.php, i think, this is a place for own definitions, but i dont have a example for a file like this




Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version