#1
|
|||
|
|||
![]()
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 .= ' <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 .= ' <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; } /***************************************************************************************/ Code:
$advfields =& $this->get('AdvancedSearchFields'); . . $this->assignRef('advfields', $advfields); 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); 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') { ?> <a href="<?php echo $this->linkAdvancedSearch; ?>"><?php echo JText::_('Advanced Search'); ?></a><?php } ?> <input type="hidden" name="view" value="search" /> </form> 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') ?>" /> <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> 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} /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
|
|||
|
|||
![]()
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:
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:
|
#3
|
|||
|
|||
![]()
Can I see your files?
Just past them here as zipped. Sergio Last edited by ssaguiar; 11-24-2008 at 09:15 PM. |
#4
|
|||
|
|||
![]()
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:
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 .= ' <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 .= ' <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') ?>" /> <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 /> I dare say I have missed something, but at the moment the extra fields are not appearing. Any help is gratefully appreciated. Regards, |
#5
|
|||
|
|||
![]()
I will zip them up and post to you.
Thanks |
#6
|
|||
|
|||
![]()
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. |
#7
|
|||
|
|||
![]()
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) { ?> Code:
<?php } ?> 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
|
|||
|
|||
![]()
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! |
#9
|
|||
|
|||
![]()
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.
|
#10
|
|||
|
|||
![]()
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 Last edited by ssaguiar; 11-24-2008 at 11:33 PM. |
#11
|
|||
|
|||
![]()
Thanks, but still no luck. I have an idea. Ill report back should it work!
|
#12
|
|||
|
|||
![]() Quote:
Sergio |
#13
|
|||
|
|||
![]()
I just uploaded your file:
(/components/com_hotproperty/views/home/tmpl/default.php) to my site and it worked fine. Sergio |
#14
|
|||
|
|||
![]()
hey ssaguiar! please fix error my file!
thanks! 1- /components/com_hotproperty/views/home/tmpl/default.php Quote:
Quote:
3 - /components/com_hotproperty/views/home/view.html.php Quote:
thank you so much! |
#15
|
|||
|
|||
![]()
Dear omaichotnho:
Can you please post what is the problem? Do you have a link where we can see it? Thanks Sergio |
#16
|
|||
|
|||
![]() Quote:
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |