Before moving on the topic, I would like to share this to the peoples who are very new to the Virtuemart 2.0, that Virtuemart 2.0 has provided the inbuilt search module, so like Virtuemart 1.5.X you do not have to install product search plugin separately.

By default Virtuemart 2.0 search result page displays parent category list before the searched results, and you might wants’ to hide these category listing from this page. So here is the solution –

1. Navigate to:
components/com_virtuemart/views/category/tmpl/default.php

2. Search for the below code on around line # 47

echo $edit_link; */ ?>
<h1><?php echo($this->category->category_name); ?></h1>
<div class="category_description">
<?php echo $this->category->category_description ; ?></div>
<?php /* Show child categories */

3. Replace it with

echo $edit_link; */?>
<?php
if (empty($this->keyword)) {
?>
<h1><?php echo($this->category->category_name); ?></h1>
<?php
}
if ( empty($this->keyword) ) {
?>
<div class="category_description">
<?php echo $this->category->category_description ; ?>
</div>
<?php
}
/* Show child categories */

4. Then search for the below line on around line # 57

if ( VmConfig::get('showCategory',1) ) {

5. Replace it with

if ( VmConfig::get('showCategory',1) && empty($this->keyword) ) {

It’s time to check the code implication

Related posts:

avatar

Author: 


  • gcoulter

    Came across this post and tried it out, but the code has now changed which makes this post redndant