How to get image show in smartsearch result(predictive search)?

Jainik Patel asked on January 20, 2017 11:41

How to get image show in smartsearch result(predictive search)?

Correct Answer

Jainik Patel answered on January 23, 2017 13:40

Hello Dragoljub Ilic

Thanks for the Answer.

I have make the custom field as productImage but can not get image with.

<%# Eval("ProductImage") %>

tag.

For Image get I have used following code for search list transformation.

<img src="<%# GetSearchImageUrl("/CMSModules/CMS_SmartSearch/no_image.gif",90) %>" alt="" />

And After Its Working :)

0 votesVote for this answer Unmark Correct answer

Recent Answers


Jainik Patel answered on January 20, 2017 11:42

I will try with following code with transformation but no image found.

<%# GetSearchImageUrl

("~/App_Themes/Default/Images/CMSModules/CMS_SmartSearch/no

_image.gif", 90) %>

<%# GetSearchImageUrl

("/CMSModules/CMS_SmartSearch/no_image.gif", 90) %>

0 votesVote for this answer Mark as a Correct answer

Dragoljub Ilic answered on January 20, 2017 12:53 (last edited on January 20, 2017 12:54)

Hi Jainik,

Check if your image is included in search indexer (go to page type -> search fields and see if image field is checked as 'content' and 'searchable'). If yes, than you can easily read image path with:

<img src="<%# Eval("Image") %>" alt="<%# Eval("DocumentName") %>" />

If not, check that and rebuild your indexer.

0 votesVote for this answer Mark as a Correct answer

Jainik Patel answered on January 20, 2017 13:07 (last edited on January 20, 2017 13:22)

Hi Dragoljub Ilic

Thanks for the Answer.

I try with set page type -> search fields -> Image field: -> SKUImagePath and checked mark the all Content and Searchable.

After put on Smart search transformation.

<img src="<%# Eval("Image") %>" alt="<%# Eval("DocumentName") %>" />

But Not Showing image.

Any other setting for the same ? Its mandatory image field in page type ?

0 votesVote for this answer Mark as a Correct answer

Dragoljub Ilic answered on January 20, 2017 15:24

Hi Jainik,

Do you get any data for image? If you get, and image is broken try to use variant of this method:

GetSKUImageUrl()

If you don't get data at all, than problem is still in you indexer. Maybe to get data with:

<%# Eval("SKUImagePath") %>
0 votesVote for this answer Mark as a Correct answer

Ilesh Mistry answered on January 22, 2017 00:27

Also worth trying <%# GetSearchValue("ColumnName") %>

0 votesVote for this answer Mark as a Correct answer

Jainik Patel answered on January 23, 2017 07:30 (last edited on January 23, 2017 07:42)

Hi Dragoljub Ilic

I set the index as per following image but not get image path during search.

Image 1

Image 2

After try

<%# Eval("SKUImagePath") %>

but not get it image.

Thanks

0 votesVote for this answer Mark as a Correct answer

Jainik Patel answered on January 23, 2017 07:45

I attached images with every product attachement.so Can I get those image path during search transformation ?

0 votesVote for this answer Mark as a Correct answer

Dragoljub Ilic answered on January 23, 2017 09:45

Hello,

This looks fine, but there is many things why can't find that image. I will suggest you, instead of attachments to use media selector field (add custom field on product, f.e. ProductImage), and also mark new field as 'searchable' and 'content'. After that, you can use in your transfomation:

<%# Eval("ProductImage") %>

This will retrive you url that is placed in ProductImage field.

Hope this will help.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.