RSS
Home Forum v3
Welcome, Guest
Please Login or Register.    Lost Password?

New values in Bedrooms Field
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: New values in Bedrooms Field
#776
New values in Bedrooms Field 2 Years, 3 Months ago Karma: 0
Hello,

Please can you let me know how to add or edit values in Bedrooms Field.

Regards,
Prashi
prashi
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1087
Re:New values in Bedrooms Field 2 Years, 2 Months ago Karma: 0
Can you more specific? I have changed my bed room values, let me know what you would like to add exactly and I'll let you know how you can do it.
skarama
Junior Boarder
Posts: 31
graphgraph
User Offline Click here to see the profile of this user
BSN Websites Web Design
The administrator has disabled public write access.
Obtain a free quote for your Web Design project
 
#1093
Re:New values in Bedrooms Field 2 Years, 2 Months ago Karma: 0
Need to put "studio" in the bedroom field and the searched results should yield the properties without a room.
prashi
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1108
Re:New values in Bedrooms Field 2 Years, 2 Months ago Karma: 59
use "studio" in types
administrator
Admin
Posts: 544
graph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#1116
Re:New values in Bedrooms Field 2 Years, 2 Months ago Karma: 0
Well in my case I need to keep my types free for something else, so this suggestion wouldn't work.

To add fields to bedrooms you need to change multiple files so that it works when an agent posts a new property, so that it is displayed correctly, and for the search to work properly. I will try to not forget anything!

First, the agent post :

com_property/views/panel/tmpl/default_addproperty.php

search for
Code:

 <tr>

<td class="key"><label for="bedrooms"><?php echo JText::_( 'Bedrooms' ); ?>:</label></td>

<td >

                    <input class="inputbox" type="text" name="bedrooms" id="bedrooms" size="3" maxlength="255" value="<?php echo $this->datos->bedrooms; ?>" />

</td>

</tr>

                <tr>


it should be around line 1177(possibly different, I modified this file a lot)

You need to replace the line in the second <td>,(that one that starts with <input class="inputbox"..etc with the following :
Code:

<?php 


if($this->datos->bedrooms == 1 ){$select0 = JText::_( 'selected="selected"' );}
if($this->datos->bedrooms == 2 ){$select1 = JText::_( 'selected="selected"' );}
if($this->datos->bedrooms == 3 ){$select2 = JText::_( 'selected="selected"' );}
if($this->datos->bedrooms == 4 ){$select3 = JText::_( 'selected="selected"' );}
if($this->datos->bedrooms == 5 ){$select4 = JText::_( 'selected="selected"' );}

?>

<select name="bedrooms" id="bedrooms" style="width:150px;"> 


<option <?php echo $select0;?> value="1"><?php echo JText::_( 'BEDROOM_ROOMS1' ); ?></option>
            <option <?php echo $select1;?> value="2"><?php echo JText::_( 'BEDROOM_ROOMS2' ); ?></option>
            <option <?php echo $select2;?> value="3"><?php echo JText::_( 'BEDROOM_ROOMS3' ); ?></option>
            <option <?php echo $select3;?> value="4"><?php echo JText::_( 'BEDROOM_ROOMS4' ); ?></option>
            <option <?php echo $select4;?> value="5"><?php echo JText::_( 'BEDROOM_ROOMS5' ); ?></option>
         

         </select>



This will create a drop down menu with the selection of bedrooms of your choice. What's more important, this avoids having to change the database, as the values inserted are still going to be 1, 2, 3, 4,5 etc (so your search module will still be able to find them)

Now, the JTEXT:: refers to your joomla language file, and will print on the screen whatever you write in there, so the 2nd file to modify is this :

languages/en-GB/en-GB.ini (modifiy this one to make sure that the change is read on all areas of your site, not just under the com_propertie component pages)

Look at how the file is made, basically, all the words on the left of the "=" sign are IN CAPS. this is important to follow, so to create your words you coudl have something like :
Code:


BEDROOM_ROOMS1 = Studio
BEDROOM_ROOMS2 = 2 Rooms 
BEDROOM_ROOMS3 = 3 Rooms



etc. If you have more then one language on your site, or if your main language is not en-GB, simply do the same change on other .ini files.

Now that this is done, you should be able to see in your agent panel that you're able to add values that are "Studio, 2 Rooms, 3 Rooms, etc.

The db inserts these values as 1, 2, 3, etc. This allows the search module to look for any value in the bedrooms field that is equal to, or bigger then 2.

To have the search module display "Studio" as the first choice:

modules/mod_prop_search_js/helper.php

find :
function getBedrooms()
around line 595

You should see something like :
Code:

$Md[0]->id_bedrooms=0;
$Md[0]->bedrooms=JText::_('Bedrooms');
$Md[1]->id_bedrooms=1;
$Md[1]->bedrooms=JText::_('1 or more');
$Md[2]->id_bedrooms=2;
$Md[2]->bedrooms=JText::_('2 or more');
$Md[3]->id_bedrooms=3;
$Md[3]->bedrooms=JText::_('3 or more');
$Md[4]->id_bedrooms=4;
$Md[4]->bedrooms=JText::_('4 or more');
$Md[5]->id_bedrooms=5;
$Md[5]->bedrooms=JText::_('5 or more');



simply change the values you want, for example 1 or more could be "Studio or Bigger"

Don't forget to add the exact same string in your language file:
STUDIO OR BIGGER = Studio or bigger, for each language.
If you don't add it to your language file, joomla will simply write what's inside the ('') of your JTEXT::_ call

That's it for this one. The last change you need to make is in:

components/com_properties/views/templates/list3.php

Search for :

Code:

<?php if($row->bedrooms){echo '<tr><td width="100%"><strong>'.JText::_('Bedrooms')  .' :</strong></td><td width="100%">'. $row->bedrooms.'</td></tr>';} ?>

around line 654

Change it to :
Code:

<?php if($row->bedrooms = 1){echo '<tr><td width="100%"><strong>'.JText::_('Bedrooms')  .' :</strong></td><td width="100%">'.JText::_('Studio')  .'</td></tr>';} 

else if ($row->bedrooms){echo '<tr><td width="100%"><strong>'.JText::_('Bedrooms')  .' :</strong></td><td width="100%">'. $row->bedrooms.'</td></tr>';} ?>



This will check the value of the row bedrooms. If it is equal to 1, it means that this is a studio, and we don't it to print simply "1", we want it to print "Studio". If it's not 1, then it checks if there is a value in the bedrooms row, and if there is one, for example "3", it will print "3".

Let me know if you need any help with this, or if I'm missing something!
skarama
Junior Boarder
Posts: 31
graphgraph
User Offline Click here to see the profile of this user
BSN Websites Web Design
The administrator has disabled public write access.
Obtain a free quote for your Web Design project
 
#2429
Re:New values in Bedrooms Field 2 Years ago Karma: 0
Hello, i hope you can help me here..

I need to show only properties with the selected amount of rooms, not 2 or more, just 2, not 3 or more, just 3!!!

any hint????
lorenzofp
Expert Boarder
Posts: 116
graphgraph
User Offline Click here to see the profile of this user
lorenzofp lorenzofln@hotmail.com
The administrator has disabled public write access.
Lorenzo Federico Pascucci
Skype: lorenzofp
MSN: lorenzofln@hotmail.com
 
#4613
Re:New values in Bedrooms Field 1 Year, 9 Months ago Karma: 0
lorenzofp wrote:
Hello, i hope you can help me here..

I need to show only properties with the selected amount of rooms, not 2 or more, just 2, not 3 or more, just 3!!!

any hint????


Somebody please help
liekin
Junior Boarder
Posts: 27
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1