VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: be on December 23, 2012, 16:14:33 PM

Title: Feature request: Customfields should searchable
Post by: be on December 23, 2012, 16:14:33 PM
Hi,
one of the main feature what I miss, is the posibillity to search the custom fields through the Virtuemart Search.
I don´t know if this is a planned feature or in work. But it would bring VM a lot forward.

BR
Title: Re: Feature request: Customfields should searchable
Post by: Milbo on December 23, 2012, 18:47:26 PM
it is already there.
Title: Re: Feature request: Customfields should searchable
Post by: be on December 23, 2012, 19:28:44 PM
Hi Milbo,
okay, this is stunning me, because it doesn´t work on my site. Since which version it is integrated?

As example I have an Custom-Field (Product-field)like here:

<div class="product-field product-field-type-S">
<span class="product-fields-title">Herausgeber:</span>
<span class="product-field-display">H. van Lente et al.</span
<span class="product-field-desc"></span>
</div>


If I wrote "Lente" or "H. van Lente et al." in the Searchfield I got no result.
Actually I have installed the 2.0.12f yet.

BR
Title: Re: Feature request: Customfields should searchable
Post by: Milbo on December 24, 2012, 11:28:48 AM
It is in vm2 since 2.0.0
Title: Re: Feature request: Customfields should searchable
Post by: be on January 03, 2013, 00:09:58 AM
Hi Milbo,
is there a bug inside or have I missunderstood of the search working?
Than it doesn´t work on my site.

I´ll explain what I´m doing if I search hoply you can help me to get this work.
First I want to find the product "testbuch" (title) I wrote "testbuch" in the searchfiel of the virtuemart searchmodule. The Search is finding the "Testbuch".
If I do the same with the customfield-value ,,kunze" (Author) I got the message that no product is found.

You can test it here http://vmart.janstieler.de/ (http://vmart.janstieler.de/)

I hope you can explain me what I´m doing wrong or how I must have configured VMart to get this work?

Best regrad

PS: What I have found additional to add a searchfunctionality for the customfilds is this: http://network.convergenceservices.in/forum/46-virtue-mart/1661-searching-customfields-a-modifying-search-in-virtuemart-20.html (http://network.convergenceservices.in/forum/46-virtue-mart/1661-searching-customfields-a-modifying-search-in-virtuemart-20.html)
But I´m not to good in php-programming to get this work.
Title: Re: Feature request: Customfields should searchable
Post by: user_fra on August 03, 2013, 09:50:07 AM
Quote from: Milbo on December 24, 2012, 11:28:48 AM
It is in vm2 since 2.0.0

Hi, I was not able to find it, please could you kindly help me (and it seems many other people in the forum) to find the right way to make customfields searchable?

Thanks a lot
Francesco
Title: Re: Feature request: Customfields should searchable
Post by: PRO on August 04, 2013, 01:23:22 AM
which custom field is it?
Title: Re: Feature request: Customfields should searchable
Post by: user_fra on August 04, 2013, 10:40:04 AM
Thanks for your interest. I'm talking about an online bookstore, author, year of publication, number of pages, notes.
Regards
Francesco
Title: Re: Feature request: Customfields should searchable
Post by: PRO on August 04, 2013, 23:15:34 PM
Quote from: user_fra on August 04, 2013, 10:40:04 AM
Thanks for your interest. I'm talking about an online bookstore, author, year of publication, number of pages, notes.
Regards
Francesco

are you using the "specification" plugin for these?

Title: Re: Feature request: Customfields should searchable
Post by: user_fra on August 05, 2013, 09:05:47 AM
I do not use any specific plugin, (joomla 2.5 and VM 2.0).

If I create e new product and I use a new custom field Notes filling it with the word example, when i search the word example the result is zero products found. Of course if the name of the product is example in this case the product would be found.
Reading this post it seems that since VM 2.0 the search function includes also custom fields, could you please expalin to me how to make it work?
Many many thanks
Francesco
Title: Re: Feature request: Customfields should searchable
Post by: jjk on August 05, 2013, 15:24:27 PM
@user_fra
You should update to VirtueMart 2.0.22a from here: http://dev.virtuemart.net/projects/virtuemart/files or here: http://virtuemart.net/.
Version 2.0 is already more than 1½ years old.
Title: Re: Feature request: Customfields should searchable
Post by: user_fra on August 05, 2013, 20:18:40 PM
Thank you JJK, now I have joomla 2.5.14 stable and VM & AIO 2.0.22a, clean the cache, unlock tables and so on.

Then I create a new custom field Test, I assign it at one product filling it with a test word, I see the custom field and the word inside it in the product details view (front-end) but if I search the word in the field module Search in shop it does not find it. Of course if I search title of the product it works.

In other words, same problem then before.

Anyway, the web is full of people that has (or had) the same problem, for sure you all know how to handle it, but probably the solution is not so intuitive.

Any suggestions would be greatly appreciated.
Thank you

Francesco
Title: Re: Feature request: Customfields should searchable
Post by: jjk on August 05, 2013, 23:16:55 PM
If I remember correctly, the custom fields are currently not directly searchable from the search module, because the custom fields are not listed as an option in the Configuration > Product Order Settings tab > Available Search Fields. But eventually they should show as an additional search filter on top of the search results after you submitted a search. I didn't play with this for a very long time, so I'm not shure if it works. But I've seen some commercial plugins in the Joomla extension directory for searching attributes.
Title: Re: Feature request: Customfields should searchable
Post by: user_fra on August 06, 2013, 08:05:37 AM
Thanks again for your answer jjk. I looked at all the extensions, but Ii seems they don't have a generic research field. These extensions search in specific fields, they are presented with many search fields (search in Author, search in Notes, and so on). I just wish that in the search engine inside a shop it was possible to find a word that exists in the products. If you have a minute (it takes really a minute) please try to add a custom field in a your test site and see if it works. Also the search in the german site posted in this topic do not work. I have the same situation, but reading Milbo (in this post) and other answers it seems that it should work. It coulb be nice to have a definite answer, if yes how to do it, if not hoping in the next version.
Maybe the solution is very easy, I ask sorry if I'm not able to find it.
Thanks for everything
Francesco
Title: Re: Feature request: Customfields should searchable
Post by: jjk on August 06, 2013, 10:00:35 AM
I just noticed in one of your posts above, that your are going to build a bookstore. So you are probably looking for searchable custom fields like Author, Publishing date, ISBN, etc. Theoretically this should work selecting the 'Select a Plugin' > 'VM - Custom, Product Specification' at the bottom of the 'Custom Field Edit' form.
I just tried, but the search doesn't work for the Specifications. I think, we will discuss this problem some time next week with the developers (This week they are busy doing VM2 Seminars, etc.). I think this did work in the past, but I'm not shure about this.

Meanwhile you could perhaps ask the forum member who provided this link to his bookstore, what kind of solution he used for his bookstore:
http://forum.virtuemart.net/index.php?topic=102847.msg380161#msg380161
He seems to use i.e. a searchable custom field for the ISBN. There are a few more VM2 bookshops in the 'Your Live Sites' forum section, but I didn't look at the others.
Title: Re: Feature request: Customfields should searchable
Post by: user_fra on August 06, 2013, 11:00:13 AM
Thank you again jjk, the greek site you suggested me is wonderful, I had already seen it the post in the forum. So one week ago (maybe more) I wrote to the web agency that made the site, I told them I was ready to pay just to have some advices for my bookstore, but I had no reply yet. I also searched bookstore and bookshop in the forum, now I don't remember very well all of them, but I think I did not see the solution.
This morning I sent a private message also to Milbo, it seems he knows very well how to manege the search in custom fields, I begged him to write the explanation in this post.
Thank you for the time you have dedicated to this issue.

Francesco
Title: Re: Feature request: Customfields should searchable
Post by: jjk on August 06, 2013, 11:41:41 AM
Milbo iis here: http://extensions.virtuemart.net/certifications/certification-of-virtuemart-2-detail this week, so he might not read it. By the way, for a bookshop you could create some Joomla language file overrides, which replace the word 'Manufacturer' with 'Author'. So your customers can at least search for authors. Some examples:

COM_VIRTUEMART_MANUFACTURER_DETAILS="Author:"
COM_VIRTUEMART_MF_NAME="Author Name"
COM_VIRTUEMART_PRODUCT_DETAILS_MANUFACTURER_LBL="Author: "
COM_VIRTUEMART_SEARCH_ORDER_MF_NAME="Author Name"
COM_VIRTUEMART_SEARCH_SELECT_ALL_MANUFACTURER="All Authors"
COM_VIRTUEMART_SEARCH_SELECT_MANUFACTURER="Select Author"
COM_VIRTUEMART_SEF_MANUFACTURER="author"
COM_VIRTUEMART_SEF_MANUFACTURERS="authors"

Title: Re: Feature request: Customfields should searchable
Post by: user_fra on August 06, 2013, 20:29:14 PM
Thanks for the suggestion jjk, I traslated and used the field manufacturer for publishers and it works very well because every book can have only one publisher. The authors can be more than one. I'm not in a hurry, I can wait until the end of August, let's see if in the meantime somebody else will completely clarify the situation.

Many thanks for your help jjk.

Francesco
Title: Re: Feature request: Customfields should searchable
Post by: be on September 10, 2013, 23:48:33 PM
Hi,
here is a actualized /administrator/components/com_virtuemart/models/product.php in this work the customfield search.
I paid a programmer to fix this. It is for the Vmart version 2.0.20b.

In this it is necessary to hardcode the customfield IDs on line269.

Greetz

[attachment cleanup by admin]
Title: Re: Feature request: Customfields should searchable
Post by: user_fra on November 26, 2013, 19:02:27 PM
Thank you very much BE. I read your code, but I prefer to wait for the authors of Virtuemart, hoping they'll make an implementation to the code giving us the opportunity to research a word in the custom fields using the standard search field.

Thank you in any case.

Francesco
Title: Re: Feature request: Customfields should searchable
Post by: Milbo on November 27, 2013, 11:41:07 AM
Thank you Be for sharing this code.

Searching in customfields work. It is just atm so that the user sees this dropdown after the first search. Our idea was to show a template how it works and that they just remove the whole code for it, or the if condition to show it directly.

The idea is that we either prefer in the search the products OR the customfields for a good performance.

=> Enter something in the normal search field => searches all products
or => choose a customfield and search there, means find all products with that customfield which contain the search string.

The code of Be is done in an old model... the difference is that it searches always in customfields hardcoded there. We could solve that with an option later

around line 293 after the foreach loop and before

if (!empty($filter_search)) {


paste this


// if no custom fields where defined to filter for use these hardcoded ones
if(empty($this->searchcustoms)){
          // 4 Herausgeber
          // 6 ISBN
          // 13 Buchreihe
          // 17 Autor
     $custom_ids=array(4,6,13,17);
     $this->searchcustoms=array_fill_keys($custom_ids, $this->keyword);
}
       
// add custom fields to filter array to get an OR condition in sql request
if (!empty($this->searchcustoms)) {
$joinCustom = TRUE;
foreach ($this->searchcustoms as $key => $searchcustom) {
$filter_search[] = '(pf.`virtuemart_custom_id`="' . (int)$key . '" and pf.`custom_value` like "%' . $this->_db->getEscaped ($searchcustom, TRUE) . '%")';
}


Around line 306 search for

if (!empty($this->searchcustoms)) {


and disable the whole if case. For a proper implementation into the core we need some options.

1. display customfield dropdown
a) always
b) like now
c) never

2. search options customfields
a) select customfields to search in
b) search always in customfields with OR or AND link
c) search only in customfields if dropdown is used with OR or AND link
Title: Re: Feature request: Customfields should searchable
Post by: Adam Bazaroff on June 09, 2014, 19:06:13 PM
Sorry about wakeup this topic. But this is a big problem. Anybody have new code or plugin for this kind of search?