OS Property support center

Pass Variables from details.html.tpl to listing.ph

  • Thibaut
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago - 9 years 1 month ago #59012 by Thibaut
Hello,
I would like to pass variables to filter more the Related properties.

In details.html.tpl there is a line
echo $row->relate;

I would like to pass variables to be able to filter the results (by defaults, it shows related properties by location/distance)
in classes/listing.php would like to add search critera like
if($configClass == 1){
$sql .= "\n AND pr.city = '$property->city'";
}

My question how to pass variables from templates/****/details.html.tpl to classes/listing.php?
I tried to declare $configClass = 4; in details.html.php but didn't work.

Thx to let me know
Last edit: 9 years 1 month ago by Thibaut.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #59027 by Mr. Dam
Hi Thibaut,
You don't need to pass that variables, because the variable: $configClass is global "array" variable and you can use it on any pages of OS Property
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Thibaut
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago - 9 years 1 month ago #59041 by Thibaut
Hi Dam,
thank you but

when I declare in details.html.php
Code:
$configClass['similar_price'] = 20000;

and in classes/listing.php
Code:
if(isset($configClass['similar_price'])){ $similar_price = $configClass['similar_price']; $sql .= "\n AND pr.price like '$similar_price"; }

It didn't work, like the variable not pass.

Do you know where the problem come?
Thx
Last edit: 9 years 1 month ago by Thibaut.

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #59132 by Mr. Dam
Hi,
You should add that variable at file: components > com_osproperty > classes > listing.php
at function display.
By the way, the price is decimal number, so you must use <>, >=, <=, = in SQL, not use LIKE
Thanks
Dam

Please Log in or Create an account to join the conversation.

  • Thibaut
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago #59666 by Thibaut
Hi,
thank you.
What do you mean by "You should add that variable at file: components > com_osproperty > classes > listing.php
at function display."

I tried to add the variable below
static function display($option,$task){
global $mainframe;

But it doesn't not work.
Thx for your help

Please Log in or Create an account to join the conversation.

More
9 years 1 month ago #59681 by Mr. Dam
Hi,
It should be
static function display($option,$task){
global $mainframe,$configClass;
$configClass = 20000;

Thanks
Dam

Please Log in or Create an account to join the conversation.

Moderators: Mr. DamNguyen Phu Quan