MX Site Search Forum :: TIP: Get more info from a search result, like a thumbnail...

This thread was displayed: 366 times


Starting with 17th May 2007, Adobe Systems will stop offering support for any version of the discontinued InterAKT products. As a result, we will not answer to new support incidents starting with May 17th, 2007. Pending support incidents will still be followed in order to be closed. The product forums will remain open and be transformed in user-to-user forums. The general forums will be made read-only and not allow new posts or comments.

For more information about the affected products visit: www.interaktonline.com/Support/

View Threaded Show all Show descending
bmx269
02-21-2006 23:21:56 GMT +2
I was strugling to figure out a way to show a thumbnail image in my search results, then it hit me. Here is my work-a-round as it were:

Create your search with the "Title" field using the unique id for the item in the search table. In my case it is my item_id.

Create a element that uses the title to pull the item_id like the following, then create a recordset that finds the item you recieve for the results by finding the "item_id". This MUST be in the repeat region for the result, in the sample text, I put it in the same markup so it is easy to read. Then for your results put the fields you want to display in the results table.

< ? php do { */
$item_id = $row_rsSearchParts['title_cah'];

The query: "SELECT * FROM inventory WHERE inventory.item_id = '$item_id'";
?>


Sorry I could not post all the code, it tries to run it. If you can help me quote it, then I can post it better. If you need help with this or my tip just sucks to follow, please post and I will try and help.

-Trent
digitalgumball.com
Back | Reply | Quote | Top
Florin CARLIG[InterAKT]Adobe Systems Romania staff
02-22-2006 17:44:41 GMT +2

Hello Trent,

Thank you for this post, it might help other users who will desire this feature.

Regards,
Florin CARLIG

Reply | Quote | Top
bmx269
02-24-2006 01:27:19 GMT +2
Please post your comments or questions, I am glad to help.

-Trent
Reply | Quote | Top
Jonathan Fuller
03-28-2006 07:52:23 GMT +2

I was wondering if you had any suggestions on retaining all the information in the table for viewing on the results table.  Example:

I have a table with profile information. I would like the results to display the name, image/thumbnail, e-mail address, etc.

The solution as it were seems on the tip of my brain but illudes me. Any help is appreciated.

Reply | Quote | Top
bmx269
03-28-2006 19:36:39 GMT +2

OK,

There are some points that I may have forgot to mention to make the TIP work smooth. The tables you are searching, actually its a good tip for table structure, must have 2 identifiers. The first is the PRIMARY being say "id" and that is an auto incremented integer. The second is a UNIQUE item. This is the KEY to making the search work, and I feel it is best to have a structure like that anyways. The MX Search plugin will not allow you to select the PRIMARY item as a title lets say, but if you have a second unique item, that is just as good as the PRIMARY key. For my table, it is for a parts catalog. I have the table auto assigning the id, but have the part number as the UNIQUE "item_id". That "item_id" can relate to other tables in the database, for say sales history, etc. 

Now back to the results. You want to put the title as the UNIQUE item, and then test the results. You should get, like in my case, the "item_id" or whatever you called the field, as the title. This means you now can make more querys based on the info passed to title. The rest is simple. You want to look at the code, and see where the repeat region for the search results is. You will be doing all your work INSIDE that area. That way EACH time the query gives a new result, your additional querys and functions are run. So now you want to make a function that calls the title result so you can use it. Like this:

$item_id = $row_rsSearchParts['title_cah'];

Now you NEED this to be inside the php tags after the "php do { */" part. You can start new php tags or just put the code into the one at the start of the search results repeat region. Next add a recordset, this one is using the UNIQUE info passed as the title and now being called what you called it in the function above, in my case I called it "$item_id" as it is easier to problem solve if stuff is labelled what it is. :) So your query or possible mutilple queries can say something like " SELECT * FROM parts WHERE item_id = '$item_id' AND display = 'Yes' ORDER BY price ASC " for example. Test it to make sure the code is correct. You will not get results, just no errors is what we are looking for. Then click ok. Done right, wrong. The recordset is automatically added after the last query, which is usually above the < head > tag. Select the whole query block and move it to the code we added above. It MUST be after the added function otherwise it will not have the info to fill the query from the title results. This all stays in the php tags in the repeat region. You now can use that recordset or more if you need mutiple sources of information to create you search results. Layout is up to you, just has to stay in that repeat region. 

If you are still stuck, you can email me directly with your code, and I will take a look for you. It is pretty simple once you understand that the key is to use the parts given for more than they were intended, and create your own results. 

Let me know how it goes. If there is enough demand I will make a proper step by step with pictures.


-Trent         trent at digitalgumball.com

Reply | Quote | Top
bmx269
05-02-2006 22:11:12 GMT +2

Over 162 views and no comments or questions... 

If this worked for you, please post. I would like to help out, but only if people show appreciation for the help. Sure we may be making websites for business, but that does not mean that we don't share. If I have no feedback, especially if you have used my tip or it helped you, I will be forced to remove my tip and not help out people on this forum further without invitation.

Thanks.

Trent 

Reply | Quote | Top
Jonathan Fuller
05-02-2006 22:37:05 GMT +2

Worked great.  Thanks again.

Reply | Quote | Top
Florin CARLIG[InterAKT]Adobe Systems Romania staff
05-03-2006 11:32:26 GMT +2

Hello Trent,

I just want to thnk you again for this tutorial post. I'm sure other users (like Jonathan here) have found your post helpful. There is no need to remove it (or edit it for that matter).

I will also make it sticky (a little feature we have in the admin section) so that it is displayed first in the list.

Again, thank you for your help - it's most appreciated.

Regards,
Florin CARLIG

Reply | Quote | Top
bmx269
05-03-2006 18:31:32 GMT +2

Thank you both for your feedback. I just feel that if no one appreciates the tip, why share. If you plan on sharing it as a sticky, let me make a proper step by step, where I can proof it, I may have repeated things and went on and on, making it hard to follow. It just flows out of my mind that way. :) Damn the designer mind. 


-Trent

Reply | Quote | Top
Florin CARLIG[InterAKT]Adobe Systems Romania staff
05-04-2006 16:20:20 GMT +2

OK, if you want you can make a step by step instruction tutorial and publish it on a site and the give us the URL.

Regards,
Florin

Reply | Quote | Top
Frederic Bergugnat
06-04-2006 17:38:26 GMT +2

Just reopening this thread to say that it works for me , I used the tip , well... I never had the idea to put a recordset in a repeat region , but now it's clear you can display anything including records from JOIN Tables .

Thanks for sharing...

Reply | Quote | Top
MX Site Search 1.8.0
© Adobe Systems Romania. All rights reserved.