VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: steinarasb on November 16, 2011, 14:05:58 PM

Title: Remove categories from search page
Post by: steinarasb on November 16, 2011, 14:05:58 PM
Hi all.

Is there  a way to stop the categories from showing in the search result?
Title: Re: Remove categories from search page
Post by: Stephen Roberts on November 16, 2011, 17:11:21 PM
I can think of 2 ways:

1. Override the search view. Copy /components/com_search/views/search/tmpl/default_results.php to /templates/YOUR_JOOMLA_TEMPLATE/html/com_search/search/default_results.php and remove the following code:

<?php if ($result->section) : ?>
<dd class="result-category">
<span class="small<?php echo $this->pageclass_sfx?>">
(<?php echo $this->escape($result->section); ?>)
</span>
</dd>
<?php endif; ?>


2. Modify the search plugin. Remove the following code from /plugins/search/virtuemart/virtuemart.php:

b.category_name as section,
Title: Re: Remove categories from search page
Post by: steinarasb on November 17, 2011, 12:09:15 PM
Hi Stephen, and thanks for your reply.
I've tried both your approaches, but nothing changes in the search-result.
I also tried to edit components/com_search/views/search/tmpl/default_results.php directly, but cannot see any effect on the search result.
Title: Re: Remove categories from search page
Post by: Stephen Roberts on November 17, 2011, 15:55:43 PM
Hm, both of these work with a default installation of Joomla and VM. You're running Joomla! 1.7.x and VM-RC2-M? It sounds like you must be using another search plugin or something. What else have you installed?
Title: Re: Remove categories from search page
Post by: steinarasb on November 18, 2011, 09:38:27 AM
The only thing that's special, is that this site is upgraded from 1.5, not a fresh install.
This is because I wanted to migrate the exisiting VM-installation to VM2.
Title: Re: Remove categories from search page
Post by: steinarasb on November 18, 2011, 09:59:40 AM
Did a lil more digging, and ended up hacking the file components/com_virtuemart/views/category/tmpl/default.php.
Altered line two from if ( VmConfig::get('showCategory',1)) { to if ( VmConfig::get('showCategory',1) && !$this->search) {

Quite dirty, but it does the job...

Thanks for your input stephenroberts :)
Title: Re: Remove categories from search page
Post by: rupesh on April 16, 2012, 08:14:20 AM
Quote from: steinarasb on November 18, 2011, 09:59:40 AM
Did a lil more digging, and ended up hacking the file components/com_virtuemart/views/category/tmpl/default.php.
Altered line two from if ( VmConfig::get('showCategory',1)) { to if ( VmConfig::get('showCategory',1) && !$this->search) {

absolutely right!!

thanks steinarasb