PDA

View Full Version : Real Estate Script/ Listing Type / Sale and Rent



Lukas Kielkowski
January 17, 2021, 04:56 PM
Hello,

If I hide the field "property for", and rent is set as default, then no rental period is displayed.

it is possible to disable "sale" in "property for" without consequence problems?

I only want to rent under property listing type.

Any ideas ? Many thanks

Kind regards

Pete Young
January 17, 2021, 11:01 PM
Lukas, Just go to listing fields > find the listing field you want to edit, probably "property for" then open it up and set "sale" as inactive and save.

Lukas Kielkowski
January 18, 2021, 05:34 PM
4012

Am I blind or where can I disable the single field option sale?

and if I delete the sale field, then the rental option does not work at all, even if I add the sale option again.
I tried this once and had to reinstall the script again.

Rudi
January 18, 2021, 06:10 PM
The 'Rental Period' field depends on the selected option 'Rent' from the 'Property for' field

to make it always visible, you should edit the code in public_html > templates > your_template > js > lib.js

find a line this.realtyPropType = function(selector, target_selector, parent_class) {

and comment out the code below like this:



/*var selector = typeof selector != "undefined" ? selector : '#sf_field_sale_rent span.custom-input input',
target_selector = typeof target_selector != "undefined" ? target_selector : '#sf_field_time_frame',
parent_class = typeof parent_class != "undefined" ? parent_class : '.submit-cell';

$(target_selector).closest(parent_class).hide(0);

var action = function(input) {
var target = $(input).closest('form').find(target_selector);

if (target.length == 0)
return;

if (parseInt($(input).val()) == 2) {
target.closest(parent_class).fadeIn();
} else {
target.closest(parent_class).fadeOut();
target.find('input').removeAttr('checked')
}
}

$(selector).change(function(){
action(this);
});

$(selector + ':checked').each(function(){
action(this);
});*/



to make it for admin panel, go to includes > classes > rlRealty.class.php > function hookApTplFooter()

remove this block of code:


if ($_GET['controller'] == 'listings' && in_array($_GET['action'], array('add', 'edit'))) {
$script = <<< VS
<script>
var apPropertyForHandler = function() {
if ($('#sale_rent_table input:checked').val() == 2) {
$('#time_frame_table').closest('tr').fadeIn();
} else {
$('#time_frame_table').closest('tr').fadeOut();
$('#time_frame_table input').removeAttr('checked');
}
}
$(document).ready(function(){
apPropertyForHandler();

$('#sale_rent_table input').change(function(){
apPropertyForHandler();
});
});
</script>
VS;
echo $script;
}



Now you can use the Rental Period field independently

Pete Young
January 19, 2021, 12:58 AM
4012

Am I blind or where can I disable the single field option sale?

and if I delete the sale field, then the rental option does not work at all, even if I add the sale option again.
I tried this once and had to reinstall the script again.

Lukas, the problem might be with radio buttons needing more than if you delete sale and have problems per, as a quick fix to this you could rename Sale > Rent and just have 2 rents listed ?

Other than that rebuild a new list field that did not rely on radio buttons ? or try rudis solution if needed.

Lukas Kielkowski
January 20, 2021, 06:11 PM
The 'Rental Period' field depends on the selected option 'Rent' from the 'Property for' field

to make it always visible, you should edit the code in public_html > templates > your_template > js > lib.js

find a line this.realtyPropType = function(selector, target_selector, parent_class) {

and comment out the code below like this:



/*var selector = typeof selector != "undefined" ? selector : '#sf_field_sale_rent span.custom-input input',
target_selector = typeof target_selector != "undefined" ? target_selector : '#sf_field_time_frame',
parent_class = typeof parent_class != "undefined" ? parent_class : '.submit-cell';

$(target_selector).closest(parent_class).hide(0);

var action = function(input) {
var target = $(input).closest('form').find(target_selector);

if (target.length == 0)
return;

if (parseInt($(input).val()) == 2) {
target.closest(parent_class).fadeIn();
} else {
target.closest(parent_class).fadeOut();
target.find('input').removeAttr('checked')
}
}

$(selector).change(function(){
action(this);
});

$(selector + ':checked').each(function(){
action(this);
});*/



to make it for admin panel, go to includes > classes > rlRealty.class.php > function hookApTplFooter()

remove this block of code:


if ($_GET['controller'] == 'listings' && in_array($_GET['action'], array('add', 'edit'))) {
$script = <<< VS
<script>
var apPropertyForHandler = function() {
if ($('#sale_rent_table input:checked').val() == 2) {
$('#time_frame_table').closest('tr').fadeIn();
} else {
$('#time_frame_table').closest('tr').fadeOut();
$('#time_frame_table input').removeAttr('checked');
}
}
$(document).ready(function(){
apPropertyForHandler();

$('#sale_rent_table input').change(function(){
apPropertyForHandler();
});
});
</script>
VS;
echo $script;
}



Now you can use the Rental Period field independently



thank you very much, I have tried it. It looks good too.
Unfortunately, the specification " /per day" is then missing on the start page box.

4020

Rudi
January 21, 2021, 11:09 AM
Ok, go to templates > your template > tpl > controllers > listing_details.tpl

find:


{if $listing_data.sale_rent == 2 && $listing.common.Fields.time_frame.value}


and replace it with:


{if $listing.common.Fields.time_frame.value}



then go to tpl > blocks > listing.tpl

find:


{if $listing.sale_rent == 2 && $listing.fields.time_frame.value}


and replace with:


{if $listing.fields.time_frame.value}



also in featered_value.tpl

replace:


{if $featured_listing.sale_rent == 2 && $featured_listing.fields.time_frame.value}


with:


{if $featured_listing.fields.time_frame.value}