Esempio n. 1
0
 /**
  * Display order tracking info
  *
  * @param array $params (order, cart)
  * @return string template rendering
  */
 public function hookOrderDetailDisplayed($params)
 {
     global $smarty;
     $kiala_order = SmKialaOrder::getByOrder($params['order']->id);
     if (!Validate::isLoadedObject($kiala_order)) {
         return false;
     }
     $address = new Address($params['order']->id_address_delivery);
     $kiala_country = SmKialaCountry::getByIdCountry($address->id_country);
     $search_by = Configuration::get('KIALASMALL_SEARCH_BY');
     if ($search_by == 'customer') {
         $id = $kiala_order->id_customer;
     } elseif ($search_by == 'order') {
         $id = Configuration::get('KIALASMALL_NUMBER_PREFIX') . $kiala_order->id;
     } else {
         return false;
     }
     $kiala_request = new SmKialaRequest();
     $url = $kiala_request->getTrackingRequest($address, $kiala_country, $params['order']->id_lang, $id, $search_by);
     $smarty->assign('url_tracking', Tools::safeOutput($url));
     return $this->display(__FILE__, 'orderDetail.tpl');
 }
Esempio n. 2
0
 /**
  * Build the locate&select point list url
  *
  * @param int $max_result
  * @param string $point_short_id
  */
 public function getPointRequest($max_result, $point_short_id = null)
 {
     global $cart;
     $address = new Address($cart->id_address_delivery);
     $kiala_country = SmKialaCountry::getByIdCountry($address->id_country);
     if (!Validate::isLoadedObject($kiala_country) || !$kiala_country->isActive()) {
         return false;
     }
     $params = array('dspid' => $kiala_country->dspid, 'country' => Country::getIsoById($address->id_country), 'language' => Language::getIsoById($cart->id_lang), 'preparation_delay' => $kiala_country->preparation_delay, 'street' => $address->address1, 'zip' => $address->postcode, 'city' => $address->city, 'sort-method' => 'ACTIVE_ONLY' . ($point_short_id ? ' ' . $point_short_id : ''), 'max-result' => (int) $max_result);
     return $this->list_url . $this->prepareParams($params);
 }