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

Search Module broken

Started by JacoboPS, December 22, 2014, 01:50:41 AM

Previous topic - Next topic

JacoboPS

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!
Learning, pulling hair out, learning...

GJC Web Design

#1
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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

JacoboPS

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.
Learning, pulling hair out, learning...

GJC Web Design

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' ){
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

JacoboPS

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.)
Learning, pulling hair out, learning...

jjk

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>
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

JacoboPS

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!!
Learning, pulling hair out, learning...