Need help in php script

Hello everyone,

I have no idea if you guys can help me in something related to joomla… I have joomla on my website and i have installed component for real estate…and it has quick search module to let the visitors search the properties by category,type,city,min/max beds, min/max price… but it doesnt have an option for letting visitors to search by the square meter of the properties…

can you guys help me out to add that option? I have the module files…should I post all the codes here in a post or should I upload the whole module files? tell me what should i do…
by the way I don’t have experience in php…

Thanks in advance

There is a large amount of help out in Google about Joomla and working with various modules.
You can do a search there, www.google.com, but, make sure you use the correct search words.
I would use something like Joomla, first and then the details…

Like “Joomla search module” or “Joomla adding search to module”

If you can’t figure it out give us the name of the module you installed that you want to add search to
or at least the section your want to add code to. We would need to know a little about your database
you are using, so we can help with the needed queries. Also, since this is an add-in module to the
Joomla, where you got the add-in might have a tutorial on adding more to it. But, we will try out best…

Hi Dear ErnieAlex,

The module that I’m talking about it’s already a search module for the real estate component, have a look at it right now:

so I want to add to it a new option to be like that:

Some info:

The module folder:
mod_ip_quicksearch.php
mod_ip_quicksearch.xml

[FOLDER]language
en-GB.mod_ip_quicksearch.ini

[FOLDER]tmpl
default.php
default_nodata.php


so which files you need the code of them? all?
and what info you need from the database?
the column where the M2 values are stored called sqft in table called jos_iproperty

mod_ip_quicksearch.php :

[php]defined(’_JEXEC’) or die(‘Restricted access’);

global $mainframe;
require_once(‘components’.DS.‘com_iproperty’.DS.‘helpers’.DS.‘html.helper.php’);
require_once(‘components’.DS.‘com_iproperty’.DS.‘helpers’.DS.‘query.php’);
require_once(‘components’.DS.‘com_iproperty’.DS.‘helpers’.DS.‘route.php’);
require_once(‘administrator’.DS.‘components’.DS.‘com_iproperty’.DS.‘classes’.DS.‘admin.class.php’);

$default_search_string = JText::(‘DKEYWORD’);
$default_button_text = JText::
(‘DSEARCH’);

$lists = array();
//$lists[‘category’] = modIPSearchHelper::getCatList();
$lists[‘p_low’] = ipropertyHTML::price_select_list(‘price_low’,‘class=“inputbox” style=“width: '.(($params->get(‘width’)/2)-5).'px;”’,’’, ‘’, false);
$lists[‘p_high’] = ipropertyHTML::price_select_list(‘price_high’,‘class=“inputbox” style=“width: '.(($params->get(‘width’)/2)-5).'px;”’,’’, ‘’, true);
$lists[‘cat’] = ipropertyHTML::multicatSelectList(‘cat’,‘class=“inputbox” style=“width: '.$params->get(‘width’).'px;”’, $params->get(‘qs_ptype’, ‘’));
$lists[‘stype’] = ipropertyHTML::stype_select_list(‘stype’,‘class=“inputbox” style=“width: '.$params->get(‘width’).'px;”’, ‘’, true);
$lists[‘city’] = ipropertyHTML::city_select_list(‘city’,‘class=“inputbox” style=“width: '.$params->get(‘width’).'px;”’, ‘’);
$lists[‘state’] = ipropertyHTML::state_select_list(‘locstate’,‘class=“inputbox” style=“width: '.$params->get(‘width’).'px;”’, ‘’,true);
$lists[‘province’] = ipropertyHTML::province_select_list(‘province’,‘class=“inputbox” style=“width: '.$params->get(‘width’).'px;”’, ‘’);
$lists[‘counties’] = ipropertyHTML::county_select_list(‘county’,‘class=“inputbox” style=“width: '.$params->get(‘width’).'px;”’, ‘’);
$lists[‘regions’] = ipropertyHTML::region_select_list(‘region’,‘class=“inputbox” style=“width: '.$params->get(‘width’).'px;”’, ‘’);
$lists[‘countries’] = ipropertyHTML::country_select_list(‘country’,‘class=“inputbox” style=“width: '.$params->get(‘width’).'px;”’, ‘’, true);
$lists[‘beds’] = ipropertyHTML::beds_select_list(‘beds’,‘class=“inputbox” style=“width: '.(($params->get(‘width’) / 2)-2).'px;”’, ‘’);
$lists[‘baths’] = ipropertyHTML::baths_select_list(‘baths’,‘class=“inputbox” style=“width: '.(($params->get(‘width’) / 2)-2).'px;”’, ‘’,0);

$checkscript = ’

';

$mainframe->addCustomHeadTag($checkscript);

$ipstyle =’

.ip_qsmod{margin: 3px 0px; white-space: nowrap;} .ip_qsmod_bbhead{border-bottom: solid 1px #ccc;} .ip_qsmod_adv{margin: 5px; text-align: right;} ';

$mainframe->addCustomHeadTag($ipstyle);

require(JModuleHelper::getLayoutPath(‘mod_ip_quicksearch’, ‘default’));[/php]

default.php :

[php]defined(’_JEXEC’) or die(‘Restricted access’);

/* fix for pagination 9-3-10

  • removed hidden ipquicksearch value that was not carried through in pagination
  • use $ipquicksearch_route as form action with ipquicksearch in url to be used in pagination
    */
    $uri = JRoute::_(ipropertyHelperRoute::getCatRoute(0));
    $u = JURI::getInstance($uri);
    $u->setVar(‘ipquicksearch’, 1);
    $ipquicksearch_route = $u->toString();

$form_method = ($params->get(‘form_method’, ‘post’));
?>

/>
<?php echo $lists['cat']; ?>
<?php if($params->get('show_stype')): ?>
<?php echo $lists['stype']; ?>
<?php endif; ?> <?php if($params->get('show_city')): ?>
<?php echo $lists['city']; ?>
<?php endif; ?> <?php if($params->get('show_state')): ?>
<?php echo $lists['state']; ?>
<?php endif; ?> <?php if($params->get('show_province')): ?>
<?php echo $lists['province']; ?>
<?php endif; ?> <?php if($params->get('show_county')): ?>
<?php echo $lists['counties']; ?>
<?php endif; ?> <?php if($params->get('show_region')): ?>
<?php echo $lists['regions']; ?>
<?php endif; ?> <?php if($params->get('show_country')): ?>
<?php echo $lists['countries']; ?>
<?php endif; ?> <?php if($params->get('show_beds') || $params->get('show_baths')): ?>
<?php echo JText::_('MIN BB'); ?>
<?php echo ($params->get('show_beds')) ? $lists['beds'] : ''; ?> <?php echo ($params->get('show_baths')) ? $lists['baths'] : ''; ?>
<?php endif; ?> <?php if($params->get('show_price') && $params->get('price_dropdowns')): ?>
<?php echo JText::_('PRICE RANGE'); ?>
<?php echo $lists['p_low']; ?> - <?php echo $lists['p_high']; ?>
<?php endif; ?> <?php if($params->get('show_price') && !$params->get('price_dropdowns')): ?>
<?php echo JText::_('PRICE RANGE'); ?>
<?php endif; ?> <?php if ($params->get('show_advsearch')) : ?>
<?php echo JText::_( 'ADVANCED SEARCH' ); ?>
<?php endif; ?> <?php if($params->get('form_method', 'post') == 'get') : ?> <?php endif; ?>
[/php]

mod_ip_quicksearch.xml:

[code]Display an Intellectual Property quick search form in module position.

mod_ip_quicksearch.php
index.html
tmpl/

<languages>
    <language tag="en-GB">language/en-GB.mod_ip_quicksearch.ini</language>
</languages>

<params addpath="/administrator/components/com_iproperty/elements">
	<param name="moduleclass_sfx" type="text" default="" label="MODULECLASSSUFFIX" description="PARAMMODULECLASSSUFFIX" />
    <param name="qs_ptype" type="category" default="" label="CATPRESELECT" description="CATPRESELECT_DESC" />
    <param name="width" type="text" default="200" label="BOX_WIDTH" description="BOX_WIDTH_DESC" />
    <param name="" type="header" default="OPTIONS" label="" description="" />
    <param name="show_stype" type="radio" default="1" label="SHOW_STYPE" description="SHOW_STYPE_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_beds" type="radio" default="1" label="SHOW_BEDS" description="SHOW_BEDS_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_baths" type="radio" default="1" label="SHOW_BATHS" description="SHOW_BATHS">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_price" type="radio" default="1" label="SHOW_PRICE" description="SHOW_PRICE">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
	<param name="price_dropdowns" type="radio" default="0" label="SHOW_PRICE_DROPDOWNS" description="SHOW_PRICE_DROPDOWNS_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_advsearch" type="radio" default="1" label="SHOW_ADVANCED" description="SHOW_ADVANCED_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="" type="header" default="LOCATION" label="" description="" />
    <param name="show_city" type="radio" default="1" label="SHOW_CITY" description="SHOW_CITY_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_state" type="radio" default="0" label="SHOW_STATE" description="SHOW_STATE_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_province" type="radio" default="0" label="SHOW_PROVINCE" description="SHOW_PROVINCE_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_county" type="radio" default="0" label="SHOW_COUNTY" description="SHOW_COUNTY_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_region" type="radio" default="0" label="SHOW_REGION" description="SHOW_REGION_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
    <param name="show_country" type="radio" default="0" label="SHOW_COUNTRY" description="SHOW_COUNTRY_DESC">
		<option value="1">YES</option>
		<option value="0">NO</option>
	</param>
	<param name="" type="header" default="ROUTING" label="" description="" />
    <param name="form_method" type="radio" default="post" label="FORM_METHOD" description="FORM_METHOD_DESC">
		<option value="post">POST</option>
		<option value="get">GET</option>
	</param>
    <param name="form_itemid" type="text" default="" label="ITEMID" description="ITEMID_DESC" />
</params>

[/code]

Well, it seems there is a lot to this small change. Not sure if I can help, but, hopefully someone will.
I do see that the list of controls used is created in the quicksearch.php file. ( $lists[] )
And, it is placed into the form’s DIV in the default.php file. I do not currently have a Joomla set up
on any of my sites, so it is hard to “play” with your code…

First, did you purchase the search add-in? Where did you get it. I think it can easily be customized, but, not sure where the base of the upgrade would start without knowing more about the code. If it is a purchased item, I am sure we could locate more info about it. If it was free, then, someone will know how to update it… Or, at least, can you give us the website where you got it from?

Sponsor our Newsletter | Privacy Policy | Terms of Service