VirtueMart Forum

VirtueMart 2 + 3 + 4 => Frontend Modules => Topic started by: JacoboPS on December 22, 2014, 01:50:41 AM

Title: Search Module broken
Post by: JacoboPS on December 22, 2014, 01:50:41 AM
Hello everybody, here I have one of those weird problems (at least for me) that I know some of you enjoy...

My VM search module (the standard) was not working. For any value entered, it was re-directing me to the home. So first thing, I reviewed the configuration and I found a field that could be interesting: Set ItemID

So I entered the ID for one of the categories on the main menu, and then when I tried, I got this:

Unknown column 'l.l.slug' in 'where clause' SQL=SELECT SQL_CALC_FOUND_ROWS p.`virtuemart_product_id` FROM `jos_virtuemart_products` as p INNER JOIN `jos_virtuemart_products_es_es` as l using (`virtuemart_product_id`) LEFT JOIN `jos_virtuemart_product_shoppergroups` as ps ON p.`virtuemart_product_id` = `ps`.`virtuemart_product_id` LEFT JOIN `jos_virtuemart_product_categories` as pc ON p.`virtuemart_product_id` = `pc`.`virtuemart_product_id` LEFT JOIN `jos_virtuemart_categories_es_es` as c ON c.`virtuemart_category_id` = `pc`.`virtuemart_category_id` WHERE ((`l`.product_name LIKE "%canela%" OR `p`.product_sku LIKE "%canela%" OR `l`.product_s_desc LIKE "%canela%" OR `l`.`l`.slug LIKE "%canela%" OR `category_name` LIKE "%canela%" OR `p`.virtuemart_product_id LIKE "%canela%") AND `pc`.`virtuemart_category_id` = 18 AND ( `ps`.`virtuemart_shoppergroup_id`= "1" OR `ps`.`virtuemart_shoppergroup_id` IS NULL ) AND p.`published`="1" ) group by p.`virtuemart_product_id` ORDER BY product_name ASC LIMIT 0, 20

:o I went back then to the module manager, to remove the category ID I entered, but it was too late, the problem now persists!!.
What happen?? Something got corrupt on the database?

And much more important, how can I fix it?

Thank you!
Title: Re: Search Module broken
Post by: GJC Web Design on December 22, 2014, 13:51:47 PM
its not the db - but the query

this is wrong  OR  `l`.`l`.slug LIKE "%canela%"

should be   OR  `l`.slug LIKE "%canela%"

haven't got time at the mo to look but u need to find where the query is formed and why the double table denoter

I assume administrator/com_virtuemart/models/product.php
Title: Re: Search Module broken
Post by: JacoboPS on December 22, 2014, 17:14:59 PM
Well, at least is a first place to look for. In the file located in   administrator/components/com_virtuemart/models/product.php    and looking for the `slug' I found this...

else if ($searchField == 'product_name' or $searchField == 'product_s_desc' or $searchField == 'product_desc' or $searchField == '`l`.slug' ){
               $langFields[] = $searchField;
               //if (strpos ($searchField, '`') !== FALSE){
                  $searchField = '`l`.'.$searchField;
               //}

But I don't really know what is wrong. And even more important, why this happend.
Since I don't know too much about programming, I'll try to compare my product.php file with the one of a clean installation, to see if mine was modified in any way.
Title: Re: Search Module broken
Post by: GJC Web Design on December 22, 2014, 17:17:36 PM
try

else if ($searchField == 'product_name' or $searchField == 'product_s_desc' or $searchField == 'product_desc' or $searchField == 'slug' ){


i.e red removed

else if ($searchField == 'product_name' or $searchField == 'product_s_desc' or $searchField == 'product_desc' or $searchField == '`l`.slug' ){
Title: Re: Search Module broken
Post by: JacoboPS on December 29, 2014, 11:55:51 AM
Thank  you very much, GJC Web Design, the problem with the code is solved. Great!

(Now I have to investigate why when I make a search -any- it returns me to the home, instead of giving me a result.)
Title: Re: Search Module broken
Post by: jjk on December 29, 2014, 15:46:05 PM
Don't know if this is related to your "Search redirects to Homepage" issue, but you have an error on your website saying
"Blocked loading mixed active content "http: //code.jquery.com/jquery-latest.min.js"

That means that you are trying to load a http link into your https page. (maybe one of your urls pointing to a Google api).

Also, check if you have both, the search module and plugin enabled. And do you have Spanish selected in the Joomla 'Language Manager' > 'Content' tab?

When I point Firebug to the search input field, it shows this, of which the first part looks a little bit strange to me:
<div class="module-content">
<form method="get" action="<br /> <b>Warning</b>: Creating default object from empty value in <b>/home/linatz/public_html/components/com_sef/sef_ext/com_virtuemart.php</b> on line <b>248</b><br /> https://www.1001especias.com/es/list-all-products?limit=18&limitstart=0">
<div class="search">
<input id="mod_virtuemart_search" class="inputbox" type="text" onfocus="if(this.value=='busca aquí...') this.value='';" onblur="if(this.value=='') this.value='busca aquí...';" value="busca aquí..." size="20" alt="Buscar" maxlength="20" name="keyword">
</div>
Title: Re: Search Module broken
Post by: JacoboPS on January 09, 2015, 17:18:31 PM
Thanks very much for your answer, jjk. I have decided to consider -and deal with it- as two different problems.

SEARCH MODULE

About if I have the search module and language contect public, they both (plugin and spanish content on Language Manager) are enabled. Anyway, I am (was using the module from VIRTUEMART, for product search, not the jsioomla one. Now I am using the Joomla one and it works correctly. It is not what I wanted, but at least I have time to continue investigating what can be happening.

And about the "Blocked loading mixed active content "http: //code.jquery.com/jquery-latest.min.js"...

I have the site with SSL, and I think that in some part I can force (or not) the Joomla to use always HTTPS.
I have uncheck the "Use external google jQuery library" option of VM but nothing -after cleaning cache- has changed... any idea will be welcome!!