News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Remove categories from search page

Started by steinarasb, November 16, 2011, 14:05:58 PM

Previous topic - Next topic

steinarasb

Hi all.

Is there  a way to stop the categories from showing in the search result?

Stephen Roberts

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,
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

steinarasb

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.

Stephen Roberts

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?
Sell downloadable (virtual) products in VirtueMart 2 and deliver downloads via local server, Amazon S3, and more! http://www.digitollsoftware.com

steinarasb

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.

steinarasb

#5
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 :)

rupesh

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