public static function getZoneById($id_address) { $address = new Address((int) $id_address); $zone = Db::getInstance()->getValue(' SELECT id_zone FROM ' . _DB_PREFIX_ . 'zip_code_zone WHERE id_country = ' . (int) $address->id_country . ' AND min <= ' . (int) $address->postcode . ' AND max >= ' . (int) $address->postcode); return $zone ? (int) $zone : (int) parent::getZoneById((int) $id_address); }
private function setOrder_prestashop($id, $cart, $customer, $language, $currency, $more = null) { $details = array(); foreach ($cart->getProducts() as $prod) { $details[] = array('name' => $prod['name'], 'price' => $prod['price'], 'quantity' => $prod['cart_quantity']); } $this->order = array('id' => $id, 'at' => $cart->date_add, 'currency' => $currency, 'total' => $cart->getOrderTotal(true, \Cart::BOTH), 'language' => $language, 'items_count' => $cart->nbProducts(), 'details' => $details); $addr_delivery = new \AddressCore($cart->id_address_delivery); $addr_invoice = new \AddressCore($cart->id_address_invoice); $this->customer = array('id' => $customer->id, 'name' => $customer->firstname . ' ' . $customer->lastname, 'email' => $customer->email, 'phone' => array($addr_invoice->phone, $addr_invoice->phone_mobile), 'city' => $addr_invoice->city, 'zipcode' => $addr_invoice->postcode, 'country' => $addr_invoice->country, 'address' => array('invoice' => $addr_invoice->getFields(), 'delivery' => $addr_delivery->getFields()), 'ip' => self::getIPs(), 'company' => $customer->company, 'siret' => $customer->siret, 'ape' => $customer->ape, 'risk' => $customer->id_risk, 'created_at' => $customer->date_add, 'geoloc' => array('country' => $customer->geoloc_id_country, 'state' => $customer->geoloc_id_state, 'postcode' => $customer->geoloc_postcode)); $this->more = $more; }
/** * Check if an address exists depending on given $id_address * * @param $id_address * @return bool */ public function addressExists($id_address) { return \AddressCore::addressExists($id_address); }