This topic is locked
[SOLVED]

 "new arrival" label near list records. How?

11/7/2011 4:15:05 PM
PHPRunner General questions
A
ahaat author

Hi everybody
I have table that stores products information with field that indicates the added date. Now in the list page I would like to display near each recently added product a label "new arrival" for each record added let say last 10 days. How that can be done using the event and editor within phprunner?
Many thanks in advance

C
cgphp 11/7/2011

In the Query tab, create an alias for one of the fields of your table:

SELECT

field_1,

field_2,

field_3,

field_3 as new_arrival

FROM table_name


In the Fields tab, enable the new alias field only for the List page.
In the visual editor, set the new alias field as Custom (http://xlinesoft.com/phprunner/docs/_view_as__settings_custom.htm) and enter this code:

$date_diff = time() - strtotime($data['added_date_field_name']);

$time_limit = 3600 * 24 * 10;

$value = "";

if($date_diff <= $time_limit)

$value = "new arrival";
A
ahaat author 11/8/2011



In the Query tab, create an alias for one of the fields of your table:

SELECT

field_1,

field_2,

field_3,

field_3 as new_arrival

FROM table_name


In the Fields tab, enable the new alias field only for the List page.
In the visual editor, set the new alias field as Custom (http://xlinesoft.com/phprunner/docs/_view_as__settings_custom.htm) and enter this code:

$date_diff = time() - strtotime($data['added_date_field_name']);

$time_limit = 3600 * 24 * 10;

$value = "";

if($date_diff <= $time_limit)

$value = "new arrival";



It works fine ... Many Many Thanks