Ejemplo n.º 1
0
 public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
 {
     // cookie saving/updating
     $this->context->cookie->id_country = $id_country;
     if ($id_state != 0) {
         $this->context->cookie->id_state = $id_state;
     }
     if ($zipcode != 0) {
         $this->context->cookie->postcode = $zipcode;
     }
     $id_zone = 0;
     if ($id_state != 0) {
         $id_zone = State::getIdZone($id_state);
     }
     if (!$id_zone) {
         $id_zone = Country::getIdZone($id_country);
     }
     $carriers = CarrierCompare::getCarriersByCountry($id_country, $id_state, $zipcode, $this->context->cart, $this->context->customer->id);
     return sizeof($carriers) ? $carriers : array();
 }
Ejemplo n.º 2
0
 public function getCarriersListByIdZone($id_country, $id_state = 0)
 {
     global $cart, $smarty;
     $id_zone = 0;
     if ($id_state != 0) {
         $id_zone = State::getIdZone($id_state);
     }
     if (!$id_zone) {
         $id_zone = Country::getIdZone($id_country);
     }
     $carriers = Carrier::getCarriersForOrder((int) $id_zone);
     return sizeof($carriers) ? $carriers : array();
 }
Ejemplo n.º 3
0
 public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
 {
     global $cart, $smarty, $cookie;
     // cookie saving/updating
     $cookie->id_country = $id_country;
     if ($id_state != 0) {
         $cookie->id_state = $id_state;
     }
     if ($zipcode != 0) {
         $cookie->postcode = $zipcode;
     }
     $id_zone = 0;
     if ($id_state != 0) {
         $id_zone = State::getIdZone($id_state);
     }
     if (!$id_zone) {
         $id_zone = Country::getIdZone($id_country);
     }
     $carriers = Carrier::getCarriersForOrder((int) $id_zone);
     return sizeof($carriers) ? $carriers : array();
 }
Ejemplo n.º 4
0
 public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
 {
     // cookie saving/updating
     $this->context->cookie->id_country = $id_country;
     if ($id_state != 0) {
         $this->context->cookie->id_state = $id_state;
     }
     if ($zipcode != 0) {
         $this->context->cookie->postcode = $zipcode;
     }
     $id_zone = 0;
     if ($id_state != 0) {
         $id_zone = State::getIdZone($id_state);
     }
     if (!$id_zone) {
         $id_zone = Country::getIdZone($id_country);
     }
     // Need to set the infos for carrier module !
     $this->context->cookie->id_country = $id_country;
     $this->context->cookie->id_state = $id_state;
     $this->context->cookie->postcode = $zipcode;
     $carriers = Carrier::getCarriersForOrder((int) $id_zone);
     return sizeof($carriers) ? $carriers : array();
 }
Ejemplo n.º 5
0
 public function getCarriersListByIdZone($id_country, $id_state = 0, $zipcode = 0)
 {
     global $cart, $smarty, $cookie;
     // cookie saving/updating
     $cookie->id_country = $id_country;
     if ($id_state != 0) {
         $cookie->id_state = $id_state;
     }
     if ($zipcode !== 0) {
         $cookie->postcode = $zipcode;
     }
     $id_zone = 0;
     if ($id_state != 0) {
         $id_zone = State::getIdZone($id_state);
     }
     if (!$id_zone) {
         $id_zone = Country::getIdZone($id_country);
     }
     // Need to set the infos for carrier module !
     $cookie->id_country = $id_country;
     $cookie->id_state = $id_state;
     $cookie->postcode = $zipcode;
     $carriers = array();
     if ($this->addAddress($id_country, $zipcode)) {
         // Back up the current id_address_delivery
         $current_id_address_delivery = $cart->id_address_delivery;
         // Get the new one created
         $cart->id_address_delivery = Configuration::get(CarrierCompare::VIRTUAL_ADDRESS);
         $cart->id_customer = Configuration::get(CarrierCompare::VIRTUAL_CUSTOMER);
         // Get carriers with good id_zone
         $carriers = Carrier::getCarriersForOrder((int) $id_zone);
         // Delete Address and restore id_address_delivery
         $address = new Address((int) Configuration::get(CarrierCompare::VIRTUAL_ADDRESS));
         $address->delete();
         $cart->id_address_delivery = $current_id_address_delivery;
     }
     return count($carriers) ? $carriers : array();
 }