Closed (fixed)
Project:
Finder
Version:
6.x-1.x-dev
Component:
Finder Autocomplete
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Dec 2010 at 11:18 UTC
Updated:
24 May 2011 at 16:53 UTC
I have a problem with my autocomplete result suggestions. I like to place a product image in the search result suggestion. Right now I have the following code:
function genesis_studion_finder_autocomplete_suggestion($option, $finder_element) {
return $option->{$option->field_product_afbeelding};
$node = node_load($option->nid);
$teaser = node_view($node, $teaser = TRUE);
return $teaser;
}
field_product_afbeelding is the name of the cck image field //
The above code I always get an HTTP 500 error. It seems that it does not find field_product_afbeelding.
Comments
Comment #1
danielb commentedYou will need to debug the $node to find the data you're looking for
Don't add the field to your finder element, btw, unless you want people to search for the path of the image
Comment #2
danielb commentedComment #3
frankspin commentedUnfortunately it still does not work properly.
I've tried different things
1. Teaser with the following code:
* Yes, i use a different theme.
With this code I get only a blank node. This option respects not my .tpl structure. I have a product (node product.tpl.php) and an accompaning product teaser (node-product--teaser.tpl.php). Views2 respects this structure can and show the teasers properly.
I then tried to put in my node.tpl.php a reference to the right .tpl file. I did this with the following code:
This seems to work, the tpl file is loaded. Only there is a weird problem.
It looks like the contents of the tpl file is completely thrown away. Therefore I tried a static text at the top in my node-product--teaser.tpl.php file, insert between the h1 tags.
(<h1> This is a test title </ h1>)To my surprise I get results now with the autocomplete finder.When I search on the title of my node, in my case: Red Car. The autocomplete popup box shows the text "This is a test title" see. When I click on I get the result: Red Car.
I'm actually completely lost.
Edit.
This is the content of my node-product--teaser.tpl.php file.
If I import a search term into the AutoComplete box finder I only get to see the word test. If I click on the word test, I will be referred to the correct result.
Comment #4
frankspin commentedMore information
I now have the following code in my tpl file.
If I am using the finder (url:
finder/3/Red car)I get this result:
But through the auto complete box I get this result:
Comment #5
frankspin commentedIs there someone who want to install this feature for a small fee?
Comment #6
danielb commentedSorry mate, I've given all the help I can. It should be possible to do if you understand the data in the node object. You might find more help from the community with theming.
Comment #8
kaido.toomingas commentedThats how I did :)
Put this code to your template.php file and replace MyTemplateName with YourTemplateName and field_MyImage with your cck field name. This code will als include node title after this image. And links the whole stuff the this node.
Comment #9
vlooivlerke commentedI like this last bit of code but I use a view.
how will it work on a view finder?