Page 1 of 1

Table view to show Price text from price number

Posted: 2019-05-28 05:09
by tminh
My real estate table is : bds

Price filed is : bds_price `bds`.`bds_price`

I want to convert price number to price text, eg: 1,8 billion

I eidt hook but it does not work, please help, thanks:

function bds_init(&$options, $memberInfo, &$args){
// minhx https://bigprof.com/appgini/tips-and-tu ... sing-hooks
$old_options = $options->QueryFieldsTV;
foreach($old_options as $field => $caption){
/* Keep all fields as-is except for the phone field */
if($field == '`bds`.`bds_price`'){
/* Display only the first four digits of the phone field */
echo 'dasdasdasd';
$new_options["SUBSTRING(`bds`.`bds_price`, 1, 4)"] = '9999999999';
}else{
/* Keep all other fields as-is */
$new_options[$field] = $caption;
}

$options->QueryFieldsTV = $new_options;
}



return TRUE;
}

Re: Table view to show Price text from price number

Posted: 2019-05-28 05:33
by tminh
$new_options["`bds`.`bds_price`"] = $caption;

i echo $caption but it show only 'bds_price' not its value'

how do i show its value

thanks

Re: Table view to show Price text from price number

Posted: 2019-05-30 08:37
by pbottcher
Hi,

you need to put the field to which you apply the change of the sqlquery.

$new_options["SUBSTRING(`bds`.`bds_price`, 1, 4)"] = '9999999999';

$new_options["SUBSTRING(`bds`.`bds_price`, 1, 4)"] = $caption;