I've added some tags in some of the products I have, but I can only see the option to add them to a "Tag Cloud".
Is it possible to make the search box also search products by tag?
I've added some tags in some of the products I have, but I can only see the option to add them to a "Tag Cloud".
Is it possible to make the search box also search products by tag?
I've added some tags in some of the products I have, but I can only see the option to add them to a "Tag Cloud".
Is it possible to make the search box also search products by tag?
Unfortunately it is not possible out of the box. You should extend the fn_tags_get_products function (app/addons/tags/func.php)
Search query is stored in the $params['q'] variable
Ah alright, thanks.
Unfortunately it is not possible out of the box. You should extend the fn_tags_get_products function (app/addons/tags/func.php)
Search query is stored in the $params['q'] variable
Sorry to bother again but it's been days and i can't seem to get this search by tag function to work.
I can see the addon function you mentioned before:
So it would be a query like this right? (the second part)
Since i want to limit it to customers area, I added the C check.
But should it be an inner join to also get products which have the q condition?
I'm super confused
function fn_tags_get_products(&$params, &$fields, &$sortings, &$condition, &$join) { if (Registry::get('addons.tags.tags_for_products') == 'Y') { if (isset($params['tag']) && fn_string_not_empty($params['tag'])) { $join .= db_quote(" INNER JOIN ?:tag_links ON ?:tag_links.object_id = products.product_id AND ?:tag_links.object_type = ?s", 'P'); $join .= db_quote(" INNER JOIN ?:tags ON ?:tag_links.tag_id = ?:tags.tag_id ?p", fn_get_tags_company_condition('?:tags.company_id')); $condition .= db_quote(" AND (?:tags.tag = ?s)", trim($params['tag'])); if (AREA == 'C') { $condition .= db_quote(" AND ?:tags.status = ?s", 'A'); } } if (isset($params['q']) && fn_string_not_empty($params['q'])) { if (AREA == 'C') { $join .= db_quote(" INNER JOIN ?:tag_links ON ?:tag_links.object_id = products.product_id AND ?:tag_links.object_type = ?s", 'P'); $join .= db_quote(" INNER JOIN ?:tags ON ?:tag_links.tag_id = ?:tags.tag_id AND ?tags.tag = ?s", $params['q']); $condition .= db_quote(" AND ?:tags.tag = ?s", $params['q']); } } } return true; }
Try to use left join instead of inner one for this kind of search