public function hookDisplayCarrierList($params) { $parcelStoresAllInOne = DpdDeliveryPoints::collectDeliveryPoints(country::getIsoById(country::getIdByName(null, $params['address']->country)), false, false); $parcelStoresAllInOne = $this->parcelSort($parcelStoresAllInOne, 'company'); $parcel_stores_city = array(); foreach ($parcelStoresAllInOne as $company) { $parcel_stores_city[trim($company['city'])][] = $company; } ksort($parcel_stores_city); self::setKeyPriority($parcel_stores_city, self::stringToarray(',', ',' . Configuration::get(self::CONST_PREFIX . 'CITY_PRIORITY'))); $carrier_id = (int) $this->context->cart->id_carrier; if ($carrier_id == Configuration::get('DELIVERYPOINTS_CARRIER_ID')) { $this->context->smarty->assign(array('id_carrier' => $params['cart']->id_carrier, 'id_address' => $params['address']->id, 'delivery_terminals' => $parcel_stores_city, 'delivery_option' => $params['address']->id, 'current_city' => $params['address']->city, 'carrier_name' => $this->getCarrierName($carrier_id), 'type_parcel_display' => Configuration::get(self::CONST_PREFIX . 'TYPE_PARCEL_DISPLAY'), 'short_office_name' => Configuration::get(self::CONST_PREFIX . 'SHORT_OFFICE_NAME'))); //$this->context->controller->addJS(_PS_MODULE_DIR_.'dynamicparceldistribution/views/js/script.js', 'all'); //$this->context->controller->addJS(_PS_MODULE_DIR_.'dynamicparceldistribution/views/js/script.js'); //print_r(_PS_MODULE_DIR_.'dynamicparceldistribution/views/js/script.js'); //$this->context->controller->addCSS($this->_path.'/views/css/mycss.css'); if (count($parcel_stores_city)) { //return $this->display(__FILE__, 'views/templates/hook/deliverypoints.tpl'); $output = $this->context->smarty->fetch($this->local_path . 'views/templates/hook/deliverypoints.tpl'); return $output; } else { self::log('hookDisplayCarrierList -> Not found any parcel stores. maybe user and password is not correct?'); } return ''; } if ($carrier_id == Configuration::get('COURIERSERVICE_CARRIER_ID')) { if (Configuration::get(self::CONST_PREFIX . 'SHOW_DELIVERY_TIME')) { $this->getDeliveryTimeAvailable($params['address']->city); //Leave only available times if (empty(self::$delivery_time)) { //Last check for how much available return ''; } $this->context->smarty->assign(array('delivery_option' => $params['address']->id, 'id_carrier' => $params['cart']->id_carrier, 'id_address' => $params['address']->id, 'carrier_name' => $this->getCarrierName($carrier_id), 'delivery_time' => self::$delivery_time)); if (count(self::$delivery_time)) { //return $this->display(__FILE__, 'views/templates/hook/courierservice.tpl'); $output = $this->context->smarty->fetch($this->local_path . 'views/templates/hook/courierservice.tpl'); return $output; } else { self::log('hookDisplayCarrierList -> Not found any delivery time'); } } } return ''; }