Skip to content

Instantly share code, notes, and snippets.

@PrestaEdit
Last active August 29, 2015 14:12
Show Gist options
  • Save PrestaEdit/0ee7af5fac0879818d1b to your computer and use it in GitHub Desktop.
Save PrestaEdit/0ee7af5fac0879818d1b to your computer and use it in GitHub Desktop.
PrestaShop - Module dashboard
A few new variables are necessary for a proper dashboard module:
$this->push_filename: the directory where your push data should be stored.
$this->allow_push: a boolean indicating whether your module should have data be pushed to it. or not.
$this->push_time_limit: the numbers of seconds between two data pushes.
PrestaShop 1.6 implements several new hooks dedicated to dashboard modules:
dashboardData: how you want your data to be handled.
dashboardZoneOne: enables you to display your content in the left column of the dashboard zone.
dashboardZoneTwo: enables you to display your content in the central column of the dashboard zone.
Params
hookDashboardZoneOne
@TODO
hookDashboardZoneTwo
date_from
date_to
hookDashboardData
date_from
date_to
compare_from
compare_to
dashboard_use_push
extra
The data types
There are 4 data types that your module can use:
Value: a single value, which can have any data type (string, number, boolean, etc.)
Trends: a specific type, available as an array two values:
'way': either 'up' or 'down', depending on the trend
'value': the difference between the past and current value.
List Small: an array of values.
Chart: an array of two values:
'chart_type': the type of chart to be used (ie.: 'pie_chart_trends').
'data': an array of arrays:
key: the data key.
y: the data value.
Update push file:
Tools::changeFileMTime($this->push_filename);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment