VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: cynthu on January 31, 2012, 19:43:46 PM

Title: Change Search result to show on top of the page
Post by: cynthu on January 31, 2012, 19:43:46 PM
When I do a search, the results show in the main window but on top of them I have the categories displayed, is there a way of getting rid of the categories and just display the search results???? thanks
Title: Re: Change Search result to show on top of the page
Post by: PRO on January 31, 2012, 20:09:02 PM
Product Order Settings

Available Search Fields
Title: Re: Change Search result to show on top of the page
Post by: cynthu on February 01, 2012, 00:27:34 AM
Thanks for the reply, but I don't think it's what I'm talking about. The Categories I mean are the category layout in the main page, not the ones included in the search results. I'll attach an image for you to see. And here is the link if you want to see it live.
http://www.3sports.com.ar/ (http://www.3sports.com.ar/)

Thanks again

[attachment cleanup by admin]
Title: Re: Change Search result to show on top of the page
Post by: mark R on February 09, 2012, 11:54:40 AM
I also have this issue,

Did you find a fix??

Many thanks
Mark
Title: Re: Change Search result to show on top of the page
Post by: stslit on February 23, 2012, 10:03:20 AM
I am looking to...
How fix search result without categories?
Title: Re: Change Search result to show on top of the page
Post by: stslit on February 23, 2012, 10:14:30 AM
Quote from: stslit on February 23, 2012, 10:03:20 AM
I am looking to...
How fix search result without categories?

Temporary resolver standard Joomla search.
Waiting another solution.
Title: Re: Change Search result to show on top of the page
Post by: sergent on February 26, 2012, 13:50:09 PM
Same for me..
yes its weird this result of searching !! looks no developer tested it !
When you have a lot of category, you have to scroll down to find the result...!!

the VM search module was perfect in VM1, and now is worst...
The performance also are less good !!
for example my product called "glasses white wine", if i search "glass white wine" it wounds nothing !!! its unbelievable. Again in VM1 it found perfectly !!

...
Title: Re: Change Search result to show on top of the page
Post by: SamF on February 26, 2012, 19:11:27 PM
In search module \modules\mod_virtuemart_search\tmpl\default.php  line 4 says:

<form action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&search=true&limitstart=0&virtuemart_category_id='.$category_id )

The result of search is intended to be shown in category view. So, what do we have here? $category_id=0 (parent category!) and sub-categories on top of the default category view, then the list of products (if any), found in our search.

Temporary solution: if we don't need categories in category view, at least in our search result, check if it is a search request. Change line 72 in \components\com_virtuemart\views\category\tmpl\default.php from this:

if(!empty($this->category->children )){

to this:

if(!empty($this->category->children ) && !(boolean)JRequest::getVar('search', false)){

Search results (nice shovels set, but no categories on top:)) are on screenshot # 7. If it is not a search, but category view, everything is in place, like in screenshot # 8.



[attachment cleanup by admin]
Title: Re: Change Search result to show on top of the page
Post by: stslit on February 26, 2012, 20:38:42 PM
Grate! It work.

Another solution from d0ublezer0 http://forum.virtuemart.net/index.php?topic=98558.0

We can mark this post like [solved]

P.S.
One more question: "How can I show sku for select product?"
Title: Re: Change Search result to show on top of the page
Post by: SamF on February 27, 2012, 16:14:59 PM
Quote from: stslit on February 26, 2012, 20:38:42 PM
How can I show sku for select product?

Could you explain? Where you want to show the SKU? In product view ("flypage")? In category view? In search results?
Title: Re: Change Search result to show on top of the page
Post by: cynthu on March 01, 2012, 23:38:11 PM
Hi, i'm back from my holidays and was happy to see there was a solution, but it didn't last long. When I opened components\com_virtuemart\views\category\tmpl\default.php, I could find the mentioned line:  if(!empty($this->category->children )){
I've checked the other post http://forum.virtuemart.net/index.php?topic=98558.0 (http://forum.virtuemart.net/index.php?topic=98558.0) but it's the same story. This is the code I have:

<?php
/**
*
* Show the products in a category
*
* @package   VirtueMart
* @subpackage
* @author RolandD
* @author Max Milbers
* @todo add pagination
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: default.php 5120 2011-12-18 18:29:26Z electrocity $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
JHTML::_( 'behavior.modal' );
/* javascript for list Slide
  Only here for the order list
  can be changed by the template maker
*/
$js = "
jQuery(document).ready(function () {
   jQuery('.orderlistcontainer').hover(
      function() { jQuery(this).find('.orderlist').stop().show()},
      function() { jQuery(this).find('.orderlist').stop().hide()}
   )
});
";

$document = JFactory::getDocument();
$document->addScriptDeclaration($js);
?>

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

if ( VmConfig::get('showCategory',1) ) {
   if ($this->category->haschildren) {

      // Category and Columns Counter
      $iCol = 1;
      $iCategory = 1;

      // Calculating Categories Per Row
      $categories_per_row = VmConfig::get ( 'categories_per_row', 3 );
      $category_cellwidth = ' width'.floor ( 100 / $categories_per_row );

      // Separator
      $verticalseparator = " vertical-separator";
      ?>

      <div class="category-view">

      <?php // Start the Output
      if(!empty($this->category->children)){
      foreach ( $this->category->children as $category ) {

         // Show the horizontal seperator
         if ($iCol == 1 && $iCategory > $categories_per_row) { ?>
         <div class="horizontal-separator"></div>
         <?php }

         // this is an indicator wether a row needs to be opened or not
         if ($iCol == 1) { ?>
         <div class="row">
         <?php }

         // Show the vertical seperator
         if ($iCategory == $categories_per_row or $iCategory % $categories_per_row == 0) {
            $show_vertical_separator = ' ';
         } else {
            $show_vertical_separator = $verticalseparator;
         }

         // Category Link
         $caturl = JRoute::_ ( 'index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $category->virtuemart_category_id );

            // Show Category ?>
            <div class="category floatleft<?php echo $category_cellwidth . $show_vertical_separator ?>">
               <div class="spacer">
                  <h2>
                     <a href="<?php echo $caturl ?>" title="<?php echo $category->category_name ?>">
                     <?php echo $category->category_name ?>
                     <br />
                     <?php // if ($category->ids) {
                        echo $category->images[0]->displayMediaThumb("",false);
                     //} ?>
                     </a>
                  </h2>
               </div>
            </div>
         <?php
         $iCategory ++;

      // Do we need to close the current row now?
      if ($iCol == $categories_per_row) { ?>
      <div class="clear"></div>
      </div>
         <?php
         $iCol = 1;
      } else {
         $iCol ++;
      }
   }
   }
   // Do we need a final closing row tag?
   if ($iCol != 1) { ?>
      <div class="clear"></div>
      </div>
   <?php } ?>
</div>
<?php }
}

// Show child categories
if (!empty($this->products)) {
   if (!empty($this->keyword)) {
      ?>
      <h3><?php echo $this->keyword; ?></h3>
      <?php
   }
   ?>

<?php // Category and Columns Counter
$iBrowseCol = 1;
$iBrowseProduct = 1;

// Calculating Products Per Row
$BrowseProducts_per_row = $this->perRow;
$Browsecellwidth = ' width'.floor ( 100 / $BrowseProducts_per_row );

// Separator
$verticalseparator = " vertical-separator";
?>

<div class="browse-view">

   <h1><?php echo $this->category->category_name; ?></h1>
      <form action="<?php echo JRoute::_('index.php?option=com_virtuemart&view=category&limitstart=0&virtuemart_category_id='.$this->category->virtuemart_category_id ); ?>" method="get">
      <?php if ($this->search) { ?>
      <!--BEGIN Search Box --><div class="virtuemart_search">
      <?php echo $this->searchcustom ?>
      <br />
      <?php echo $this->searchcustomvalues ?>
      <input style="height:16px;vertical-align :middle;" name="keyword" class="inputbox" type="text" size="20" value="<?php echo $this->keyword ?>" />
      <input type="submit" value="<?php echo JText::_('COM_VIRTUEMART_SEARCH') ?>" class="button" onclick="this.form.keyword.focus();"/>
      </div>
            <input type="hidden" name="search" value="true" />
            <input type="hidden" name="view" value="category" />


      <!-- End Search Box -->
      <?php } ?>
         <div class="orderby-displaynumber">
            <div class="width70 floatleft">
               <?php echo $this->orderByList['orderby']; ?>
               <?php echo $this->orderByList['manufacturer']; ?>
            </div>
            <div class="width30 floatright display-number"><?php echo $this->vmPagination->getResultsCounter();?><br/><?php echo $this->vmPagination->getLimitBox(); ?></div>
            <div id="bottom-pagination">
               <?php echo $this->vmPagination->getPagesLinks(); ?>
               <span style="float:right"><?php echo $this->vmPagination->getPagesCounter(); ?></span>
            </div>

         <div class="clear"></div>
         </div>
      </form>
<?php // Start the Output
foreach ( $this->products as $product ) {

   // Show the horizontal seperator
   if ($iBrowseCol == 1 && $iBrowseProduct > $BrowseProducts_per_row) { ?>
   <div class="horizontal-separator"></div>
   <?php }

   // this is an indicator wether a row needs to be opened or not
   if ($iBrowseCol == 1) { ?>
   <div class="row">
   <?php }

   // Show the vertical seperator
   if ($iBrowseProduct == $BrowseProducts_per_row or $iBrowseProduct % $BrowseProducts_per_row == 0) {
      $show_vertical_separator = ' ';
   } else {
      $show_vertical_separator = $verticalseparator;
   }

      // Show Products ?>
      <div class="product floatleft<?php echo $Browsecellwidth . $show_vertical_separator ?>">
         <div class="spacer">
            <div class="width30 floatleft center">
               <?php /** @todo make image popup */
                     echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
                  ?>


                  <!-- The "Average Customer Rating" Part -->
                  <?php if (VmConfig::get('pshop_allow_reviews') == 1) { ?>
                  <span class="contentpagetitle"><?php echo JText::_('COM_VIRTUEMART_CUSTOMER_RATING') ?>:</span>
                  <br />
                  <?php
                  // $img_url = JURI::root().VmConfig::get('assets_general_path').'/reviews/'.$product->votes->rating.'.gif';
                  // echo JHTML::image($img_url, $product->votes->rating.' '.JText::_('COM_VIRTUEMART_REVIEW_STARS'));
                  // echo JText::_('COM_VIRTUEMART_TOTAL_VOTES').": ". $product->votes->allvotes; ?>
                  <?php } ?>

                  <?php if (!VmConfig::get('use_as_catalog')){?>
                  <div class="paddingtop8">
                     <span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"></span>
                     <span class="stock-level"><?php echo JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP') ?></span>
                  </div>
                  <?php }?>
            </div>

            <div class="width70 floatright">

               <h2><?php echo JHTML::link($product->link, $product->product_name); ?></h2>

                  <?php // Product Short Description
                  if(!empty($product->product_s_desc)) { ?>
                  <p class="product_s_desc">
                  <?php echo shopFunctionsF::limitStringByWord($product->product_s_desc, 40, '...') ?>
                  </p>
                  <?php } ?>

               <div class="product-price marginbottom12" id="productPrice<?php echo $product->virtuemart_product_id ?>">
               <?php
               if ($this->show_prices == '1') {
                  if( $product->product_unit && VmConfig::get('vm_price_show_packaging_pricelabel')) {
                     echo "<strong>". JText::_('COM_VIRTUEMART_CART_PRICE_PER_UNIT').' ('.$product->product_unit."):</strong>";
                  }

                  //todo add config settings
                  if( $this->showBasePrice){
                     echo $this->currency->createPriceDiv('basePrice','COM_VIRTUEMART_PRODUCT_BASEPRICE',$product->prices);
                     echo $this->currency->createPriceDiv('basePriceVariant','COM_VIRTUEMART_PRODUCT_BASEPRICE_VARIANT',$product->prices);
                  }
                  echo $this->currency->createPriceDiv('variantModification','COM_VIRTUEMART_PRODUCT_VARIANT_MOD',$product->prices);
                  echo $this->currency->createPriceDiv('basePriceWithTax','COM_VIRTUEMART_PRODUCT_BASEPRICE_WITHTAX',$product->prices);
                  echo $this->currency->createPriceDiv('discountedPriceWithoutTax','COM_VIRTUEMART_PRODUCT_DISCOUNTED_PRICE',$product->prices);
                  echo $this->currency->createPriceDiv('salesPriceWithDiscount','COM_VIRTUEMART_PRODUCT_SALESPRICE_WITH_DISCOUNT',$product->prices);
                  echo $this->currency->createPriceDiv('salesPrice','COM_VIRTUEMART_PRODUCT_SALESPRICE',$product->prices);
                  echo $this->currency->createPriceDiv('priceWithoutTax','COM_VIRTUEMART_PRODUCT_SALESPRICE_WITHOUT_TAX',$product->prices);
                  echo $this->currency->createPriceDiv('discountAmount','COM_VIRTUEMART_PRODUCT_DISCOUNT_AMOUNT',$product->prices);
                  echo $this->currency->createPriceDiv('taxAmount','COM_VIRTUEMART_PRODUCT_TAX_AMOUNT',$product->prices);
               } ?>
               </div>

               <p>
               <?php // Product Details Button
               echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'), array('title' => $product->product_name,'class' => 'product-details'));
               ?>
               </p>

            </div>
         <div class="clear"></div>
         </div>
      </div>
   <?php
   $iBrowseProduct ++;

   // Do we need to close the current row now?
   if ($iBrowseCol == $BrowseProducts_per_row) { ?>
   <div class="clear"></div>
   </div>
      <?php
      $iBrowseCol = 1;
   } else {
      $iBrowseCol ++;
   }
}
// Do we need a final closing row tag?
if ($iBrowseCol != 1) { ?>
   <div class="clear"></div>
   </div>
<?php
}
?>
   <div id="bottom-pagination"><?php echo $this->vmPagination->getPagesLinks(); ?><span style="float:right"><?php echo $this->vmPagination->getPagesCounter(); ?></span></div>
</div>
<?php } ?>
Title: Re: Change Search result to show on top of the page
Post by: SamF on March 02, 2012, 05:53:56 AM
QuoteWhen I opened components\com_virtuemart\views\category\tmpl\default.php

* @version $Id: default.php 5120 2011-12-18 18:29:26Z electrocity $

Please check the VM version you use.

This is the one, I was talking about (2.0.2 stable):

/**
*
* Show the products in a category
*
* @package VirtueMart
* @subpackage
* @author RolandD
* @author Max Milbers
* @todo add pagination
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2004 - 2010 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: default.php 5378 2012-02-04 12:58:01Z Milbo $
*/


Definitely, you can find a similar solution for old version too. The main idea is do define, is there a search request, or a "general" category view request, and don't show subcats in the first case.
Title: Re: Change Search result to show on top of the page
Post by: cynthu on March 02, 2012, 13:44:31 PM
Samf you are my hero!

I did have VM 2.0, so I read the code line by line and I found it, not too far! I'm a foooool. I couldn't find it yesterday cause I used the search, and there was an extra white space after children, my line is:  if(!empty($this->category->children)){
I did imagine this yesterday and tried shorter searchs, but I guess that my "Find" component was not in the mood, or was I too tired?? Thanks!!!!!!!!!!!!!!!!!! :D
Title: Re: Change Search result to show on top of the page
Post by: stslit on March 03, 2012, 16:49:56 PM
Quote from: SamF on February 27, 2012, 16:14:59 PM
Quote from: stslit on February 26, 2012, 20:38:42 PM
How can I show sku for select product?

Could you explain? Where you want to show the SKU? In product view ("flypage")? In category view? In search results?

Any where( in catalog and search result) it be usefull, I'm sure. May be you know, how can I create custom layout for product. (this option exist(default, sku, price and etc.) but, I can use it, have you documentetion for this?)
Title: Re: Change Search result to show on top of the page
Post by: SamF on March 03, 2012, 18:29:33 PM
Quote from: stslit on March 03, 2012, 16:49:56 PMMay be you know, how can I create custom layout for product. (this option exist(default, sku, price and etc.) but, I can use it, have you documentetion for this?)

This is a documentation for awhile: http://forum.virtuemart.net/index.php?topic=92756.0 (http://forum.virtuemart.net/index.php?topic=92756.0)

To show SKU in category view, or search result view, write something like:

echo 'SKU '.$product->product_sku;

What you get is on the picture attached.

[attachment cleanup by admin]
Title: Re: Change Search result to show on top of the page
Post by: stslit on March 03, 2012, 19:02:42 PM
Tanks :) and Sorry :-[
I must use search more accuracy. ;D ;D ;D

[solved]
Title: Re: Change Search result to show on top of the page
Post by: sanifu on May 24, 2012, 16:30:38 PM
Hi I have tried that code to delete the categories from the top of the search section but it doesn't seem to work on my site. Also I would like to get rid off that Choose product type box as well as search in shop box.

Using Joomla 2.5 and Virtuemart 2
Title: Re: Change Search result to show on top of the page
Post by: PRO on May 24, 2012, 18:16:37 PM

I use this to NOT display things when on search page

Put this somewhere at the top of your file
   <?php $searchnone=JRequest::getVar('keyword',0); ?>


Then wrap whatever you dont want to show like this

<?php if (empty($searchnone)) {?>



WHATEVER is HERE is not shown when search


<?php } ?>
Title: Re: Change Search result to show on top of the page
Post by: mjandia on June 16, 2012, 02:54:53 AM
I have  the same problem with WM2 2.0.6. I don't find the solution the line.
Title: Re: Change Search result to show on top of the page
Post by: amalia on June 17, 2012, 22:03:14 PM
Quote from: sanifu on May 24, 2012, 16:30:38 PMAlso I would like to get rid off that Choose product type box as well as search in shop box.

Just remove this line..
<?php echo $this->searchcustom /?>

it's somewhere in 147 +/- line..
Title: Re: Change Search result to show on top of the page
Post by: mjandia on June 19, 2012, 16:17:42 PM
thank you for your reply but I i want to remove on result page the select product and the search box on VM2 2.0.6 . The file is not component /com virtuemart/views/categories/tmpl/default.php ?
Title: Re: Change Search result to show on top of the page
Post by: mjandia on June 30, 2012, 12:31:19 PM
no one has a solution
Title: Re: Change Search result to show on top of the page
Post by: copierx on July 16, 2012, 04:11:54 AM
Hi,

None of them work for me.

VM Version is 2.0.8
Title: Re: Change Search result to show on top of the page
Post by: webe on July 22, 2012, 09:39:37 AM
Is there any solution yet for 2.0.8??
Title: Re: Change Search result to show on top of the page
Post by: Menace on August 03, 2012, 14:36:28 PM
Quote from: BanquetTables.pro on May 24, 2012, 18:16:37 PM

I use this to NOT display things when on search page

Put this somewhere at the top of your file
   <?php $searchnone=JRequest::getVar('keyword',0); ?>


Then wrap whatever you dont want to show like this

<?php if (empty($searchnone)) {?>



WHATEVER is HERE is not shown when search


<?php } ?>

Thank you Banquet! I used this code for taking products out of my search results and it worked well for me.
Now I want to display childcategories instead in search results but I don't get it to work.

Any solutions for that issue?