Question asked elsewhere relates to adding other SBA created fields to product searches. For example, there is a description field added to the admin area and the user would like to have that content searchable.
A while back a new auto loading observer class was added to the catalog side to support searching the custom ID. This can be further modified to include other SBA/PWAS fields.
The file in question is: includes/classes/observers/auto.advanced_search_categories_custom_id.php
A duplicate file name could possibly be created for the additional content but also the file name could be changed. Really would suggest making good notes in the file.
Anyways, around line 166, there is/ was this code:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . "
WHERE customid LIKE '%:keywords%')";
The permalink was:
https://github.com/mc12345678/Stock_....php#L166-L169
Anyway, that snippet specifically retrieves product ids that have a custom ID containing or like the keywords searched.
Data in the SBA/PWAS table can be added to that parenthetical group for searching. I would suggest though adding an alias to the table to prevent potential version differences from bringing out some sort of conflict.
So first would change that to:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE pwas.customid LIKE '%:keywords%')";
Then to aid in expansion I would break some of the content so that endings are on their own line. This way, new code is both easier to add and easier to find when added.
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE
pwas.customid LIKE '%:keywords%'
)
";
And then add the requested information:
Code:
$where_str .= "OR p.products_id
IN (SELECT products_id
FROM " . TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK . " pwas
WHERE
pwas.customid LIKE '%:keywords%'
OR pwas.title LIKE '%:keywords%'
)
";
I note that while in the admin screen the column is shown as a description, the database field name was title and also that the base installation supports basically 100 characters.
I'm also aware others have added fields to that table in support of whatever additional features they've added. I would expect a similar error to include those additional fields in the search.
Bookmarks