Author Topic: VirtueMart search not searching on categories  (Read 31333 times)

iskye81

  • Beginner
  • *
  • Posts: 26
VirtueMart search not searching on categories
« on: November 17, 2009, 15:46:29 PM »
Wonder if anyone can help out with this.  I have the virtuemart search module enabled on my site, and according to the plugin parameters search on category names is enabled.  But searching on a specific category name is returning NO results - the only results I get are if a category name happens to be mentioned within a product name, description etc.

The search works fine on other enabled items - product names, SKUs, short/long descriptions etc, but not on categories.  Anyone have any ideas?  ???

iskye81

  • Beginner
  • *
  • Posts: 26
Re: VirtueMart search not searching on categories
« Reply #1 on: November 18, 2009, 17:52:11 PM »
Anyone??

baljit

  • Beginner
  • *
  • Posts: 8
Re: VirtueMart search not searching on categories
« Reply #2 on: November 24, 2009, 12:13:31 PM »
Hello

Same problem here.Got solution????

Thanks

skylo

  • Beginner
  • *
  • Posts: 37
Re: VirtueMart search not searching on categories
« Reply #3 on: January 12, 2010, 18:02:10 PM »
Bumping this one in case anyone has any idea i can search fine on categories but not on products which is important  even if I type in an exact match it returns nothing any ideas anyone please.

Skylo

highdt

  • Beginner
  • *
  • Posts: 3
Re: VirtueMart search not searching on categories
« Reply #4 on: March 19, 2010, 16:03:14 PM »
Hi, I'm also trying to find a solution to the same issue that iskye81 is experiencing.  The Virtuemart search module is not searching the category paths for my products :(  Any advice on how to fix this?  Thanks

snozim

  • Beginner
  • *
  • Posts: 1
Re: VirtueMart search not searching on categories
« Reply #5 on: November 23, 2010, 01:41:07 AM »
same problem here!!! plz help!

seyi

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 407
    • AwoDev
Re: VirtueMart search not searching on categories
« Reply #6 on: November 23, 2010, 02:17:59 AM »
The search virtuemart plugin only works with the normal search (mod_search) not with virtuemart search (mod_virtuemart_search).  The functionality is easy to add though directly into the code.

In www/administrator/components/com_virtuemart/html/shop_browse_queries.php, around line 102 is this line
Code: [Select]
<?php
$sq 
.= "\n `#__{vm}_product`.`product_desc` LIKE '%$searchstring%') ";
?>

Right before that line, add this:
Code: [Select]
<?php
$sq 
.= "\n `#__{vm}_category`.`category_name` LIKE '%$searchstring%' OR ";
?>

Now, by default, the category name is also searched along with the product name/description.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

knibal

  • Beginner
  • *
  • Posts: 4
Re: VirtueMart search not searching on categories
« Reply #7 on: January 21, 2011, 14:41:29 PM »
Hi,

Joomla 1.5.22 and VM 1.1.6

I´m having the same problem. I have a 1st level categorie called "Calculators" and inside it, different models of calculators, for example, calculator 1, calculator 2, etc.

So, when the user searchs for "calculator", it shows the hole items with "calculator" in title or description.

But if they search "calculators", the system does not regret any result.

So, the problem is that the VM search module doesn´t search on categories.

I have tried the code modification up there but doesn´t work.

In www/administrator/components/com_virtuemart/html/shop_browse_queries.php

i find this code:

Code: [Select]
// This is the "normal" search
if( !empty($keywordArr) ) {
$sq = "(";
$numKeywords = count( $keywordArr );
$i = 1;
foreach( $keywordArr as $searchstring ) {
$sq .= "\n (`#__{vm}_product`.`product_name` LIKE '%$searchstring%' OR ";
$sq .= "\n `#__{vm}_product`.`product_sku` LIKE '%$searchstring%' OR ";
$sq .= "\n `#__{vm}_product`.`product_s_desc` LIKE '%$searchstring%' OR ";
$sq .= "\n `#__{vm}_product`.`product_desc` LIKE '%$searchstring%') ";

if( $i++ < $numKeywords ) {
$sq .= "\n  AND ";
}
}
$sq .= ")";
$where_clause[] = $sq;
}

and replaced for this:

Code: [Select]
// This is the "normal" search
if( !empty($keywordArr) ) {
$sq = "(";
$numKeywords = count( $keywordArr );
$i = 1;
foreach( $keywordArr as $searchstring ) {
$sq .= "\n (`#__{vm}_product`.`product_name` LIKE '%$searchstring%' OR ";
$sq .= "\n `#__{vm}_product`.`product_sku` LIKE '%$searchstring%' OR ";
$sq .= "\n `#__{vm}_product`.`product_s_desc` LIKE '%$searchstring%' OR ";
$sq .= "\n `#__{vm}_category`.`category_name` LIKE '%$searchstring%' OR ";
$sq .= "\n `#__{vm}_product`.`product_desc` LIKE '%$searchstring%') ";

if( $i++ < $numKeywords ) {
$sq .= "\n  AND ";
}
}
$sq .= ")";
$where_clause[] = $sq;
}

but still doesn´t work, any idea on how to fix this? Any other module or extension to fix this problem?

knibal

  • Beginner
  • *
  • Posts: 4
Re: VirtueMart search not searching on categories
« Reply #8 on: January 22, 2011, 15:43:29 PM »
Hi! Any help please? :(

seyi

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 407
    • AwoDev
Re: VirtueMart search not searching on categories
« Reply #9 on: January 22, 2011, 16:55:57 PM »
Hmm, I do not see any problems with your query.  Are you 100% sure it is using vm search?  Put an exit statement in there somewhere (after backing up your stuff) and then search again.  If the page shows up fully, then its not calling that query.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

knibal

  • Beginner
  • *
  • Posts: 4
Re: VirtueMart search not searching on categories
« Reply #10 on: January 25, 2011, 17:14:09 PM »
Hi seyi, thnks for answering, I´m not an advanced programmer so I don´t know exactly what to do.

I´m sure I´m using vm_search but don´t get any results when searching for a category name.

As far as I know, vm_search allows to search on SKU, title, short desc., long desc.

So if I search a category title, it gives me nothing. I would expect to give me either a category to enter in or all the products under that category, but as I said, I get no search results :\

Keddy Logern

  • Beginner
  • *
  • Posts: 10
    • Unlimited web Hosting
  • Skype Name: rubox100
  • VirtueMart Version: 2.6.12
Re: VirtueMart search not searching on categories
« Reply #11 on: January 25, 2011, 19:45:42 PM »


You have to use the VirtueMart Search Module, but not the default Joomla search.
In Short make sure you have published VM Search Module- ( but this searches only VM - not other site contents or articles)
********
Always yours.
http://www.gsocialdesigns.com |https://www.fiverr.com/obamacash
Let's build VM, together

kal-el

  • Beginner
  • *
  • Posts: 6
Re: VirtueMart search not searching on categories
« Reply #12 on: June 26, 2011, 16:00:46 PM »
Thank you, Seyi. You saved me from a lot of searching, digging through code, and stress. You da man!

tobias_conrad

  • Beginner
  • *
  • Posts: 44
    • Herbs and Spices may help you. Find it out.
Re: VirtueMart 2.0.12 search not searching on categories
« Reply #13 on: October 05, 2012, 18:48:57 PM »
hi i have still this problem.
i have a lot of important content inside the category and it is not searchable!

who knows a solution?
Maybe the best set of extensions in a gorgeous template for less than 50$.
http://clicky.me/gorgeous-template

danyz

  • Beginner
  • *
  • Posts: 5
Re: VirtueMart search not searching on categories
« Reply #14 on: January 23, 2013, 17:01:22 PM »
Hello, I know this thread is old but I'm having the same issue here. I want to search for VM categories and not products. Is there a way to do that? Thank you very much