public function info($data = array())
{
$time_format = $this->config->item('time_format') ? $this->config->item('time_format') : '%h:%i %a';
if ($this->config->item('maps_api_key')) {
$map_key = '&key=' . $this->config->item('maps_api_key');
} else {
$map_key = '';
}
$this->template->setScriptTag('https://maps.googleapis.com/maps/api/js?v=3' . $map_key . '&sensor=false®ion=GB&libraries=geometry', 'google-maps-js', '104330');
$data['has_delivery'] = $this->location->hasDelivery();
$data['has_collection'] = $this->location->hasCollection();
$data['opening_status'] = $this->location->workingStatus('opening');
$data['delivery_status'] = $this->location->workingStatus('delivery');
$data['collection_status'] = $this->location->workingStatus('collection');
$data['last_order_time'] = mdate($time_format, strtotime($this->location->lastOrderTime()));
$data['local_description'] = $this->location->getDescription();
$data['map_address'] = $this->location->getAddress();
// retrieve local location data
$data['location_telephone'] = $this->location->getTelephone();
// retrieve local location data
$data['working_hours'] = $this->location->workingHours();
//retrieve local restaurant opening hours from location library
$data['working_type'] = $this->location->workingType();
if (!$this->location->hasDelivery() or empty($data['working_type']['delivery'])) {
unset($data['working_hours']['delivery']);
}
if (!$this->location->hasCollection() or empty($data['working_type']['collection'])) {
unset($data['working_hours']['collection']);
}
$data['delivery_time'] = $this->location->deliveryTime();
if ($data['delivery_status'] === 'closed') {
$data['delivery_time'] = 'closed';
} else {
if ($data['delivery_status'] === 'opening') {
$data['delivery_time'] = $this->location->workingTime('delivery', 'open');
}
}
$data['collection_time'] = $this->location->collectionTime();
if ($data['collection_status'] === 'closed') {
$data['collection_time'] = 'closed';
} else {
if ($data['collection_status'] === 'opening') {
$data['collection_time'] = $this->location->workingTime('collection', 'open');
}
}
$local_payments = $this->location->payments();
$payments = $this->extension->getAvailablePayments(FALSE);
$payment_list = '';
foreach ($payments as $code => $payment) {
if (empty($local_payments) or in_array($code, $local_payments)) {
$payment_list[] = $payment['name'];
}
}
$data['payments'] = implode(', ', $payment_list);
$area_colors = array('#F16745', '#FFC65D', '#7BC8A4', '#4CC3D9', '#93648D', '#404040', '#F16745', '#FFC65D', '#7BC8A4', '#4CC3D9', '#93648D', '#404040', '#F16745', '#FFC65D', '#7BC8A4', '#4CC3D9', '#93648D', '#404040', '#F16745', '#FFC65D');
$data['area_colors'] = $area_colors;
$conditions = array('all' => $this->lang->line('text_delivery_all_orders'), 'above' => $this->lang->line('text_delivery_above_total'), 'below' => $this->lang->line('text_delivery_below_total'));
$data['delivery_areas'] = array();
$delivery_areas = $this->location->deliveryAreas();
foreach ($delivery_areas as $area_id => $area) {
if (isset($area['charge']) and is_string($area['charge'])) {
$area['charge'] = array(array('amount' => $area['charge'], 'condition' => 'above', 'total' => isset($area['min_amount']) ? $area['min_amount'] : '0'));
}
$text_condition = '';
foreach ($area['condition'] as $condition) {
$condition = explode('|', $condition);
$delivery = (isset($condition[0]) and $condition[0] > 0) ? $this->currency->format($condition[0]) : $this->lang->line('text_free_delivery');
$con = isset($condition[1]) ? $condition[1] : 'above';
$total = (isset($condition[2]) and $condition[2] > 0) ? $this->currency->format($condition[2]) : $this->lang->line('text_no_min_total');
if ($con === 'all') {
$text_condition .= sprintf($conditions['all'], $delivery);
} else {
if ($con === 'above') {
$text_condition .= sprintf($conditions[$con], $delivery, $total) . ', ';
} else {
if ($con === 'below') {
$text_condition .= sprintf($conditions[$con], $total) . ', ';
}
}
}
}
$data['delivery_areas'][] = array('area_id' => $area['area_id'], 'name' => $area['name'], 'type' => $area['type'], 'color' => $area_colors[(int) $area_id - 1], 'shape' => $area['shape'], 'circle' => $area['circle'], 'condition' => trim($text_condition, ', '));
}
$data['location_lat'] = $data['location_lng'] = '';
if ($local_info = $this->location->local()) {
//if local restaurant data is available
$data['location_lat'] = $local_info['location_lat'];
$data['location_lng'] = $local_info['location_lng'];
}
return $data;
}