Go Back   Mosets Community > Archives > Mosets Hot Property 1.0 > Discussions, Troubleshooting and Problems

 
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-10-2008, 08:15 PM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default Advanced search in front page

Hi to all friends.

This mod is only for the hp 1.0.

After burning some neurons, I got it to work.
If you want to have the advanced search form in your front page, you have to do this:

In the file /components/com_hotproperty/models/home.php add, at it's end, a copy of the function getAdvancedSearchFields():

Code:
/***************************************************************************************/
	function getAdvancedSearchFields()
	{
		global $mainframe, $hp_use_advsearch;

		if ($hp_use_advsearch <> '1') {
			$mainframe->redirect( 'index.php?option=com_hotproperty' );
	   	}

		$sql = "SELECT * FROM #__hp_prop_ef WHERE search=1 AND published=1 AND hidden=0 ORDER BY iscore DESC,  ordering ASC";
		$this->_db->setQuery($sql);
		$rows = $this->_db->loadObjectList();

		$i = 0;
		foreach($rows AS $row) {

			$fields[$i]->name = $row->name;
			$fields[$i]->caption = $row->search_caption;

			if ( !isset($fields[$i]->input) ) $fields[$i]->input = '';

			unset($list);

			# Handle core field's search
			if ($row->iscore) {

				# ------------ Type
				if ($row->name == "type") {
					# Select published types
					$this->_db->setQuery( 'SELECT * FROM #__hp_prop_types AS t'
						. ' WHERE t.published=1'
						. ' ORDER BY t.ordering ASC' );
					$types = $this->_db->loadObjectList();

					$search_types = array();
					$search_types[] = JHTML::_( 'select.option', 0, JText::_( 'Any Types' ) );
					foreach($types AS $type) { 
						$search_types[] = JHTML::_( 'select.option', $type->id, $type->name );
					}

					$fields[$i]->input = JHTML::_('select.genericlist', $search_types, $row->name, 'class="formtext" size="1"', 'value', 'text', '0' );
				} 
				# ------------ Price
				elseif ($row->name == "price") {
					$fields[$i]->input = JHTML::_( 'range.text', $row->name, 'size="8" class="formtext"');
				}
				# ------------ Featured
				elseif ($row->name == "featured") {
					$fields[$i]->input .= ' <input type="checkbox" name="'.$row->name.'" value="1" /> ';
				}
				# ------------ Agent
				elseif ($row->name == "agent") {
					# Get Agents that has at least one property
					$this->_db->setQuery("SELECT a.*, COUNT(p.id) AS properties, c.id AS companyid, c.name AS company FROM (#__hp_agents AS a, #__hp_prop_types AS t)"
						.	"\nLEFT JOIN #__hp_companies AS c ON c.id=a.company"
						.	"\nLEFT JOIN #__hp_properties AS p ON p.agent=a.id"
						.	"\nWHERE t.id=p.type"
						. "\n AND p.published='1' AND p.approved='1' AND t.published='1'"
						. "\n	AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())"
						. "\n	AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())"
						.	"\nGROUP BY p.agent");
					$agents = $this->_db->loadObjectList();

					$search_agents = array();
					$search_agents[] = JHTML::_( 'select.option', 0, JText::_( 'Any Agents' ) );
					foreach($agents AS $agent) { 
						$search_agents[] = JHTML::_( 'select.option', $agent->id, $agent->name );
					}

					$fields[$i]->input = JHTML::_('select.genericlist', $search_agents, $row->name, 'class="formtext" size="1"', 'value', 'text', '0' );
					
				}
				# ------------ Company
				elseif ($row->name == "company") {
					# Get Companies that has at least one property
					$this->_db->setQuery("SELECT c.name, c.id FROM #__hp_companies AS c"
						.	"\nLEFT JOIN #__hp_agents AS a ON c.id=a.company"
						.	"\nLEFT JOIN #__hp_properties AS p ON p.agent=a.id"
						.	"\nLEFT JOIN #__hp_prop_types AS t ON t.id=p.type"
						.	"\nWHERE t.id=p.type"
						. "\n AND p.published='1' AND p.approved='1' AND t.published='1'"
						. "\n	AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())"
						. "\n	AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())"
						.	"\nGROUP BY a.company");
					$companies = $this->_db->loadObjectList();

					$search_companies = array();
					$search_companies[] = JHTML::_( 'select.option', 0, JText::_( 'Any Companies' ) );
					foreach($companies AS $company) { 
						$search_companies[] = JHTML::_( 'select.option', $company->id, $company->name );
					}

					$fields[$i]->input = JHTML::_( 'select.genericlist', $search_companies, $row->name, 'class="formtext" size="1"',	'value', 'text', '0');

				}
				# ------------ Hits
				elseif ($row->name == "hits") {
					$search_hits = array();
					$search_hits[] = JHTML::_( 'select.option', 0, JTEXT::_( 'Less Than' ));
					$search_hits[] = JHTML::_( 'select.option', 1, JTEXT::_( 'More Than' ));

					$fields[$i]->input = JHTML::_( 'select.genericlist', $search_hits, 'hits_range', 'class="formtext" size="1"',	'value', 'text', '1');
					$fields[$i]->input .= '&nbsp; <input type="text" name="hits" class="formtext" size="8" />';
				}
				# ------------ Created
				elseif ($row->name == "created") {
					# Get min & max year from available properties
					$sql = 'SELECT MIN(created) AS start, MAX(created) AS end FROM #__hp_properties AS p'
						. ' LEFT JOIN #__hp_prop_types AS t ON p.type = t.id'
						. ' WHERE p.published=1 AND p.approved=1 AND t.published=1'
						. ' AND (publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'
						. ' AND (publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'
						. ' AND created <> \'0000-00-00 00:00:00\'';
					$this->_db->setQuery($sql);
					$created = $this->_db->loadObject();

					$fields[$i]->input = JHTML::_( 'range.date', $row->name, 'class="formtext" size="1"', strtotime($created->start), strtotime($created->end) );
				}
				# ------------ Modified
				elseif ($row->name == "modified") {
					# Get min & max year from available properties
					$sql = 'SELECT MIN(modified) AS start, MAX(modified) AS end FROM #__hp_properties AS p'
						. ' LEFT JOIN #__hp_prop_types AS t ON p.type = t.id'
						. ' WHERE p.published=1 AND p.approved=1 AND t.published=1'
						. ' AND (publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'
						. ' AND (publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'
						. ' AND created <> \'0000-00-00 00:00:00\'';
					$this->_db->setQuery($sql);
					$modified = $this->_db->loadObject();

					$fields[$i]->input = JHTML::_( 'range.date', $row->name, 'class="formtext" size="1"', strtotime($modified->start), strtotime($modified->end) );
					
				}
				# Other Core fields will use normal inputbox
				# Postcode, Name, State, Country, Suburb, Intro Text, Full Text
				else {
					$fields[$i]->input = ' <input type="text" name="'.$row->name.'" size="35" class="formtext" /> ';
				}

			} 
			# Non-core Extra Fields
			else {
				if ($row->search_type == "range_1") {
					$range_1_options = array();
					$range_1_options[] = JHTML::_( 'select.option', 0, JTEXT::_( 'Less Than') );
					$range_1_options[] = JHTML::_( 'select.option', 1, JTEXT::_( 'More Than') );

					$fields[$i]->input = JHTML::_( 'select.genericlist', $range_1_options, $row->name."_range", 'class="formtext" size="1"',	'value', 'text', '1');
					$fields[$i]->input .= '&nbsp; <input type="text" name="'.$row->name.'" class="formtext" size="'.$row->size.'" />';
				} 
				elseif ($row->search_type == "range_2") {
					$fields[$i]->input = JHTML::_( 'range.text', $row->name, 'size="'.$row->size.'" class="formtext"');
				}
				elseif ($row->field_type == "link" || $row->field_type == "text" || $row->field_type == "formtext") {
					$fields[$i]->input = ' <input type="text" name="'.$row->name.'" size="'.(($row->field_type == "multitext") ? '20' : $row->size).'" class="formtext" /> ';
				}
				elseif ( $row->field_type == "selectlist" ) {
					$olist_translated_caption = explode("|",$row->field_elements);
					// $olist = explode("|",$rows_elements[$row->name]->field_elements);
					$olist = explode("|",$row->field_elements);
					$list[] = JHTML::_( 'select.option', ' ', ' ');
					$j=0;
					foreach($olist AS $li) { 
						$list[] = JHTML::_( 'select.option', trim($li),$olist_translated_caption[$j++] );
					}
					$fields[$i]->input = JHTML::_( 'select.genericlist', $list, $row->name, 'class="formtext" size="1"',	'value', 'text', ' ');
				}
				elseif ( $row->field_type == "radiobutton" ) {
					$olist_translated_caption = explode("|",$row->field_elements);
					// $olist = explode("|",$rows_elements[$row->name]->field_elements);
					$olist = explode("|",$row->field_elements);
					$j=0;
					foreach($olist AS $li) { 
						$fields[$i]->input .= '<input type="radio" name="'.$row->name.'" value="'.trim($li).'"> '.trim($olist_translated_caption[$j++]). "<br />";
					}
				}
				elseif ( $row->field_type == "checkbox" ) {
					$olist_translated_caption = explode("|",$row->field_elements);
					// $olist = explode("|",$rows_elements[$row->name]->field_elements);
					$olist = explode("|",$row->field_elements);
					$j=0;				
					foreach($olist AS $li) { 
						$fields[$i]->input .= "<input type='checkbox' name='".$row->name."[]' value='".trim($li)."'> ".trim($olist_translated_caption[$j++]). "<br />";
					}
				} elseif ( $row->field_type == "selectmultiple" ) {
					$olist_translated_caption = explode("|",$row->field_elements);
					// $olist = explode("|",$rows_elements[$row->name]->field_elements);
					$olist = explode("|",$row->field_elements);
					$fields[$i]->input .= "<select multiple name='".$row->name."[]' size='".$row->size."' class='formtext'>";
					$j=0;
					foreach($olist AS $li) { 
						$fields[$i]->input .= "<option value='".$li."' > ".trim($olist_translated_caption[$j++]). "</option>";
					}
					$fields[$i]->input .= "</select>";
				}

			}
			$i++;
		}
		return $fields;
	}
/***************************************************************************************/
Then, in the file /components/com_hotproperty/views/home/view.html.php I added this:

Code:
$advfields  =& $this->get('AdvancedSearchFields');
.
.
$this->assignRef('advfields',	$advfields);
So, the code looks:
Code:
		$properties		=& $this->get('data');
		$total			=& $this->get('total');
		$fields			=& $this->get('fields');
		$advfields  =& $this->get('AdvancedSearchFields');
		$types			=& $this->get('types');
		$typesCount 	=& $this->get('typesCount');
		$typesProperty	=& $this->get('typesProperty');
		
		$this->assignRef('properties',	$properties);
		$this->assignRef('types',	$types);
		$this->assignRef('typesCount',	$typesCount);
		$this->assignRef('typesProperty',	$typesProperty);
		$this->assignRef('total',	$total);
		$this->assignRef('fields',	$fields);
		$this->assignRef('advfields',	$advfields);
Now, in the front page's file (/components/com_hotproperty/views/home/tmpl/default.php), I changed the code from the search to advanced search from:

Code:
		<form action="<?php echo JRoute::_( 'index.php?option=com_hotproperty' ) ?>" method="POST" name="searchfrm">
		<strong><?php echo JText::_('Search Property:'); ?></strong>
		<input type="text" name="search" class="inputbox" />
		<input type="submit" class="button" value="<?php echo JText::_('Search'); ?>" /><?php
		if ($this->hp_use_advsearch == '1') {
		?>&nbsp;<a href="<?php echo $this->linkAdvancedSearch; ?>"><?php echo JText::_('Advanced Search'); ?></a><?php
		}
		?>
		<input type="hidden" name="view" value="search" />
		</form>
To:

Code:
	<form action="<?php echo JRoute::_("index.php?option=com_hotproperty&task=advsearch"); ?>" method="POST" name="searchfrm">
	<?php	$i = 1;	?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="white">
	<tr>
	<td>
	<table width="400px" border="0" cellspacing="1" cellpadding="0" class="medium" align="center">
	<tr>
	<td>
	<table width="398px" border="0" cellspacing="0" cellpadding="2" class="white">

	<TR>
		<TD COLSPAN="2" CLASS="customlighterblue"><SPAN CLASS="whitetext"><B><?php echo JText::_('Advanced Search'); ?></B></SPAN></TD>
	</TR>

	<?php
		foreach ($this->advfields AS $advfield)
		{
			echo "<tr>";
			echo "<th>";
			echo "<b>".$advfield->caption;
			echo "</th>";
			echo "<td class=\"smaller\">".$advfield->input."</td>";
			echo "</tr>";
			echo "<tr><td colspan=\"2\" style=\"font-size:0px;\"><hr/></td></tr>";
		}
	?>

	<tr><td colspan="2" align="left" CLASS="customlighterblue"><input type="reset" value="<?php echo JText::_('Reset') ?>" />&nbsp;<input type="submit" value="<?php echo JText::_('Search'); ?>" /></td></tr>

	</table>
	</td>
	</tr>
	</table>
	</td>
	</tr>
	</table>
	<input type="hidden" name="search" value="1" />
	</form>
The css code, to have the classes above, is:
Code:
.customlighterblue {background-color: #E8EDF6;}
.medium {background-color: #CCCCCC}
.white {background-color: #FFFFFF}
.smaller {font-family: arial, helvetica, sans-serif; font-size: 11px}
.corpblue {background-color: #6D8CB3}
.whitetext {font-family: arial, helvetica, sans-serif; font-size: 10pt; color: #FFFFFF}

.formtext {font-family:  arial, Helvetica, sans-serif; font-size: 12px; color: #000000;background-color:#fff; border-color: #ccc; border-width: 1px; border-style: solid}
.formtext2 {font-family:  arial, Helvetica, sans-serif; font-size: 12px; color:#000000; background-color:#ffffcc;border-color: #ccc; border-width: 1px; border-style: solid}
.titletext {font-family: arial, helvetica, sans-serif; font-size: 10pt; color:#FF6600}
This must be added at the end of the css file at:
/media/com_hotproperty/css/default.css
(default.css is the css file I use, use in your default css file (most of the time is the same default.css).

That's it. It works very well.

Sergio

Last edited by ssaguiar; 11-10-2008 at 08:18 PM.
  #2  
Old 11-24-2008, 08:45 PM
danieljfulbrook danieljfulbrook is offline
Mosets'd
 
Join Date: Nov 2008
Posts: 16
Default

Hi,

Thank you posting on this problem.

Although I have done everything (reasonably certain anyway) correctly the advanced fields are still not appearing on the homepage.

Ideally i want the location search to remain but include:
  • price
  • date created

As filters.

I followed your guide coping and pasting code, yet when i refresh the page there are no noticeable changes.

I'm positioning search mod_hp_search within my template using "position 3".


One thing im not certain on is inserting the Advanced code in home.php

Currently my home.php file is ending with:

PHP Code:
$fields[$i]->input .= "</select>";
                }

            }
            
$i++;
        }
        return 
$fields;
    }
/***************************************************************************************/


?> 
  #3  
Old 11-24-2008, 09:03 PM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

Can I see your files?
Just past them here as zipped.

Sergio

Last edited by ssaguiar; 11-24-2008 at 09:15 PM.
  #4  
Old 11-24-2008, 09:32 PM
danieljfulbrook danieljfulbrook is offline
Mosets'd
 
Join Date: Nov 2008
Posts: 16
Default

Hi Sergio,

Firstly thanks so much for coming back so quickly, I'm using HP 1.0.0b3.

I appreciate your efforts to get the advanced search on the homepage. I think you are the only person to have covered this in the latest version of HP.

On to the problem...

I reference home.php as you said we need to amend the code in this file.

Quote:
In the file /components/com_hotproperty/models/home.php add, at it's end, a copy of the function getAdvancedSearchFields():
I followed these instructions and now the home.php code looks like this:


HTML Code:
<?php
defined('_JEXEC') or die();

jimport('joomla.application.component.model');

class HotpropertyModelHome extends JModel {

	var $types = null;
	var $_property	= null;
	
	function getData()
	{
		// Lets load the content if it doesn't already exist
		if (empty($this->_data))
		{
			global $hp_fp_featured_count;
			
			$limit		= JRequest::getVar('limit', $hp_fp_featured_count, '', 'int');
			$limitstart	= JRequest::getVar('limitstart', 0, '', 'int');
			
			$this->_property = new HotpropertyHelperProperty($this->_db);
			$this->_property->setType('featured');
			$this->_data = $this->_property->getProperty($limitstart,$limit);
			
		}

		return $this->_data;
	}
	
	function getTotal()
	{
		// Lets load the content if it doesn't already exist
		if (empty($this->_total))
		{
			$this->_db->setQuery( HotpropertyHelperQuery::buildPropertyCountQuery('p.featured=1') );
			$this->_total = $this->_db->loadResult();
		}
		return $this->_total;
	}
	
	function addCondition($condition)
	{
		$this->conditions[] = $condition;
	}
	
	function getFields()
	{
		return $this->_property->getFields();
	}

	/*
	 * Select published types
	 */
	function getTypes()
	{
		$this->_db->setQuery( 'SELECT * FROM #__hp_prop_types AS t WHERE t.published=1 ORDER BY t.ordering ASC' );
		$this->types = $this->_db->loadObjectList();
		return $this->types;
	}

	/*
	 * Get the number of records for each type
	 */
	function getTypesCount()
	{
		$this->_db->setQuery( 'SELECT COUNT(*) AS total, type FROM #__hp_properties'
			. ' WHERE published=1 AND approved=1'
			. ' AND (publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'
			. ' AND (publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'
			. ' GROUP BY type' );
		return $this->_db->loadObjectList('type');
	}
	
	/*
	 * 	Get the top 3 properties under every published types.
	 */
	function getTypesProperty()
	{
		if(!isset($this->types))
		{
			$types = $this->getTypes();
		} else
		{
			$types = $this->types;
		}
		$types_hotproperty = array();
		foreach($types AS $t)
		{
			$this->_db->setQuery( 'SELECT p.name, p.id FROM #__hp_properties AS p'
				. ' LEFT JOIN #__hp_prop_types AS t ON t.id=p.type'
				. ' WHERE p.published=1 AND p.approved=1 AND t.published=1 AND type=' . $t->id
				. ' AND (p.publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'
				. ' AND (p.publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'
				. ' ORDER BY p.hits DESC'
				. ' LIMIT 0,3');
			$types_hotproperty[$t->id] = $this->_db->loadObjectList();
		}
		return $types_hotproperty;
	}
	
	

	
	
	
}


	/***************************************************************************************/
	function getAdvancedSearchFields()
	{
		global $mainframe, $hp_use_advsearch;

		if ($hp_use_advsearch <> '1') {
			$mainframe->redirect( 'index.php?option=com_hotproperty' );
	   	}

		$sql = "SELECT * FROM #__hp_prop_ef WHERE search=1 AND published=1 AND hidden=0 ORDER BY iscore DESC,  ordering ASC";
		$this->_db->setQuery($sql);
		$rows = $this->_db->loadObjectList();

		$i = 0;
		foreach($rows AS $row) {

			$fields[$i]->name = $row->name;
			$fields[$i]->caption = $row->search_caption;

			if ( !isset($fields[$i]->input) ) $fields[$i]->input = '';

			unset($list);

			# Handle core field's search
			if ($row->iscore) {

				# ------------ Type
				if ($row->name == "type") {
					# Select published types
					$this->_db->setQuery( 'SELECT * FROM #__hp_prop_types AS t'
						. ' WHERE t.published=1'
						. ' ORDER BY t.ordering ASC' );
					$types = $this->_db->loadObjectList();

					$search_types = array();
					$search_types[] = JHTML::_( 'select.option', 0, JText::_( 'Any Types' ) );
					foreach($types AS $type) { 
						$search_types[] = JHTML::_( 'select.option', $type->id, $type->name );
					}

					$fields[$i]->input = JHTML::_('select.genericlist', $search_types, $row->name, 'class="formtext" size="1"', 'value', 'text', '0' );
				} 
				# ------------ Price
				elseif ($row->name == "price") {
					$fields[$i]->input = JHTML::_( 'range.text', $row->name, 'size="8" class="formtext"');
				}
				# ------------ Featured
				elseif ($row->name == "featured") {
					$fields[$i]->input .= ' <input type="checkbox" name="'.$row->name.'" value="1" /> ';
				}
				# ------------ Agent
				elseif ($row->name == "agent") {
					# Get Agents that has at least one property
					$this->_db->setQuery("SELECT a.*, COUNT(p.id) AS properties, c.id AS companyid, c.name AS company FROM (#__hp_agents AS a, #__hp_prop_types AS t)"
						.	"\nLEFT JOIN #__hp_companies AS c ON c.id=a.company"
						.	"\nLEFT JOIN #__hp_properties AS p ON p.agent=a.id"
						.	"\nWHERE t.id=p.type"
						. "\n AND p.published='1' AND p.approved='1' AND t.published='1'"
						. "\n	AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())"
						. "\n	AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())"
						.	"\nGROUP BY p.agent");
					$agents = $this->_db->loadObjectList();

					$search_agents = array();
					$search_agents[] = JHTML::_( 'select.option', 0, JText::_( 'Any Agents' ) );
					foreach($agents AS $agent) { 
						$search_agents[] = JHTML::_( 'select.option', $agent->id, $agent->name );
					}

					$fields[$i]->input = JHTML::_('select.genericlist', $search_agents, $row->name, 'class="formtext" size="1"', 'value', 'text', '0' );
					
				}
				# ------------ Company
				elseif ($row->name == "company") {
					# Get Companies that has at least one property
					$this->_db->setQuery("SELECT c.name, c.id FROM #__hp_companies AS c"
						.	"\nLEFT JOIN #__hp_agents AS a ON c.id=a.company"
						.	"\nLEFT JOIN #__hp_properties AS p ON p.agent=a.id"
						.	"\nLEFT JOIN #__hp_prop_types AS t ON t.id=p.type"
						.	"\nWHERE t.id=p.type"
						. "\n AND p.published='1' AND p.approved='1' AND t.published='1'"
						. "\n	AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())"
						. "\n	AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())"
						.	"\nGROUP BY a.company");
					$companies = $this->_db->loadObjectList();

					$search_companies = array();
					$search_companies[] = JHTML::_( 'select.option', 0, JText::_( 'Any Companies' ) );
					foreach($companies AS $company) { 
						$search_companies[] = JHTML::_( 'select.option', $company->id, $company->name );
					}

					$fields[$i]->input = JHTML::_( 'select.genericlist', $search_companies, $row->name, 'class="formtext" size="1"',	'value', 'text', '0');

				}
				# ------------ Hits
				elseif ($row->name == "hits") {
					$search_hits = array();
					$search_hits[] = JHTML::_( 'select.option', 0, JTEXT::_( 'Less Than' ));
					$search_hits[] = JHTML::_( 'select.option', 1, JTEXT::_( 'More Than' ));

					$fields[$i]->input = JHTML::_( 'select.genericlist', $search_hits, 'hits_range', 'class="formtext" size="1"',	'value', 'text', '1');
					$fields[$i]->input .= '&nbsp; <input type="text" name="hits" class="formtext" size="8" />';
				}
				# ------------ Created
				elseif ($row->name == "created") {
					# Get min & max year from available properties
					$sql = 'SELECT MIN(created) AS start, MAX(created) AS end FROM #__hp_properties AS p'
						. ' LEFT JOIN #__hp_prop_types AS t ON p.type = t.id'
						. ' WHERE p.published=1 AND p.approved=1 AND t.published=1'
						. ' AND (publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'
						. ' AND (publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'
						. ' AND created <> \'0000-00-00 00:00:00\'';
					$this->_db->setQuery($sql);
					$created = $this->_db->loadObject();

					$fields[$i]->input = JHTML::_( 'range.date', $row->name, 'class="formtext" size="1"', strtotime($created->start), strtotime($created->end) );
				}
				# ------------ Modified
				elseif ($row->name == "modified") {
					# Get min & max year from available properties
					$sql = 'SELECT MIN(modified) AS start, MAX(modified) AS end FROM #__hp_properties AS p'
						. ' LEFT JOIN #__hp_prop_types AS t ON p.type = t.id'
						. ' WHERE p.published=1 AND p.approved=1 AND t.published=1'
						. ' AND (publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'
						. ' AND (publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'
						. ' AND created <> \'0000-00-00 00:00:00\'';
					$this->_db->setQuery($sql);
					$modified = $this->_db->loadObject();

					$fields[$i]->input = JHTML::_( 'range.date', $row->name, 'class="formtext" size="1"', strtotime($modified->start), strtotime($modified->end) );
					
				}
				# Other Core fields will use normal inputbox
				# Postcode, Name, State, Country, Suburb, Intro Text, Full Text
				else {
					$fields[$i]->input = ' <input type="text" name="'.$row->name.'" size="35" class="formtext" /> ';
				}

			} 
			# Non-core Extra Fields
			else {
				if ($row->search_type == "range_1") {
					$range_1_options = array();
					$range_1_options[] = JHTML::_( 'select.option', 0, JTEXT::_( 'Less Than') );
					$range_1_options[] = JHTML::_( 'select.option', 1, JTEXT::_( 'More Than') );

					$fields[$i]->input = JHTML::_( 'select.genericlist', $range_1_options, $row->name."_range", 'class="formtext" size="1"',	'value', 'text', '1');
					$fields[$i]->input .= '&nbsp; <input type="text" name="'.$row->name.'" class="formtext" size="'.$row->size.'" />';
				} 
				elseif ($row->search_type == "range_2") {
					$fields[$i]->input = JHTML::_( 'range.text', $row->name, 'size="'.$row->size.'" class="formtext"');
				}
				elseif ($row->field_type == "link" || $row->field_type == "text" || $row->field_type == "formtext") {
					$fields[$i]->input = ' <input type="text" name="'.$row->name.'" size="'.(($row->field_type == "multitext") ? '20' : $row->size).'" class="formtext" /> ';
				}
				elseif ( $row->field_type == "selectlist" ) {
					$olist_translated_caption = explode("|",$row->field_elements);
					// $olist = explode("|",$rows_elements[$row->name]->field_elements);
					$olist = explode("|",$row->field_elements);
					$list[] = JHTML::_( 'select.option', ' ', ' ');
					$j=0;
					foreach($olist AS $li) { 
						$list[] = JHTML::_( 'select.option', trim($li),$olist_translated_caption[$j++] );
					}
					$fields[$i]->input = JHTML::_( 'select.genericlist', $list, $row->name, 'class="formtext" size="1"',	'value', 'text', ' ');
				}
				elseif ( $row->field_type == "radiobutton" ) {
					$olist_translated_caption = explode("|",$row->field_elements);
					// $olist = explode("|",$rows_elements[$row->name]->field_elements);
					$olist = explode("|",$row->field_elements);
					$j=0;
					foreach($olist AS $li) { 
						$fields[$i]->input .= '<input type="radio" name="'.$row->name.'" value="'.trim($li).'"> '.trim($olist_translated_caption[$j++]). "<br />";
					}
				}
				elseif ( $row->field_type == "checkbox" ) {
					$olist_translated_caption = explode("|",$row->field_elements);
					// $olist = explode("|",$rows_elements[$row->name]->field_elements);
					$olist = explode("|",$row->field_elements);
					$j=0;				
					foreach($olist AS $li) { 
						$fields[$i]->input .= "<input type='checkbox' name='".$row->name."[]' value='".trim($li)."'> ".trim($olist_translated_caption[$j++]). "<br />";
					}
				} elseif ( $row->field_type == "selectmultiple" ) {
					$olist_translated_caption = explode("|",$row->field_elements);
					// $olist = explode("|",$rows_elements[$row->name]->field_elements);
					$olist = explode("|",$row->field_elements);
					$fields[$i]->input .= "<select multiple name='".$row->name."[]' size='".$row->size."' class='formtext'>";
					$j=0;
					foreach($olist AS $li) { 
						$fields[$i]->input .= "<option value='".$li."' > ".trim($olist_translated_caption[$j++]). "</option>";
					}
					$fields[$i]->input .= "</select>";
				}

			}
			$i++;
		}
		return $fields;
	}
/***************************************************************************************/


?>


I then changed /components/com_hotproperty/views/home/view.html.php to:

HTML Code:
<?php
defined('_JEXEC') or die();

jimport( 'joomla.application.component.view');

class HotpropertyViewHome extends JView
{
	function display( $tpl = null)
	{
		global $hp_use_advsearch, $hp_fp_show_search, $hp_fp_featured_count, $hp_imgdir_thumb, $hp_img_noimage_thumb, $hp_show_thumb, $hp_currency, $hp_dec_point, $hp_dec_string, $hp_thousand_sep, $hp_thousand_string;
		global $Itemid;
		
		$properties		=& $this->get('data');
		$total			=& $this->get('total');
		$fields			=& $this->get('fields');
		$advfields  =& $this->get('AdvancedSearchFields');
		$types			=& $this->get('types');
		$typesCount 	=& $this->get('typesCount');
		$typesProperty	=& $this->get('typesProperty');
		
		$this->assignRef('properties',	$properties);
		$this->assignRef('types',	$types);
		$this->assignRef('typesCount',	$typesCount);
		$this->assignRef('typesProperty',	$typesProperty);
		$this->assignRef('total',	$total);
		$this->assignRef('fields',	$fields);
		$this->assignRef('advfields',	$advfields);
		$this->assign	('hp_use_advsearch', $hp_use_advsearch);
		$this->assign	('hp_fp_show_search', $hp_fp_show_search);
		$this->assign	('fp_featured_count', $hp_fp_featured_count);
		$this->assign	('hp_imgdir_thumb', $hp_imgdir_thumb);
		$this->assign	('hp_img_noimage_thumb', $hp_img_noimage_thumb);
		$this->assign	('hp_show_thumb', $hp_show_thumb);
		$this->assign	('hp_currency', $hp_currency);
		$this->assign	('hp_dec_point', $hp_dec_point);
		$this->assign	('hp_dec_string', $hp_dec_string);
		$this->assign	('hp_thousand_sep', $hp_thousand_sep);
		$this->assign	('hp_thousand_string', $hp_thousand_string);
		$this->assign	('linkFeaturedProperties', JRoute::_("index.php?option=com_hotproperty&view=featured"));
		$this->assign	('linkAdvancedSearch', JRoute::_('index.php?option=com_hotproperty&view=advsearch'));
		$this->assign	('user', JFactory::getUser());
		$this->assign	('view', $this->_name);
		$this->assign	('Itemid', $Itemid);

		parent::display($tpl);
	}
	
	function getTypeLink($type_id) {
		return JRoute::_('index.php?option=com_hotproperty&view=type&id='.$type_id);
	}
	
	function getPropertyLink($property_id) {
		return JRoute::_('index.php?option=com_hotproperty&view=property&id='.$property_id);
	}
	
}
?>


Finally I have changed the file located at: /components/com_hotproperty/views/home/tmpl/default.php

to:

HTML Code:
<?php 
defined('_JEXEC') or die('Restricted access');
?>
<div id="con_featured1">
<div id="heading_Featured"><?php echo JText::_('Featured Title'); ?></div>
	<div id="list_featured">
	<?php 	
	foreach($this->properties AS $p)
	{
		$this->p = $p;
		echo $this->loadTemplate('property');
	}
	?>
	<br class="clearboth" />
	<?php if ($this->total > $this->fp_featured_count)
	{ 
		echo "<a href=\"". $this->linkFeaturedProperties ."\">" . JText::_('More featured properties...') . "</a>";
	} ?>
	</div>
</div>
<br />

<? if($this->hp_fp_show_search) { ?>
<div id="con_search1">
<div id="heading_Search"><?php echo JText::_('Search Title'); ?></div>
	<div id="con_search2">
		<form action="<?php echo JRoute::_("index.php?option=com_hotproperty&task=advsearch"); ?>" method="POST" name="searchfrm">
	<?php	$i = 1;	?>
	<table width="100%" border="0" cellspacing="0" cellpadding="0" class="white">
	<tr>
	<td>
	<table width="400px" border="0" cellspacing="1" cellpadding="0" class="medium" align="center">
	<tr>
	<td>
	<table width="398px" border="0" cellspacing="0" cellpadding="2" class="white">

	<TR>
		<TD COLSPAN="2" CLASS="customlighterblue"><SPAN CLASS="whitetext"><B><?php echo JText::_('Advanced Search'); ?></B></SPAN></TD>
	</TR>

	<?php
		foreach ($this->advfields AS $advfield)
		{
			echo "<tr>";
			echo "<th>";
			echo "<b>".$advfield->caption;
			echo "</th>";
			echo "<td class=\"smaller\">".$advfield->input."</td>";
			echo "</tr>";
			echo "<tr><td colspan=\"2\" style=\"font-size:0px;\"><hr/></td></tr>";
		}
	?>

	<tr><td colspan="2" align="left" CLASS="customlighterblue"><input type="reset" value="<?php echo JText::_('Reset') ?>" />&nbsp;<input type="submit" value="<?php echo JText::_('Search'); ?>" /></td></tr>

	</table>
	</td>
	</tr>
	</table>
	</td>
	</tr>
	</table>
	<input type="hidden" name="search" value="1" />
	</form>
	</div>
</div>
<br />


<?php } ?>

<div id="con_types1">
<div id="heading_Types"><?php echo JText::_('Property Types'); ?> - <a href="<?php echo JRoute::_('index.php?option=com_hotproperty&view=type&id=0'); ?>"><?php echo JText::_('View all properties'); ?></a></div>
	<div id="con_types2">
	<?php
	foreach($this->types AS $t)
	{
		if ( array_key_exists($t->id,$this->typesCount) && $this->typesCount[$t->id]->total > 0)
		{
		?>
		<div class="con_types3">
		<a class="types_title" href="<?php echo $this->getTypeLink($t->id); ?>"><?php echo $t->name ."</a>(".$this->typesCount[$t->id]->total.")"; ?><br />
		<div class="types_desc">
			<?php echo $t->desc; ?>
			<ul class="types_hp"><?php
			
			foreach($this->typesProperty[$t->id] AS $t_property)
			{
				if ($t_property->name <> "" && $t_property->id <> "")
				{
					?><li><a href="<?php echo $this->getPropertyLink($t_property->id); ?>"><?php echo $t_property->name; ?></a></li><?php
				}
				
			}
			?></ul>	<?php
			if ($this->typesCount[$t->id]->total > 3)
			{ 
				?><a href="<?php echo $this->getTypeLink($t->id); ?>"><?php echo JText::_('More'); ?></a><?php
			}
			
			?>
		</div>
		</div>
		<?php
		}
	}
	?>
	</div>
</div>
<br clear=both />
Ultimately im trying to get these extra advanced search fields to work along side the simple location search.

I dare say I have missed something, but at the moment the extra fields are not appearing.

Any help is gratefully appreciated.

Regards,
  #5  
Old 11-24-2008, 09:33 PM
danieljfulbrook danieljfulbrook is offline
Mosets'd
 
Join Date: Nov 2008
Posts: 16
Default

I will zip them up and post to you.

Thanks
  #6  
Old 11-24-2008, 09:38 PM
danieljfulbrook danieljfulbrook is offline
Mosets'd
 
Join Date: Nov 2008
Posts: 16
Default

Please find attached my 4 files.

default.css
default.php
home.php
view.html.php

As i say im calling mod_hp_search by assigning it a posistion in the module. Then putting <div><jdoc:include type="modules" name="user4" style="xhtml" /></div> into the homepage template.

This is working perfectly and bringing back the simple search.

I just cant get the extra fields in.

Any help would be so appreciated. I think this will be a thread really valuable for the community.
Attached Files
File Type: zip Working.zip (6.7 KB, 13 views)
  #7  
Old 11-24-2008, 10:18 PM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

My friend:

I can't see the error. The routines are the same.

Let's try 2 things:

1 - Just to test, remove from the file /components/com_hotproperty/views/home/tmpl/default.php this code:

Code:
<?php if($this->hp_fp_show_search) { 
?>
and
Code:
<?php } ?>
See if the form shows.

If not, try to put my /components/com_hotproperty/views/home/tmpl/default.php in place of yours (backup yours first), even if it's somehow messed up (we just want to see if the form shows up).

Let me know if the form is shown with one of these tests.

Sergio
  #8  
Old 11-24-2008, 10:55 PM
danieljfulbrook danieljfulbrook is offline
Mosets'd
 
Join Date: Nov 2008
Posts: 16
Default Mystery continues.

Hi Sergio,

Well i amended the code like you suggested and still the advanced features are failing to appear. I thought the site might be cached some how so i tried it on my iPhone and it still looked the same!

The simple search is working, but no extra fields have appeared.

I will try replacing the /components/com_hotproperty/views/home/tmpl/default.php

With yours, can you please kindly attach it or send it to me.

This is so frustrating! thanks for your patience!

Quote:
Originally Posted by ssaguiar View Post
If not, try to put my /components/com_hotproperty/views/home/tmpl/default.php in place of yours (backup yours first), even if it's somehow messed up (we just want to see if the form shows up).
  #9  
Old 11-24-2008, 11:00 PM
danieljfulbrook danieljfulbrook is offline
Mosets'd
 
Join Date: Nov 2008
Posts: 16
Default

I have also attached a screen shot of my extra fields page. In case I have done something wrong here and they are not linking up.
Attached Images
File Type: jpg fields.jpg (104.0 KB, 159 views)
  #10  
Old 11-24-2008, 11:27 PM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

You have 3 fields for the search:

- name;
- price;
- created.

Since the created most of the time has nothing, then, the only fields that will be shown are name and price.
I think this can be the problem.

Try to enable more fields as searchable.

For an example, in my site, I put these fields as searchable (see pic).

Maybe this is the problem (you'll have only 2 fields to search in form.

Sergio
Attached Images
File Type: jpg fields2.jpg (33.2 KB, 156 views)
File Type: jpg search.JPG (18.1 KB, 156 views)

Last edited by ssaguiar; 11-24-2008 at 11:33 PM.
  #11  
Old 11-24-2008, 11:54 PM
danieljfulbrook danieljfulbrook is offline
Mosets'd
 
Join Date: Nov 2008
Posts: 16
Default

Thanks, but still no luck. I have an idea. Ill report back should it work!
  #12  
Old 11-25-2008, 12:21 AM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

Quote:
Originally Posted by danieljfulbrook View Post
Thanks, but still no luck. I have an idea. Ill report back should it work!
My friend, let me know if you have any clue. It's very strange!

Sergio
  #13  
Old 11-25-2008, 02:55 AM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

I just uploaded your file:
(/components/com_hotproperty/views/home/tmpl/default.php) to my site and it worked fine.

Sergio
  #14  
Old 12-23-2008, 05:17 PM
omaichotnho omaichotnho is offline
Junior Member
 
Join Date: Dec 2008
Location: vietnam
Posts: 18
Default

hey ssaguiar! please fix error my file!
thanks!

1- /components/com_hotproperty/views/home/tmpl/default.php
Quote:
<?php

defined('_JEXEC') or die('Restricted access');

?>

<div id="con_featured1">

<div id="heading_Featured"><?php echo JText::_('Featured Title'); ?></div>

<div id="list_featured">

<?php

foreach($this->properties AS $p)

{

$this->p = $p;

echo $this->loadTemplate('property');

}

?>

<br class="clearboth" />

<?php if ($this->total > $this->fp_featured_count)

{

echo "<a href=\"". $this->linkFeaturedProperties ."\">" . JText::_('More featured properties...') . "</a>";

} ?>

</div>

</div>

<br />



<? if($this->hp_fp_show_search) { ?>

<div id="con_search1">

<div id="heading_Search"><?php echo JText::_('Search Title'); ?></div>

<div id="con_search2">










<!---form action="<?php echo JRoute::_( 'index.php?option=com_hotproperty' ) ?>" method="POST" name="searchfrm">

<strong><?php echo JText::_('Search Property:'); ?></strong>

<input type="text" name="search" class="inputbox" />

<input type="submit" class="button" value="<?php echo JText::_('Search'); ?>" /><?php

if ($this->hp_use_advsearch == '1') {

?>&nbsp;<a href="<?php echo $this->linkAdvancedSearch; ?>"><?php echo JText::_('Advanced Search'); ?></a><?php

}

?>

<input type="hidden" name="view" value="search" />

</form--->

<form action="<?php echo JRoute::_("index.php?option=com_hotproperty&task=a dvsearch"); ?>" method="POST" name="searchfrm">
<?php $i = 1; ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="white">
<tr>
<td>
<table width="400px" border="0" cellspacing="1" cellpadding="0" class="medium" align="center">
<tr>
<td>
<table width="398px" border="0" cellspacing="0" cellpadding="2" class="white">

<TR>
<TD COLSPAN="2" CLASS="customlighterblue"><SPAN CLASS="whitetext"><B><?php echo JText::_('Advanced Search'); ?></B></SPAN></TD>
</TR>

<?php
foreach ($this->advfields AS $advfield)
{
echo "<tr>";
echo "<th>";
echo "<b>".$advfield->caption;
echo "</th>";
echo "<td class=\"smaller\">".$advfield->input."</td>";
echo "</tr>";
echo "<tr><td colspan=\"2\" style=\"font-size:0px;\"><hr/></td></tr>";
}
?>

<tr><td colspan="2" align="left" CLASS="customlighterblue"><input type="reset" value="<?php echo JText::_('Reset') ?>" />&nbsp;<input type="submit" value="<?php echo JText::_('Search'); ?>" /></td></tr>

</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<input type="hidden" name="search" value="1" />
</form>












</div>

</div>

<br />

<?php } ?>



<div id="con_types1">

<div id="heading_Types"><?php echo JText::_('Property Types'); ?> - <a href="<?php echo JRoute::_('index.php?option=com_hotproperty&view=t ype&id=0'); ?>"><?php echo JText::_('View all properties'); ?></a></div>

<div id="con_types2">

<?php

foreach($this->types AS $t)

{

if ( array_key_exists($t->id,$this->typesCount) && $this->typesCount[$t->id]->total > 0)

{

?>

<div class="con_types3">

<a class="types_title" href="<?php echo $this->getTypeLink($t->id); ?>"><?php echo $t->name ."</a>(".$this->typesCount[$t->id]->total.")"; ?><br />

<div class="types_desc">

<?php echo $t->desc; ?>

<ul class="types_hp"><?php



foreach($this->typesProperty[$t->id] AS $t_property)

{

if ($t_property->name <> "" && $t_property->id <> "")

{

?><li><a href="<?php echo $this->getPropertyLink($t_property->id); ?>"><?php echo $t_property->name; ?></a></li><?php

}



}

?></ul> <?php

if ($this->typesCount[$t->id]->total > 3)

{

?><a href="<?php echo $this->getTypeLink($t->id); ?>"><?php echo JText::_('More'); ?></a><?php

}



?>

</div>

</div>

<?php

}

}

?>

</div>

</div>

<br clear=both />
2- /components/com_hotproperty/models/home.php
Quote:
<?php

defined('_JEXEC') or die();



jimport('joomla.application.component.model');



class HotpropertyModelHome extends JModel {



var $types = null;

var $_property = null;



function getData()

{

// Lets load the content if it doesn't already exist

if (empty($this->_data))

{

global $hp_fp_featured_count;



$limit = JRequest::getVar('limit', $hp_fp_featured_count, '', 'int');

$limitstart = JRequest::getVar('limitstart', 0, '', 'int');



$this->_property = new HotpropertyHelperProperty($this->_db);

$this->_property->setType('featured');

$this->_data = $this->_property->getProperty($limitstart,$limit);



}



return $this->_data;

}



function getTotal()

{

// Lets load the content if it doesn't already exist

if (empty($this->_total))

{

$this->_db->setQuery( HotpropertyHelperQuery::buildPropertyCountQuery('p .featured=1') );

$this->_total = $this->_db->loadResult();

}

return $this->_total;

}



function addCondition($condition)

{

$this->conditions[] = $condition;

}



function getFields()

{

return $this->_property->getFields();

}



/*

* Select published types

*/

function getTypes()

{

$this->_db->setQuery( 'SELECT * FROM #__hp_prop_types AS t WHERE t.published=1 ORDER BY t.ordering ASC' );

$this->types = $this->_db->loadObjectList();

return $this->types;

}



/*

* Get the number of records for each type

*/

function getTypesCount()

{

$this->_db->setQuery( 'SELECT COUNT(*) AS total, type FROM #__hp_properties'

. ' WHERE published=1 AND approved=1'

. ' AND (publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'

. ' AND (publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'

. ' GROUP BY type' );

return $this->_db->loadObjectList('type');

}



/*

* Get the top 3 properties under every published types.

*/

function getTypesProperty()

{

if(!isset($this->types))

{

$types = $this->getTypes();

} else

{

$types = $this->types;

}

$types_hotproperty = array();

foreach($types AS $t)

{

$this->_db->setQuery( 'SELECT p.name, p.id FROM #__hp_properties AS p'

. ' LEFT JOIN #__hp_prop_types AS t ON t.id=p.type'

. ' WHERE p.published=1 AND p.approved=1 AND t.published=1 AND type=' . $t->id

. ' AND (p.publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'

. ' AND (p.publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'

. ' ORDER BY p.hits DESC'

. ' LIMIT 0,3');

$types_hotproperty[$t->id] = $this->_db->loadObjectList();

}

return $types_hotproperty;

}

}















/************************************************** *************************************/
function getAdvancedSearchFields()
{
global $mainframe, $hp_use_advsearch;

if ($hp_use_advsearch <> '1') {
$mainframe->redirect( 'index.php?option=com_hotproperty' );
}

$sql = "SELECT * FROM #__hp_prop_ef WHERE search=1 AND published=1 AND hidden=0 ORDER BY iscore DESC, ordering ASC";
$this->_db->setQuery($sql);
$rows = $this->_db->loadObjectList();

$i = 0;
foreach($rows AS $row) {

$fields[$i]->name = $row->name;
$fields[$i]->caption = $row->search_caption;

if ( !isset($fields[$i]->input) ) $fields[$i]->input = '';

unset($list);

# Handle core field's search
if ($row->iscore) {

# ------------ Type
if ($row->name == "type") {
# Select published types
$this->_db->setQuery( 'SELECT * FROM #__hp_prop_types AS t'
. ' WHERE t.published=1'
. ' ORDER BY t.ordering ASC' );
$types = $this->_db->loadObjectList();

$search_types = array();
$search_types[] = JHTML::_( 'select.option', 0, JText::_( 'Any Types' ) );
foreach($types AS $type) {
$search_types[] = JHTML::_( 'select.option', $type->id, $type->name );
}

$fields[$i]->input = JHTML::_('select.genericlist', $search_types, $row->name, 'class="formtext" size="1"', 'value', 'text', '0' );
}
# ------------ Price
elseif ($row->name == "price") {
$fields[$i]->input = JHTML::_( 'range.text', $row->name, 'size="8" class="formtext"');
}
# ------------ Featured
elseif ($row->name == "featured") {
$fields[$i]->input .= ' <input type="checkbox" name="'.$row->name.'" value="1" /> ';
}
# ------------ Agent
elseif ($row->name == "agent") {
# Get Agents that has at least one property
$this->_db->setQuery("SELECT a.*, COUNT(p.id) AS properties, c.id AS companyid, c.name AS company FROM (#__hp_agents AS a, #__hp_prop_types AS t)"
. "\nLEFT JOIN #__hp_companies AS c ON c.id=a.company"
. "\nLEFT JOIN #__hp_properties AS p ON p.agent=a.id"
. "\nWHERE t.id=p.type"
. "\n AND p.published='1' AND p.approved='1' AND t.published='1'"
. "\n AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())"
. "\n AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())"
. "\nGROUP BY p.agent");
$agents = $this->_db->loadObjectList();

$search_agents = array();
$search_agents[] = JHTML::_( 'select.option', 0, JText::_( 'Any Agents' ) );
foreach($agents AS $agent) {
$search_agents[] = JHTML::_( 'select.option', $agent->id, $agent->name );
}

$fields[$i]->input = JHTML::_('select.genericlist', $search_agents, $row->name, 'class="formtext" size="1"', 'value', 'text', '0' );

}
# ------------ Company
elseif ($row->name == "company") {
# Get Companies that has at least one property
$this->_db->setQuery("SELECT c.name, c.id FROM #__hp_companies AS c"
. "\nLEFT JOIN #__hp_agents AS a ON c.id=a.company"
. "\nLEFT JOIN #__hp_properties AS p ON p.agent=a.id"
. "\nLEFT JOIN #__hp_prop_types AS t ON t.id=p.type"
. "\nWHERE t.id=p.type"
. "\n AND p.published='1' AND p.approved='1' AND t.published='1'"
. "\n AND (publish_up = '0000-00-00 00:00:00' OR publish_up <= NOW())"
. "\n AND (publish_down = '0000-00-00 00:00:00' OR publish_down >= NOW())"
. "\nGROUP BY a.company");
$companies = $this->_db->loadObjectList();

$search_companies = array();
$search_companies[] = JHTML::_( 'select.option', 0, JText::_( 'Any Companies' ) );
foreach($companies AS $company) {
$search_companies[] = JHTML::_( 'select.option', $company->id, $company->name );
}

$fields[$i]->input = JHTML::_( 'select.genericlist', $search_companies, $row->name, 'class="formtext" size="1"', 'value', 'text', '0');

}
# ------------ Hits
elseif ($row->name == "hits") {
$search_hits = array();
$search_hits[] = JHTML::_( 'select.option', 0, JTEXT::_( 'Less Than' ));
$search_hits[] = JHTML::_( 'select.option', 1, JTEXT::_( 'More Than' ));

$fields[$i]->input = JHTML::_( 'select.genericlist', $search_hits, 'hits_range', 'class="formtext" size="1"', 'value', 'text', '1');
$fields[$i]->input .= '&nbsp; <input type="text" name="hits" class="formtext" size="8" />';
}
# ------------ Created
elseif ($row->name == "created") {
# Get min & max year from available properties
$sql = 'SELECT MIN(created) AS start, MAX(created) AS end FROM #__hp_properties AS p'
. ' LEFT JOIN #__hp_prop_types AS t ON p.type = t.id'
. ' WHERE p.published=1 AND p.approved=1 AND t.published=1'
. ' AND (publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'
. ' AND (publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'
. ' AND created <> \'0000-00-00 00:00:00\'';
$this->_db->setQuery($sql);
$created = $this->_db->loadObject();

$fields[$i]->input = JHTML::_( 'range.date', $row->name, 'class="formtext" size="1"', strtotime($created->start), strtotime($created->end) );
}
# ------------ Modified
elseif ($row->name == "modified") {
# Get min & max year from available properties
$sql = 'SELECT MIN(modified) AS start, MAX(modified) AS end FROM #__hp_properties AS p'
. ' LEFT JOIN #__hp_prop_types AS t ON p.type = t.id'
. ' WHERE p.published=1 AND p.approved=1 AND t.published=1'
. ' AND (publish_up = \'0000-00-00 00:00:00\' OR publish_up <= NOW())'
. ' AND (publish_down = \'0000-00-00 00:00:00\' OR publish_down >= NOW())'
. ' AND created <> \'0000-00-00 00:00:00\'';
$this->_db->setQuery($sql);
$modified = $this->_db->loadObject();

$fields[$i]->input = JHTML::_( 'range.date', $row->name, 'class="formtext" size="1"', strtotime($modified->start), strtotime($modified->end) );

}
# Other Core fields will use normal inputbox
# Postcode, Name, State, Country, Suburb, Intro Text, Full Text
else {
$fields[$i]->input = ' <input type="text" name="'.$row->name.'" size="35" class="formtext" /> ';
}

}
# Non-core Extra Fields
else {
if ($row->search_type == "range_1") {
$range_1_options = array();
$range_1_options[] = JHTML::_( 'select.option', 0, JTEXT::_( 'Less Than') );
$range_1_options[] = JHTML::_( 'select.option', 1, JTEXT::_( 'More Than') );

$fields[$i]->input = JHTML::_( 'select.genericlist', $range_1_options, $row->name."_range", 'class="formtext" size="1"', 'value', 'text', '1');
$fields[$i]->input .= '&nbsp; <input type="text" name="'.$row->name.'" class="formtext" size="'.$row->size.'" />';
}
elseif ($row->search_type == "range_2") {
$fields[$i]->input = JHTML::_( 'range.text', $row->name, 'size="'.$row->size.'" class="formtext"');
}
elseif ($row->field_type == "link" || $row->field_type == "text" || $row->field_type == "formtext") {
$fields[$i]->input = ' <input type="text" name="'.$row->name.'" size="'.(($row->field_type == "multitext") ? '20' : $row->size).'" class="formtext" /> ';
}
elseif ( $row->field_type == "selectlist" ) {
$olist_translated_caption = explode("|",$row->field_elements);
// $olist = explode("|",$rows_elements[$row->name]->field_elements);
$olist = explode("|",$row->field_elements);
$list[] = JHTML::_( 'select.option', ' ', ' ');
$j=0;
foreach($olist AS $li) {
$list[] = JHTML::_( 'select.option', trim($li),$olist_translated_caption[$j++] );
}
$fields[$i]->input = JHTML::_( 'select.genericlist', $list, $row->name, 'class="formtext" size="1"', 'value', 'text', ' ');
}
elseif ( $row->field_type == "radiobutton" ) {
$olist_translated_caption = explode("|",$row->field_elements);
// $olist = explode("|",$rows_elements[$row->name]->field_elements);
$olist = explode("|",$row->field_elements);
$j=0;
foreach($olist AS $li) {
$fields[$i]->input .= '<input type="radio" name="'.$row->name.'" value="'.trim($li).'"> '.trim($olist_translated_caption[$j++]). "<br />";
}
}
elseif ( $row->field_type == "checkbox" ) {
$olist_translated_caption = explode("|",$row->field_elements);
// $olist = explode("|",$rows_elements[$row->name]->field_elements);
$olist = explode("|",$row->field_elements);
$j=0;
foreach($olist AS $li) {
$fields[$i]->input .= "<input type='checkbox' name='".$row->name."[]' value='".trim($li)."'> ".trim($olist_translated_caption[$j++]). "<br />";
}
} elseif ( $row->field_type == "selectmultiple" ) {
$olist_translated_caption = explode("|",$row->field_elements);
// $olist = explode("|",$rows_elements[$row->name]->field_elements);
$olist = explode("|",$row->field_elements);
$fields[$i]->input .= "<select multiple name='".$row->name."[]' size='".$row->size."' class='formtext'>";
$j=0;
foreach($olist AS $li) {
$fields[$i]->input .= "<option value='".$li."' > ".trim($olist_translated_caption[$j++]). "</option>";
}
$fields[$i]->input .= "</select>";
}

}
$i++;
}
return $fields;
}
/************************************************** *************************************/











?>

3 - /components/com_hotproperty/views/home/view.html.php
Quote:
<?php

defined('_JEXEC') or die();



jimport( 'joomla.application.component.view');



class HotpropertyViewHome extends JView

{

function display( $tpl = null)

{

global $hp_use_advsearch, $hp_fp_show_search, $hp_fp_featured_count, $hp_imgdir_thumb, $hp_img_noimage_thumb, $hp_show_thumb, $hp_currency, $hp_dec_point, $hp_dec_string, $hp_thousand_sep, $hp_thousand_string;

global $Itemid;



$properties =& $this->get('data');

$total =& $this->get('total');

$fields =& $this->get('fields');
$advfields =& $this->get('AdvancedSearchFields');

$types =& $this->get('types');

$typesCount =& $this->get('typesCount');

$typesProperty =& $this->get('typesProperty');



$this->assignRef('properties', $properties);

$this->assignRef('types', $types);

$this->assignRef('typesCount', $typesCount);

$this->assignRef('typesProperty', $typesProperty);

$this->assignRef('total', $total);

$this->assignRef('fields', $fields);
$this->assignRef('advfields', $advfields);

$this->assign ('hp_use_advsearch', $hp_use_advsearch);

$this->assign ('hp_fp_show_search', $hp_fp_show_search);

$this->assign ('fp_featured_count', $hp_fp_featured_count);

$this->assign ('hp_imgdir_thumb', $hp_imgdir_thumb);

$this->assign ('hp_img_noimage_thumb', $hp_img_noimage_thumb);

$this->assign ('hp_show_thumb', $hp_show_thumb);

$this->assign ('hp_currency', $hp_currency);

$this->assign ('hp_dec_point', $hp_dec_point);

$this->assign ('hp_dec_string', $hp_dec_string);

$this->assign ('hp_thousand_sep', $hp_thousand_sep);

$this->assign ('hp_thousand_string', $hp_thousand_string);

$this->assign ('linkFeaturedProperties', JRoute::_("index.php?option=com_hotproperty&view=f eatured"));

$this->assign ('linkAdvancedSearch', JRoute::_('index.php?option=com_hotproperty&view=a dvsearch'));

$this->assign ('user', JFactory::getUser());

$this->assign ('view', $this->_name);

$this->assign ('Itemid', $Itemid);



parent::display($tpl);

}



function getTypeLink($type_id) {

return JRoute::_('index.php?option=com_hotproperty&view=t ype&id='.$type_id);

}



function getPropertyLink($property_id) {

return JRoute::_('index.php?option=com_hotproperty&view=p roperty&id='.$property_id);

}



}

?>
please show error in that file!
thank you so much!
  #15  
Old 12-25-2008, 11:42 PM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

Dear omaichotnho:

Can you please post what is the problem?
Do you have a link where we can see it?

Thanks


Sergio
  #16  
Old 12-26-2008, 08:56 AM
omaichotnho omaichotnho is offline
Junior Member
 
Join Date: Dec 2008
Location: vietnam
Posts: 18
Default

Quote:
Originally Posted by ssaguiar View Post
Dear omaichotnho:

Can you please post what is the problem?
Do you have a link where we can see it?

Thanks


Sergio
thanks ssaguiar so replyed! you can view my website by link: http://ads-vietnam.net/realestate/
and now, i want advanced search always show in location user1 in http://ads-vietnam.net/realestate/?%20tp=1
i want make same http://pindex.vn
thank you so much!
  #17  
Old 12-27-2008, 12:55 PM
omaichotnho omaichotnho is offline
Junior Member
 
Join Date: Dec 2008
Location: vietnam
Posts: 18
Default

to ssaguiar:
u can give me your nickname! can i chatting and talking with you?
i need your help!
my site : http://ads-vietnam.net/web/
Thank so much!
  #18  
Old 12-29-2008, 10:51 PM
ssaguiar ssaguiar is offline
Mosets'd
 
Join Date: Apr 2008
Posts: 143
Default

At present moment, I am waiting to see how beta4 of hp is going to work.
After that, I will make the mods for this release.
If you are using the beta4, then you must wait as it has some problems.
If you are using beta3, then all instructions on how to implement the mod is in this thread.

I don't give suport by mp.

Sergio
  #19  
Old 01-03-2009, 07:21 PM
ssnobben ssnobben is offline
Mosets'd
 
Join Date: Nov 2006
Posts: 805
Thumbs up

Thanks Sergio!!
__________________
Success in the long run Its not about the code its about the people and community that's make it!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Advanced search like yellow page boringtao 3rd party addons & Custom Jobs 0 09-08-2008 05:26 PM


All times are GMT +8. The time now is 03:19 AM.

Copyright © 2005-2010 Mosets Consulting

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.