The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 21 posts ] 
Author Message
PostPosted: Mon Aug 03, 2009 10:07 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon May 18, 2009 8:25 pm
Posts: 33
How can I have image thumbnails show in site search results?
Thanks in advance for any info.


Top
 Profile  
 
PostPosted: Mon Aug 03, 2009 10:18 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
I'm not sure if there are any plugins to do this, but I needed this for my site, and hacked it in (in my typical way).
It was a fair amount of work, both because I needed to extend the search through an indirection, then needed to classify the results depending on the section.
You can see the results by doing a search on my website (it's in my profile). Search results are broken down into 3 areas: Artworks/Artist Profiles/Documents
the output from the search is generated by
components/com_search/views/search/tmpl/default_results.php

I'm sure this can be overridden through the template, but I didn't do that.
I had to store the article id in the search results so I could get the actual article with all the info I needed.
The search plugin for the content is here:
plugins/search/content.php
I modified the sql query to include the extra fields I needed (id and catid without the :textindentifier).


Top
 Profile  
 
PostPosted: Mon Oct 12, 2009 4:44 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 21, 2008 12:25 am
Posts: 5
Hi,

slysmiles - your site search page looks great, that's what I'm in the process of trying to do but slightly differently. If I can't get what I want then your way is the way forward for me too...

I've got three components (hot property, virtuemart and auction factory) and I want a search page that brings up all three sets of results with thumbnails (and prices). Fairly straightforward stuff, but the sorting doesn't work globally (sorting is at sql level so the three queries will always be presented independently). The only option I can put forward at the moment is to use merge_array or similar after the queries are completed, then throw in a PHP based sort instead of the sql method - the php sort is looking tricky at the moment unless you have any other suggestions?

Failing that then yes the three tabbed approach is the next best solution for me, it's a good workaround that I hadn't considered so thanks for that!

This kind of search would be great for sites in the Amazon style, where you've got new products (VM) alongside user-owned products (HP), sorted price descending, so if anyone else is looking for this kind of function drop me a pm in a couple of weeks to give me time to get it working.

cecilbadlands - the files that slysmiles suggests are where you want to be looking at for sure. Worth mentioning that if the image url is stored in a database anywhere, this task is fairly straightforward with some basic php and mysql skills, but if the image you want to show is just held within the article text then you'd need some kind of routine to pull this from the data which would be more involved.

EDIT - recent Joomlart templates tend to include a latest news module which pull the first image from your article text, this would be a good place to start looking to see how to do that if that is the case with your situation.


Top
 Profile  
 
PostPosted: Mon Oct 12, 2009 5:40 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon May 18, 2009 8:25 pm
Posts: 33
Hi Chris, I got around my problem with Phoca(gallery & downloads). Since my site deals with images but the downloads are zip files, I display(and search) the images but the download link is to the zip file which contains several vector image files. I couldn't do this before because of software limitations on the host's servers.


Top
 Profile  
 
PostPosted: Mon Oct 12, 2009 5:52 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed May 21, 2008 12:25 am
Posts: 5
Hi,

I've used Phoca a few times and it's my preference for when I need a gallery, that sounds like a neat workaround for what you needed to do.

That's the best thing about Joomla, no matter what you try to throw at it there always seems to be an extension that provides the answer, it's just a question of how close the extension is to your requirements and how much you need to modify it.

Glad you got it sorted anyway!


Top
 Profile  
 
PostPosted: Mon Oct 12, 2009 10:08 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Thu Jul 09, 2009 5:10 pm
Posts: 110
Location: Southsea, UK
pdschris wrote:
slysmiles - your site search page looks great, that's what I'm in the process of trying to do but slightly differently. If I can't get what I want then your way is the way forward for me too...

Thanks :)
Sometimes you need to make some changes to get what you want, the beauty of open source :)

pdschris wrote:
I've got three components (hot property, virtuemart and auction factory) and I want a search page that brings up all three sets of results with thumbnails (and prices). Fairly straightforward stuff, but the sorting doesn't work globally (sorting is at sql level so the three queries will always be presented independently). The only option I can put forward at the moment is to use merge_array or similar after the queries are completed, then throw in a PHP based sort instead of the sql method - the php sort is looking tricky at the moment unless you have any other suggestions?

The sort should be quite trivial in php. Just get the queries from the different tables, and loop through them and pop them into an output array. I've not played too much much with php sorting, but if it's anything like other sort functions there's a callback function where you put your test code in (price, date, whatever)

pdschris wrote:
Failing that then yes the three tabbed approach is the next best solution for me, it's a good workaround that I hadn't considered so thanks for that!

I needed a clear separation of information, so it was ideal for me. I used the tabs and sliders in content, and had to do a bit of magic to get it working in the search results (not pretty)...


Top
 Profile  
 
PostPosted: Sat May 08, 2010 1:26 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat May 08, 2010 1:22 pm
Posts: 16
hi. I've finally found a way to view product thumbnails in joomla search results.
The only condition is to have Virtuemart Extended search plugin which you can find in VM package.

These text is translated by Google, cause it was previously written by me in polish language.
I hope its not so bad to understand:

Here's how to make the search results to see thumbnails of Joomla Virtuemart products:

0th For we have worked Virtuemart plug-in installed Extended Search plugin, which is located by default in the package with the installation of VM!

1st We go to COMPONENTS \ COM_SEARCH \ views \ SEARCH \ tmpl \ default_results.php.

2nd We find a line number. 34 which looks like this:

<? Php echo $ result-> text;?>

and we add to it:

address to the folder thumbnails + call. At my call variable thumbs:

3rd<img src = "http://www.ADRESSKLEPU.pl/components/com_virtuemart/shop_image/product/<? php echo $ result-> thumb;?>">

$ Result-> thumb invented himself. They just have to cover with what type of call.

We now move to the file:

Plugins \ SEARCH \ vmxsearch.plugin.php

and find the line 149 by adding to it the text that pogrubiłem:

p.product_s_desc AS text, p.product_thumb_image AS thumb,

If everything came out correctly, you'll see thumbnails of the product description below for search results! Setting the thumbnails to the text will leave for you :)

-----

Added 10 later:
And how to make thumbnails link back to the original size of images?
How to add a link to product thumbnail of virtuemart in joomla search results?

<Img src = "http://www.ADRESSKLEPU.pl/components/com_virtuemart/shop_image/product/<? php echo $ result-> thumb;?>">

<A> add a link to the parameter $ result-> twojanazwaparametru, which must match the file vmxsearch.plugin.php; I called FULLIMG variable, ie I have:

namely:

4th

<A href = "http://www.ADRESSKLEPU.pl/components/com_virtuemart/shop_image/product/ <? Php echo $ result-> fullimg ;?>">

<Img src = "http://www.ADRESSKLEPU.pl/components/com_virtuemart/shop_image/product/<? php echo $ result-> thumb;?>">

</ A>

vmxsearch.plugin.php file in the code I added (blue):

5th p.product_s_desc AS text, p.product_thumb_image AS thumb, AS p.product_full_image fullimg,

Here's the post on my blog ; please visit it just to say thanks in comments :)
http://www.vsx.pl/virtuemart-miniaturki-w-wynikach-wyszukiwania-virtuemart-search-thumbs-thumbnails/


Top
 Profile  
 
PostPosted: Sat May 08, 2010 3:01 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon May 18, 2009 8:25 pm
Posts: 33
This certainly looks like an interesting idea, but I am looking for a way to display thumbnails in search results for Phocagallery and Phocadownload.
Thanks for the info, I'll set this aside in case I need it.


Top
 Profile  
 
PostPosted: Sun May 09, 2010 10:53 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat May 08, 2010 1:22 pm
Posts: 16
maybe its possible to follow similar way to get thumbs from Phoca? Is there a system plugin for phoca search? have you tried to analyze it?


Top
 Profile  
 
PostPosted: Sun May 09, 2010 9:14 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon May 18, 2009 8:25 pm
Posts: 33
I'm not a programmer, so beyond copy and paste I'm not much good. I can copy the excellent work of others more capable than I.

Regards,
cecilbadlands


Top
 Profile  
 
PostPosted: Mon May 17, 2010 8:51 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Mar 16, 2010 7:25 am
Posts: 14
Thank you so much pyby! Your solution worked perfectly. To anyone who stumbled upon this thread looking for a way to display thumbnails in the search results, pyby's solution is the only one I found that will display Virtuemart product thumbnails in the search results.


Top
 Profile  
 
PostPosted: Thu Jun 10, 2010 12:08 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat May 08, 2010 1:22 pm
Posts: 16
I have also solution for product prices in search results. Its a bit more difficult, cause the prices are not in the product table. If you want me to write down a solution, please reply to this post.
greets
pyby


Top
 Profile  
 
PostPosted: Fri Jun 18, 2010 11:38 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Jun 18, 2010 11:35 pm
Posts: 1
Try this:
http://www.solidsystem.it/index.php/eng ... roperties/


Top
 Profile  
 
PostPosted: Sun Jul 04, 2010 12:49 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Aug 02, 2009 4:23 am
Posts: 19
Can anyone please clarify this solution. I'm having a bit of an issue with the plugin part of the fix.
"'p.product_s_desc AS text, p.product_thumb_image AS thumb,';"
What should that line 149 look like?

Thanks!

=-s-=


Top
 Profile  
 
PostPosted: Sun Jul 18, 2010 2:44 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Jul 18, 2010 9:19 am
Posts: 19
yaeh No luck for me too please any one can explain this in detail

Thanks

This is for pyby
Pyby can you please help me in this


Top
 Profile  
 
PostPosted: Sun Jul 18, 2010 9:55 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Aug 02, 2009 4:23 am
Posts: 19
Hi,

I managed to resolve this after some fooling around. inserting that at line 276 worked for me.
So it should read "
$query = "SELECT DISTINCT p.product_id, p.product_name as title,

FROM_UNIXTIME( p.cdate, '%Y-%m-%d %H:%i:%s' ) AS created,

p.product_s_desc AS text, p.product_thumb_image AS thumb,
"

=-s-=


Top
 Profile  
 
PostPosted: Tue Dec 28, 2010 9:14 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Aug 14, 2009 10:52 pm
Posts: 47
hi all,

I think there is a syntax error on this line below, but I dont know what;

<img src = "http://www.my-address.com/components/com_virtuemart/shop_image/product/<? php echo $ result-> thumb;?>">

EDIT: figured out, should be $result, but I still cant get thumbnails displayed. Im using VM 1.1.4 and Joomla 1.5.15, search module is mod_search with vmx plugin enabled. There are no errors displayed. Can you please help me? I did everything other than step 10 for giving links.

_________________
http://www.conceptchameleon.com/


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 2:17 am 
User avatar
Joomla! Guru
Joomla! Guru

Joined: Fri Dec 16, 2011 6:13 pm
Posts: 806
Location: Millersburg, OH
I was able to get this to work properly, after some jiggering around with it.

The code that's already been mentioned above for vmxsearch.plugin.php is correct.

Where my code was going wrong was in the default_results.php page. Here's how it should look:

Lines 34 - 37 (roughly):
Code:
<div> <?php echo $result->text; ?>
<img src="http://yoursite.com/components/com_virtuemart/shop_image/product/<?php echo $result->thumb; ?>">
</div>


Mine was getting thrown off by the "www" at the beginning of my address, and a space between <? and php. Hope this helps!

On a related note... does anyone know how to get prices to show in the search results? I like the search logic much better with the Virtuemart Plugin, but having search results without a single price showing is extremely unpalatable for my clients.

Any help would be appreciated!


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 11:40 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat May 08, 2010 1:22 pm
Posts: 16
There are 2 steps:

1# force the script to fetch a price.

You need to edit plugings\search\vmxsearch.plugin.php

about line 147 add the bolded code:

$query = "SELECT DISTINCT p.product_id, p.product_name as title, pri.product_price AS cenka,
FROM_UNIXTIME( p.cdate, '%Y-%m-%d %H:%i:%s' ) AS created,
p.product_s_desc AS text, p.product_thumb_image AS thumb, p.product_full_image AS fullimg,
CONCAT('$ItemName/',c.category_name) as section,

cenka is "price" in polish, so you can change it to: pri.product AS prodprice for example ...

2# display the result of this operation

Go to components\com_search\views\search\tmpl\default_results.php

Add this code wherever you want (i've pasted it about line 33)

<?php $netto=$result->cenka; $brutto=round($netto*1.22,2);?>
<?php echo $result->text; ?><br>
<?php echo $brutto.' EUR ';?></span></div>



where 1,22 is the tax value which may be different in your country.
and cenka is the variable name defined in step #1 (it can be for example prodprice, ...)

hope it helps.


Top
 Profile  
 
PostPosted: Thu Feb 02, 2012 1:26 am 
Joomla! Intern
Joomla! Intern

Joined: Sat Sep 03, 2011 2:14 pm
Posts: 78
Hi
i'm trying to do the same but with joomshopping search plugin instead of virtuemart, I think I went correctly into the first step that pyby suggested, inserting in code:
<img src = "http://www.mysite/components/com_joomshopping...../product/<? php echo $result-> thumb;?>
Now I can see search is looking for pictures (and doesn't find it)

So I tried to figure out how to apply step two to joomshopping plugin search
But I guess p.product_s_desc AS text, p.product_thumb_image AS thumb, is not right for joomshopping. I think that "jshopping_products_images" are the variable images I have in the database

in plugins/search/joomshopping/joomshopping.php I have this code:

Code:
$query = "SELECT prod.product_id AS slug, pr_cat.category_id AS catslug, prod.`".$lang->get('name')."` as title,
                  CONCAT(prod.`".$lang->get('short_description')."`,' ',prod.`".$lang->get('description')."`) as text,
                  '2' AS browsernav,
              #jshopping_products_images AS thumb,#
                  prod.product_date_added AS created,
                  cat.`".$lang->get('name')."` AS section                          
                  FROM `#__jshopping_products` AS prod
                  LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id
                  LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id                 
                  WHERE ($where) AND prod.product_publish = '1' AND cat.category_publish='1'               
                  GROUP BY prod.product_id
                  ORDER BY $order
                  ";   


I tried to edit the file by adding "jshopping_products_images AS thumb," but then I commented it because it didn't work.
Now I'm wonder if I'm doing something correct and where I'm mistaking


Top
 Profile  
 
PostPosted: Fri Apr 20, 2012 4:03 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Apr 20, 2012 3:58 pm
Posts: 2
rosponius wrote:
Hi
i'm trying to do the same but with joomshopping search plugin instead of virtuemart, I think I went correctly into the first step that pyby suggested, inserting in code:
<img src = "http://www.mysite/components/com_joomshopping...../product/<? php echo $result-> thumb;?>
Now I can see search is looking for pictures (and doesn't find it)

So I tried to figure out how to apply step two to joomshopping plugin search
But I guess p.product_s_desc AS text, p.product_thumb_image AS thumb, is not right for joomshopping. I think that "jshopping_products_images" are the variable images I have in the database

in plugins/search/joomshopping/joomshopping.php I have this code:

Code:
$query = "SELECT prod.product_id AS slug, pr_cat.category_id AS catslug, prod.`".$lang->get('name')."` as title,
                  CONCAT(prod.`".$lang->get('short_description')."`,' ',prod.`".$lang->get('description')."`) as text,
                  '2' AS browsernav,
              #jshopping_products_images AS thumb,#
                  prod.product_date_added AS created,
                  cat.`".$lang->get('name')."` AS section                          
                  FROM `#__jshopping_products` AS prod
                  LEFT JOIN `#__jshopping_products_to_categories` AS pr_cat ON pr_cat.product_id = prod.product_id
                  LEFT JOIN `#__jshopping_categories` AS cat ON pr_cat.category_id = cat.category_id                 
                  WHERE ($where) AND prod.product_publish = '1' AND cat.category_publish='1'               
                  GROUP BY prod.product_id
                  ORDER BY $order
                  ";   


I tried to edit the file by adding "jshopping_products_images AS thumb," but then I commented it because it didn't work.
Now I'm wonder if I'm doing something correct and where I'm mistaking


You are using the wrong column name. Go to your database (using MySQL my admin or a similar tool) and find the jshopping_products table. Then you will change the line you have above to something like prod.image_url AS thumb. You may need to join another table depending on the database schema jshopping uses.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ] 



Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group