search error when upgrading rialto

7 years 9 months ago #1 by brazilback
Hello I get the following error, I tried to use the solution giving to an error 1054 I've read above but not worked,

to try, to see if they could help me fix it


Column 'title' in where clause is ambiguous SQL=SELECT e.id, e.title AS title, e.description AS text, e.date_created AS created,c.title AS section, e.id AS entryid, e.alias AS entryalias, c.id AS categoryid, c.alias AS categoryalias, CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug, CASE WHEN CHAR_LENGTH(e.alias) THEN CONCAT_WS(':', e.id, e.alias) ELSE e.id END as slug, '2' AS browsernav FROM #__rialto_entries e, #__rialto_categories c WHERE ((`title` LIKE '%piso%' OR `e`.`description` LIKE '%piso%')) AND e.category_id = c.id AND e.state = 1 ORDER BY `created` DESC

Please Log in or Create an account to join the conversation.

7 years 9 months ago #2 by chrisc
This was introduced in the last update and is fixed in the upcoming new release.

In the meantime the fix is relatively trivial. Edit the file plugins/search/rialto.rialto.php and change the following lines:

Line 69 becomes:
$conditions = $db->quoteName('e.title') . " LIKE $text" . " OR " . $db->quoteName('e.description') . " LIKE $text";

And also line 78 becomes:
$wordConditions[] = $db->quoteName('e.title') . " LIKE $word"  . " OR " . $db->quoteName('e.description') . " LIKE $word";

That will resolve it. Tested and verified locally.

Regards

If you are using our extensions please leave a review at the JED: IP Mapping | Issue Tracker | JAudit | Password Control

Please Log in or Create an account to join the conversation.

7 years 9 months ago - 7 years 9 months ago #3 by brazilback
homeservice.sanchezinmobiliarios.com/ind...hrase=all&Itemid=376

Hello chrish thank you for your support

Unfortunately it has failed and is not the system works

It has stopped sending the emails

therefore I'm going to revert to the previous version

Please Log in or Create an account to join the conversation.

7 years 9 months ago #4 by chrisc
Looking at your screen shot I suspect that the code has been pasted wrong since the 'text' field has not been quoted, hence the message about 'piso' being an unknown column.. I will paste the section in its entirety to illustrate.

In plugins/search/rialto/rialto.php lines 65 t0 84 should be as follows:
switch ($phrase) {
         case 'exact':
            // build an exact match LIKE condition
            $text = $db->Quote('%'.$db->escape($text, true).'%', false);
            $conditions = $db->quoteName('e.title') . " LIKE $text" . " OR " . $db->quoteName('e.description') . " LIKE $text";
            break;
         case 'all':
         case 'any':
         default:
            // prepare the words individually
            $wordConditions = array();
            foreach (preg_split("~\s+~", $text) as $word) {
               $word = $db->Quote('%'.$db->escape($word, true).'%', false);
               $wordConditions[] = $db->quoteName('e.title') . " LIKE $word"  . " OR " . $db->quoteName('e.description') . " LIKE $word";
            }
            // determine the glue and put it all together!
            $glue = ($phrase == 'all') ? ') AND (' : ') OR (';
            $conditions = '('.implode($glue, $wordConditions).')';
         break;
      }

I suspect that somehow the lines immediately prior to the ones replaced have been changed somehow. I have tested the theory myself and then I do see the symptoms you observe, otherwise I cannot get it to fail.

Re the comment about emails not being sent, what version of Joomla is this. The mail changed in 3.5.1 as mentioned in another forum post but I am not aware of any existing problem with email sending. Any error message observed?

Regards

If you are using our extensions please leave a review at the JED: IP Mapping | Issue Tracker | JAudit | Password Control

Please Log in or Create an account to join the conversation.

7 years 9 months ago - 7 years 9 months ago #5 by brazilback
Hello chrisc my version is the Joomla! 3.5.1 the mail during a thousandth, more time not with what just enough time to read the message the message from sent appears me, but receive not receive anything, is that in the previous version if I was sent an email to the customer

came on behalf of rialto instead of in the name of my website, but at least sent message now does nothing, and I rather play of code but I am not a programmer have no experience in complicated things, at least to know fix this without specific indications,

I did the indications that I reply and only change the error 1052 to 1054, already more not is to do

still does not work with your instructions I enclose the full rialto.php thanks for all




<?php
/**
*
* Rialto - Classified Ads for Joomla!
*
* @Version $Id: rialto.php 2306 2016-06-13 13:24:56Z geoffc $
* @Package Rialto
* @Subpackage com_rialto
* @Release 1.3.0
* @Copyright Copyright (C) 2015-2016 Macrotone Consulting Ltd. All rights reserved.
* @License GNU General Public License version 3 or later; see LICENSE.txt
* @Contact This email address is being protected from spambots. You need JavaScript enabled to view it.
* @Lastrevision $Date: 2016-06-13 14:24:56 +0100 (Mon, 13 Jun 2016) $
*
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die( 'Restricted access' );

jimport('joomla.plugin.plugin');

/**
* Search Plugin for Macrotone Rialto
*
* @package Joomla
* @subpackage Rialto
*/
class plgSearchRialto extends JPlugin
{
/**
* Get an array of search areas
*
* @return array
*/
function &onContentSearchAreas()
{
static $areas = array('rialto' => 'Rialto');
return $areas;
}

/**
* Rialto search. Gets an array of objects, each
* of which contains the instance variables title, text,
* href, section, created, and browsernav
*
* @param string $text Search string
* @param string $phrase Matching option, exact|any|all
* @param string $ordering What to order by, newest|oldest|popular|alpha|category
* @param array $areas Areas in which to search, null if search all
* @return array Objects representing foobars
*/
function onContentSearch($text, $phrase='', $ordering='', $areas=null)
{
// check we can handle the requested search
if (is_array($areas) && !in_array('rialto', $areas)) {
return array();
}

// get the things we will need
$db = JFactory::getDBO();

// build SQL conditions WHERE clause
$conditions = '';

switch ($phrase) {
case 'exact':
// build an exact match LIKE condition
$text = $db->Quote('%'.$db->escape($text, true).'%', false);
$conditions = $db->quoteName('e.title') . " LIKE $text" . " OR " . $db->quoteName('e.description') . " LIKE $text";
break;
case 'all':
case 'any':
default:
// prepare the words individually
$wordConditions = array();
foreach (preg_split("~\s+~", $text) as $word) {
$word = $db->Quote('%'.$db->escape($word, true).'%', false);
$wordConditions[] = $db->quoteName('e.title') . " LIKE $word" . " OR " . $db->quoteName('e.description') . " LIKE $word";
}
// determine the glue and put it all together!
$glue = ($phrase == 'all') ? ') AND (' : ') OR (';
$conditions = '('.implode($glue, $wordConditions).')';
break;
}
}

// determine ordering
switch ($ordering) {
case 'popular':
$order = $db->quoteName('hits') . ' DESC';
break;
case 'alpha':
case 'category':
$order = $db->quoteName('category_id') . ' ASC';
break;
case "oldest":
$order = $db->quoteName('created') . ' ASC';
break;
case "newest":
default:
$order = $db->quoteName('created') . ' DESC';
break;
}

// complete the query
$query = 'SELECT e.id, e.title AS title, e.description AS text, e.date_created AS created,'
. 'c.title AS section, '
. 'e.id AS entryid, '
. 'e.alias AS entryalias, '
. 'c.id AS categoryid, '
. 'c.alias AS categoryalias, '
. "CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(':', c.id, c.alias) ELSE c.id END as catslug, "
. "CASE WHEN CHAR_LENGTH(e.alias) THEN CONCAT_WS(':', e.id, e.alias) ELSE e.id END as slug, "
. $db->Quote('2') . ' AS browsernav '
. ' FROM #__rialto_entries e, #__rialto_categories c'
. " WHERE ($conditions) AND e.category_id = c.id"
. ' AND e.state = 1'
. " ORDER BY $order";

$db->setQuery($query);
$rows = $db->loadObjectList();

// get Rialto Itemid
$sqlitemid = "SELECT id FROM ".$db->quoteName( '#__menu')." WHERE link LIKE '%com_rialto%' AND parent_id = '0' AND published = '1'";
$db->setQuery( $sqlitemid);
$itemid = $db->loadResult();

foreach($rows as $key => $row) {
$rows[$key]->href = 'index.php?option=com_rialto&view=entry&catid=' . $row->catslug . '&entry=' . $row->slug . '&Itemid=' . $itemid;
}

return $rows;
}
}

Please Log in or Create an account to join the conversation.

7 years 9 months ago #6 by chrisc
Hmm visually the file you posted looks fine, so I am very puzzled as to why the search is failing. Even more so since it is working fine on my test sites.

I am also puzzled as to why the email is not sent although this a a completely different problem to the search issue. The mail change between 1.2.2 and 1.3.0 was trivial and again on my test sites it is working fine. I also have not had any reported problems other than your own against Rialto 1.3.0 so I would be keen ti get them resolved.

You may find difficulties reverting back to the previous version due to the entry table structure change.. The only way I can think that this can be progressed is if I look at you specific site and try a few changes (if required). To do this I would require the details of a back end admin account, a front end user account, together with FTP access so that I could modify any underlying php file. These together with the site details should enable it to be resolved fastest. If this is a 'live' site then I would obviously take great care with anything I modify. If you wish me to do this then if you could provide me the details in a email to our support address at macrotoneconsulting,co.uk . If you are unwilling or unable to provide these details, then that is fine, although I am struggling to resolve a problem that I can not replicate. A bit like arm-wrestling with your hands tied behind your back.

Regards

If you are using our extensions please leave a review at the JED: IP Mapping | Issue Tracker | JAudit | Password Control

Please Log in or Create an account to join the conversation.

Time to create page: 0.187 seconds
Go To Top

Joomla! Debug Console

Session

Profile Information

Memory Usage

Database Queries