- Posts: 1195
- Thank you received: 13
Search by code without sumbols
3 years 1 month ago #355628
by verzevoul
Search by code without sumbols was created by verzevoul
-- HikaShop version -- : 4.7.5
-- Joomla version -- : 3.10.12
Hello!
I would like to be able to search by product code like this:
Let's say the product code is 11-22-333, if i put this code in the search box it works correctly. What i want is to add the code without the dashes (-) and still get results, for example 1122333 or 11 22 333.
Thank you
-- Joomla version -- : 3.10.12
Hello!
I would like to be able to search by product code like this:
Let's say the product code is 11-22-333, if i put this code in the search box it works correctly. What i want is to add the code without the dashes (-) and still get results, for example 1122333 or 11 22 333.
Thank you
Please Log in or Create an account to join the conversation.
3 years 1 month ago - 3 years 1 month ago #355632
by Philip
Replied by Philip on topic Search by code without sumbols
Last edit: 3 years 1 month ago by Philip.
The following user(s) said Thank You: verzevoul
Please Log in or Create an account to join the conversation.
3 years 1 month ago #355664
by verzevoul
Replied by verzevoul on topic Search by code without sumbols
Hi!
I did it but it's not working. I need the search filter to apply to titles also not just code.
Thank you
I did it but it's not working. I need the search filter to apply to titles also not just code.
Thank you
Please Log in or Create an account to join the conversation.
3 years 1 month ago #355667
by nicolas
Replied by nicolas on topic Search by code without sumbols
Hi,
There is no option to dynamically apply modifications to the texts being searched.
What you need to do is to create a custom field of the table "product" and of the type "text" or "textarea" where you can enter the product code without the dashes. Then, in your filter, also select that custom field and you'll find results for the product code without the dashes.
And you can also create a mass action to automatically fill the custom field with the product_code without the dashes with a mass action of the type "update the values" on the column of the custom field with the "operation" mode and the value:
(not tested)
There is no option to dynamically apply modifications to the texts being searched.
What you need to do is to create a custom field of the table "product" and of the type "text" or "textarea" where you can enter the product code without the dashes. Then, in your filter, also select that custom field and you'll find results for the product code without the dashes.
And you can also create a mass action to automatically fill the custom field with the product_code without the dashes with a mass action of the type "update the values" on the column of the custom field with the "operation" mode and the value:
Code:
replace({product.product_code},'-','')
Please Log in or Create an account to join the conversation.
3 years 1 month ago #355719
by verzevoul
Replied by verzevoul on topic Search by code without sumbols
Hi!
I created the custom field and did the filter as you said but the mass action didn't work.
The value of the custom field after i ran the mass action is 0.
Could you check the screenshots if everything is correct?
Thank you!
I created the custom field and did the filter as you said but the mass action didn't work.
The value of the custom field after i ran the mass action is 0.
Could you check the screenshots if everything is correct?
Thank you!
Please Log in or Create an account to join the conversation.
3 years 1 month ago #355725
by nicolas
Replied by nicolas on topic Search by code without sumbols
Hi,
I would recommend doing it with a normal mass action (with a filter on the product_id to target only one product first) and see if you get any error when you run it.
Otherwise, you could also try running a MySQL query directly in the database via PHPMyAdmin. Something like that:
I would recommend doing it with a normal mass action (with a filter on the product_id to target only one product first) and see if you get any error when you run it.
Otherwise, you could also try running a MySQL query directly in the database via PHPMyAdmin. Something like that:
Code:
UPDATE #__hikashop_product SET search_column = replace(product_code,'-','');
The following user(s) said Thank You: verzevoul
Please Log in or Create an account to join the conversation.
Time to create page: 0.065 seconds