- Posts: 79
- Thank you received: 3
Text filter on categories
-- Joomla version -- : 3.2.3
-- PHP version -- : 5.3.3
Hello.
Is there any way to do a filter on categories with a text field ?.
Let me explain myself, I have a book store and I use categories to set the book Authors in order to prevent repeat authors names and because we need set filters by author. We have more than 200 diferent authors and nothing but Text type is valid for us due to number of categories we have.
All what we need is a filter that applies like category search at categories section in the backend. Is it posible?
Regards
Please Log in or Create an account to join the conversation.
Filters only works on products listings, not categories listings. So you won't be able to do that we a category filter.
What you can do however is to configure the HikaShop Categories search plugin via the Joomla plugins manager and enable the Joomla search module.
That will allow you to have a search on the categories on the frontend with a text box and you'll then be able to click on the categories found in order to display the products of the category.
Please Log in or Create an account to join the conversation.
I look for it at my Joomla Modules and Hikashop Modules but I can't find it.
Regards
Please Log in or Create an account to join the conversation.
If you don't see it, just click on the "new" button there and select the Joomla search module in order to create a new instance for it.
Please Log in or Create an account to join the conversation.
Correct me if I'm wrong, but your solution implies to use two independent searches one for products and one for categories (joomla search)?.
But what I need is a combined search (combined_search.jpg) in which a user can refine searches typing multiple search criteria.
I need to aply for authors a filter like:
select ... where category like '%...%' ...
instead of:
select ... where category = '...' ...
that it seems to use when you select a category in a drop down list.
Can I modify/generate some code to do this?
Regards
Please Log in or Create an account to join the conversation.
For sure you can modify the HikaShop core if you want to add your specific features but the best is still to add features using overrides/plugins so you will be able to update HikaShop and keep your plugins/overrides.
You can use a trigger like "onBeforeProductListingLoad"
www.hikashop.com/support/support/documen...reProductListingLoad
For the query you wrote ; it's a little more complicated than that because a product ca be in several categories.
The HikaShop queries are using the table "hikashop_product" and the table "hikashop_product_category" ; but we generally do not link to the table "hikashop_category" in order to minimize the table joins (and keep queries as fast as possible).
Because we generally filter on the category_id ; we do not need the table "hikashop_category".
So if you want to add your special filter on some category fields, you need to join an extra table and add your specific filters.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Regards.
Please Log in or Create an account to join the conversation.
When I tried to do a plugin based on your explanation I found several problems and I changed the approach to my problem.
Instead of doing a search plugin, I add a custom field to my product table in order to do a filter based in this custom field. Then, I developed a product plugin based on "onBeforeProductCreate" and "onBeforeProductUpdate" triggers, in wich I look for authors categories, and concatenate its "category_name" fields saving this value in my custom field as you can see in next code:
It works perfectly when I create or modify a product in the backend, but when I import products from a CSV file, it doesn't work.
My question:
Is there any trigger that I can use in my plugin to do the same operation when imports products?
Thanks in advance
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Can I program a mass action plugin to do this action with every product after import from a CSV file?.
If answer is wes, what functions may I program?
Note I want to do the actions I have described before, with all products (I think, I don't need filters)
In addition, looking for information, I see /plugins/hikashop/massaction_product/massaction_product.php file and inside this code I found "onBeforeProductCreate" and "onBeforeProductUpdate" functions.
Are these the functions wich I shoud override in my mass action plugin?
Thanks in advance.
Please Log in or Create an account to join the conversation.
You can program a mass action plugin to do that yes.
I invite you to check the different massaction plugins that are installed with HikaShop (one in the system group, the others in the hikashop group) where you'll see the several functions that can be implemented for the mass action system.
First, you'll want to implement the onMassactionTableActionsLoad(&$table,&$actions,&$actions_html,&$loadedData) trigger and just have one line of code in that function:
$actions='My custom action';
Then, you'll want to implement the onProcessProductMassActionmy_custom_action(&$elements,&$action,$k) trigger where you'll be able to add your code in order to update the data of the products with a MySQL update query.
Please Log in or Create an account to join the conversation.
Regards
Please Log in or Create an account to join the conversation.
Thanks again.
Please Log in or Create an account to join the conversation.