Free UPDATE - Real Estate Attributes Osclass Plugin - 3.4.1
Download and Save your current files before uploading these in case you don't like the changes.
This free update will change "Meters" into - Sq. feet Living Space and Sq. Feet Total plus a few other little changes with the drop down amounts, etc.
I am using Osclass 8.0.1 and the Delta Theme 1.2.1 , and I checked on Sigma 1.3.3 and Starter Theme 1.3.3 with my changes and it works for me.
-------------------------------------------------------------------
A Visual of the Format at the bottom
-------------------------------------------------------------------
helper.php & item_edit.php below
---------------------
helper.php
------------
<?php
function get_realestate_attributes(){
$locale = osc_current_user_locale();
$return = array('attributes','other_attributes');
$detail = ModelRealEstate::newInstance()->getAttributes( osc_item_id() );
$keys = array_keys($detail) ;
if(is_array($keys) && count($keys) == 1 && isset($keys[0]) && $keys[0] == 'locale' && is_null(@$detail[0]['locale']) ){
// nothing to do
return false;
}
if(@$detail['e_type'] != "") {
$typeText = array(
'FOR RENT' => __('For rent', 'realestate_attributes'),
'FOR SALE' => __('For sale', 'realestate_attributes')
);
$return['attributes']['type'] = array(
'label' =>__('Type', 'realestate_attributes')
,'value' => @$typeText[$detail['e_type']]
);
}
if(@$detail['locale'][$locale]['s_name'] != "") {
$return['attributes']['property_type'] = array(
'label' =>__('Property type', 'realestate_attributes')
,'value' => @$detail['locale'][$locale]['s_name']
);
}
if(@$detail['i_num_floors'] != "") {
$return['attributes']['floors'] = array(
'label' =>__('Num. Floors', 'realestate_attributes')
,'value' => @$detail['i_num_floors']
);
}
if(@$detail['i_num_rooms'] != "") {
$return['attributes']['rooms'] = array(
'label' =>__('Num. Rooms', 'realestate_attributes')
,'value' => @$detail['i_num_rooms']
);
}
if(@$detail['i_num_bathrooms'] != "") {
$return['attributes']['bathrooms'] = array(
'label' =>__('Num. Bathrooms', 'realestate_attributes')
,'value' => @$detail['i_num_bathrooms']
);
}
if(@$detail['i_num_garages'] != "") {
$return['attributes']['garages'] = array(
'label' =>__('Num. Garage', 'realestate_attributes')
,'value' => @$detail['i_num_garages']
);
}
if(@$detail['i_year'] != "") {
$return['attributes']['year'] = array(
'label' =>__('Construction Year', 'realestate_attributes')
,'value' => @$detail['i_year']
);
}
if(@$detail['e_status'] != "") {
$statusText = array(
'NEW CONSTRUCTION' => __('New construction', 'realestate_attributes'),
'TO RENOVATE' => __('To renovate', 'realestate_attributes'),
'GOOD CONDITION' => __('Good condition', 'realestate_attributes')
);
$return['attributes']['status'] = array(
'label' =>__('Status', 'realestate_attributes')
,'value' => @$statusText[$detail['e_status']]
);
}
if(@$detail['s_square_meters'] != "") {
$return['attributes']['square_meters'] = array(
'label' =>__('Sq. Ft. Living Space', 'realestate_attributes')
,'value' => @$detail['s_square_meters']
);
}
if(@$detail['i_plot_area'] != "") {
$return['attributes']['plot_area'] = array(
'label' =>__('Square Feet (Total)', 'realestate_attributes')
,'value' => @$detail['i_plot_area']
);
}
//other attributes
if(@$detail['b_heating']) {
$return['other_attributes']['b_heating'] = array(
'label' =>__('Heating', 'realestate_attributes')
,'value' => true
);
}
if(@$detail['b_air_condition']) {
$return['other_attributes']['b_air_condition'] = array(
'label' =>__('Air Condition', 'realestate_attributes')
,'value' => true
);
}
if(@$detail['b_elevator']) {
$return['other_attributes']['b_elevator'] = array(
'label' =>__('Elevator', 'realestate_attributes')
,'value' => true
);
}
if(@$detail['b_terrace']) {
$return['other_attributes']['b_terrace'] = array(
'label' =>__('Patio', 'realestate_attributes')
,'value' => true
);
}
if(@$detail['b_parking']) {
$return['other_attributes']['b_parking'] = array(
'label' =>__('Parking', 'realestate_attributes')
,'value' => true
);
}
if(@$detail['b_furnished']) {
$return['other_attributes']['b_furnished'] = array(
'label' =>__('Furnished', 'realestate_attributes')
,'value' => true
);
}
if(@$detail['b_new']) {
$return['other_attributes']['b_new'] = array(
'label' =>__('New', 'realestate_attributes')
,'value' => true
);
}
if(@$detail['b_by_owner']) {
$return['other_attributes']['b_by_owner'] = array(
'label' =>__('By Owner', 'realestate_attributes')
,'value' => true
);
}
return $return;
}
function table_realestate_attributes(){
$detail = get_realestate_attributes();
if(isset($detail['attributes']) && $detail['attributes']){
?>
<h3><?php _e('Details', 'realestate_attributes') ; ?></h3>
<div class="table-attributes">
<table>
<?php
foreach($detail['attributes'] as $item){
echo '<tr><td class="row-title">'.$item['label'].'</td><td>'.$item['value'].'</td></tr>';
}
?>
</table>
</div>
<?php
}
}
function table_realestate_other_attributes(){
$detail = get_realestate_attributes();
if(isset($detail['other_attributes']) && is_array($detail['other_attributes'])){
?>
<h4><?php _e('Other characteristics', 'realestate_attributes'); ?></h4>
<ul class="list-other-attributes">
<?php
foreach($detail['other_attributes'] as $item){
echo '<li><img src="'.osc_plugin_url(__FILE__).'img/tick.png"/>'.$item['label'].'</li>';
}
?>
</ul>
<?php
}
}
function realestate_attributes(){
echo '<div class="realestate-details">';
table_realestate_attributes();
table_realestate_other_attributes();
echo '<div class="clear"></div></div>';
}
?>
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
item_edit.php
<h2><?php _e('Realestate Attributes', 'realestate_attributes'); ?></h2>
<div class="box">
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_property_type') != '' ) {
$detail['e_type'] = Session::newInstance()->_getForm('pre_property_type');
}
?>
<label for="property_type"><?php _e('Type', 'realestate_attributes'); ?></label>
<select name="property_type" id="property_type">
<option value="FOR RENT" <?php if(@$detail['e_type'] == 'FOR RENT') { echo "selected"; } ?>><?php _e('For rent', 'realestate_attributes'); ?></option>
<option value="FOR SALE" <?php if(@$detail['e_type'] == 'FOR SALE') { echo "selected"; } ?>><?php _e('For sale', 'realestate_attributes'); ?></option>
</select>
</div>
<div class="row">
<?php
$locales = osc_get_locales();
if(count($locales)==1) {
?>
<?php
if( Session::newInstance()->_getForm('pre_p_type') != '' ) {
$detail['fk_i_property_type_id'] = Session::newInstance()->_getForm('pre_p_type');
}
?>
<label><?php _e('Property type', 'realestate_attributes'); ?></label>
<select name="p_type" id="p_type">
<?php foreach($p_type[$locales[0]['pk_c_code']] as $k => $v) { ?>
<option value="<?php echo $k; ?>" <?php if($k == @$detail['fk_i_property_type_id']) { echo 'selected'; } ?>><?php echo @$v; ?></option>
<?php } ?>
</select>
<?php } else { ?>
<div class="tabber">
<?php
if( Session::newInstance()->_getForm('pre_p_type') != '' ) {
$detail['fk_i_property_type_id'] = Session::newInstance()->_getForm('pre_p_type');
}
?>
<?php foreach($locales as $locale) {?>
<div class="tabbertab">
<h2><?php echo $locale['s_name']; ?></h2>
<p>
<label><?php _e('Property type', 'realestate_attributes'); ?></label><br />
<select name="p_type" id="p_type">
<?php
if($p_type[$locale['pk_c_code']]){
if(isset($locale['pk_c_code']) && isset($p_type[$locale['pk_c_code']]) && is_array($p_type[$locale['pk_c_code']]) && count($p_type[$locale['pk_c_code']]) > 0){
foreach($p_type[$locale['pk_c_code']] as $k => $v) {
?>
<option value="<?php echo $k; ?>" <?php if($k==@$detail['fk_i_property_type_id']) { echo 'selected';};?>><?php echo @$v;?></option>
<?php
}
}
}
?>
</select>
</p>
</div>
<?php } ?>
</div>
<?php }
?>
</div>
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_numFloors') != '' ) {
$detail['i_num_floors'] = Session::newInstance()->_getForm('pre_numFloors');
}
?>
<label for="numFloors"><?php _e('Num. of floors', 'realestate_attributes'); ?></label>
<select name="numFloors" id="numFloors">
<?php foreach(range(0, 6) as $n) { ?>
<option value="<?php echo $n; ?>" <?php if($n == @$detail['i_num_floors']) { echo "selected"; } ?>><?php echo $n; ?></option>
<?php } ?>
</select>
</div>
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_numRooms') != '' ) {
$detail['i_num_rooms'] = Session::newInstance()->_getForm('pre_numRooms');
}
?>
<label for="numRooms"><?php _e('Num. of rooms', 'realestate_attributes'); ?></label>
<select name="numRooms" id="numRooms">
<?php foreach(range(0, 15) as $n) { ?>
<option value="<?php echo $n; ?>" <?php if($n == @$detail['i_num_rooms']) { echo "selected"; } ?>><?php echo $n; ?></option>
<?php } ?>
</select>
</div>
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_numBathrooms') != '' ) {
$detail['i_num_bathrooms'] = Session::newInstance()->_getForm('pre_numBathrooms');
}
?>
<label for="numBathrooms"><?php _e('Num. of bathrooms', 'realestate_attributes'); ?></label>
<select name="numBathrooms" id="numBathrooms">
<?php foreach(range(0, 6) as $n) { ?>
<option value="<?php echo $n; ?>" <?php if($n==@$detail['i_num_bathrooms']) { echo "selected"; } ?>><?php echo $n; ?></option>
<?php } ?>
</select>
</div>
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_numGarages') != '' ) {
$detail['i_num_garages'] = Session::newInstance()->_getForm('pre_numGarages');
}
?>
<label for="numGarages"><?php _e('Num. Garage', 'realestate_attributes'); ?></label>
<select name="numGarages" id="numGarages">
<?php foreach(range(0, 6) as $n) { ?>
<option value="<?php echo $n; ?>" <?php if($n==@$detail['i_num_garages']) { echo "selected"; } ?>><?php echo $n; ?></option>
<?php } ?>
</select>
</div>
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_year') != '' ) {
$detail['i_year'] = Session::newInstance()->_getForm('pre_year');
}
?>
<label for="year"><?php _e('Construction Year', 'realestate_attributes'); ?></label>
<input type="text" name="year" id="year" value="<?php echo @$detail['i_year'];?>" size="4" maxlength="4" />
</div>
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_status') != '' ) {
$detail['e_status'] = Session::newInstance()->_getForm('pre_status');
}
?>
<label for="status"><?php _e('Status', 'realestate_attributes'); ?></label>
<select name="status" id="status">
<option value="NEW CONSTRUCTION" <?php if(@$detail['e_status'] == 'NEW CONSTRUCTION') { echo "selected"; } ?>><?php _e('New construction', 'realestate_attributes'); ?></option>
<option value="TO RENOVATE" <?php if(@$detail['e_status'] == 'TO RENOVATE') { echo "selected"; } ?>><?php _e('To renovate', 'realestate_attributes'); ?></option>
<option value="GOOD CONDITION" <?php if(@$detail['e_status'] == 'GOOD CONDITION') { echo "selected"; } ?>><?php _e('Good condition', 'realestate_attributes'); ?></option>
</select>
</div>
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_squareMeters') != '' ) {
$detail['s_square_meters'] = Session::newInstance()->_getForm('pre_squareMeters');
}
?>
<label for="squareMeters"><?php _e('Sq. Ft. Living Space', 'realestate_attributes'); ?></label>
<input type="text" name="squareMeters" id="squareMeters" value="<?php echo @$detail['s_square_meters']; ?>" size="4" maxlength="4" />
</div>
<div class="row">
<?php
if( Session::newInstance()->_getForm('pre_squareMetersTotal') != '' ) {
$detail['i_plot_area'] = Session::newInstance()->_getForm('pre_squareMetersTotal');
}
?>
<label for="squareMetersTotal"><?php _e('Square Feet (Total)', 'realestate_attributes'); ?></label>
<input type="text" name="squareMetersTotal" id="squareMetersTotal" value="<?php echo @$detail['i_plot_area'];?>" size="4" maxlength="6" />
</div>
<div class="row">
<label><?php _e('Other characteristics', 'realestate_attributes'); ?></label>
<ul class="checkbox-list">
<?php
if( Session::newInstance()->_getForm('pre_heating') != '' ) {
$detail['b_heating'] = Session::newInstance()->_getForm('pre_heating');
}
?>
<li>
<input style="width: 20px;" type="checkbox" name="heating" id="heating" value="1" <?php if(@$detail['b_heating'] == 1) { echo 'checked="yes"'; } ?>/> <label style="float:none;" for="heating"><?php _e('Heating', 'realestate_attributes'); ?></label>
</li>
<?php
if( Session::newInstance()->_getForm('pre_airCondition') != '' ) {
$detail['b_air_condition'] = Session::newInstance()->_getForm('pre_airCondition');
}
?>
<li>
<input style="width: 20px;" type="checkbox" name="airCondition" id="airCondition" value="1" <?php if(@$detail['b_air_condition'] == 1) { echo 'checked="yes"'; } ?>/> <label style="float:none;" for="airCondition"><?php _e('Air condition', 'realestate_attributes'); ?></label>
</li>
<?php
if( Session::newInstance()->_getForm('pre_elevator') != '' ) {
$detail['b_elevator'] = Session::newInstance()->_getForm('pre_elevator');
}
?>
<li>
<input style="width: 20px;" type="checkbox" name="elevator" id="elevator" value="1" <?php if(@$detail['b_elevator'] == 1) { echo 'checked="yes"'; } ?>/> <label style="float:none;" for="elevator"><?php _e('Elevator', 'realestate_attributes'); ?></label>
</li>
<?php
if( Session::newInstance()->_getForm('pre_terrace') != '' ) {
$detail['b_terrace'] = Session::newInstance()->_getForm('pre_terrace');
}
?>
<li>
<input style="width: 20px;" type="checkbox" name="terrace" id="terrace" value="1" <?php if(@$detail['b_terrace'] == 1) { echo 'checked="yes"'; } ?>/> <label style="float:none;" for="terrace"><?php _e('Patio', 'realestate_attributes'); ?></label>
</li>
<?php
if( Session::newInstance()->_getForm('pre_parking') != '' ) {
$detail['b_parking'] = Session::newInstance()->_getForm('pre_parking');
}
?>
<li>
<input style="width: 20px;" type="checkbox" name="parking" id="parking" value="1" <?php if(@$detail['b_parking'] == 1) { echo 'checked="yes"'; } ?>/> <label style="float:none;" for="parking"><?php _e('Parking', 'realestate_attributes'); ?></label>
</li>
<?php
if( Session::newInstance()->_getForm('pre_furnished') != '' ) {
$detail['b_furnished'] = Session::newInstance()->_getForm('pre_furnished');
}
?>
<li>
<input style="width: 20px;" type="checkbox" name="furnished" id="furnished" value="1" <?php if(@$detail['b_furnished'] == 1) { echo 'checked="yes"'; } ?>/> <label style="float:none;" for="furnished"><?php _e('Furnished', 'realestate_attributes'); ?></label>
</li>
<?php
if( Session::newInstance()->_getForm('pre_new') != '' ) {
$detail['b_new'] = Session::newInstance()->_getForm('pre_new');
}
?>
<li>
<input style="width: 20px;" type="checkbox" name="new" id="new" value="1" <?php if(@$detail['b_new'] == 1) { echo 'checked="yes"'; } ?>/> <label style="float:none;" for="new"><?php _e('New', 'realestate_attributes'); ?></label>
</li>
<?php
if( Session::newInstance()->_getForm('pre_by_owner') != '' ) {
$detail['b_by_owner'] = Session::newInstance()->_getForm('pre_by_owner');
}
?>
<li>
<input style="width: 20px;" type="checkbox" name="by_owner" id="by_owner" value="1" <?php if(@$detail['b_by_owner'] == 1) { echo 'checked="yes"'; } ?>/> <label style="float:none;" for="by_owner"><?php _e('By owner', 'realestate_attributes'); ?></label>
</li>
</ul>
<div class="clear"></div>
</div>
<?php $locales = osc_get_locales();
if(count($locales)==1) { ?>
<?php } ?>
</div>
<script type="text/javascript">
if(typeof tabberAutomatic == 'function') {
tabberAutomatic();
}
if(typeof themeUiHook == 'function') {
themeUiHook();
}
</script>