Example #1
0
 protected function _getGuestInformations()
 {
     if (!$this->isOpcModuleActive()) {
         return parent::_getGuestInformations();
     }
     $customer = $this->context->customer;
     $address_delivery = new Address($this->context->cart->id_address_delivery);
     if ($customer->birthday) {
         $birthday = explode('-', $customer->birthday);
     } else {
         $birthday = array('0', '0', '0');
     }
     $ret = array('use_another_invoice_address' => (bool) ((int) $this->context->cart->id_address_invoice != (int) $this->context->cart->id_address_delivery), 'id_address_invoice' => (int) $this->context->cart->id_address_invoice, 'id_customer' => (int) $customer->id, 'email' => Tools::htmlentitiesUTF8($customer->email), 'customer_lastname' => Tools::htmlentitiesUTF8($customer->lastname), 'customer_firstname' => Tools::htmlentitiesUTF8($customer->firstname), 'newsletter' => (int) $customer->newsletter, 'optin' => (int) $customer->optin, 'id_address_delivery' => (int) $this->context->cart->id_address_delivery, 'company' => Tools::htmlentitiesUTF8($address_delivery->company), 'lastname' => Tools::htmlentitiesUTF8($address_delivery->lastname), 'firstname' => Tools::htmlentitiesUTF8($address_delivery->firstname), 'vat_number' => Tools::htmlentitiesUTF8($address_delivery->vat_number), 'dni' => Tools::htmlentitiesUTF8($address_delivery->dni), 'address1' => Tools::htmlentitiesUTF8($address_delivery->address1), 'address2' => Tools::htmlentitiesUTF8($address_delivery->address2), 'postcode' => Tools::htmlentitiesUTF8($address_delivery->postcode), 'city' => Tools::htmlentitiesUTF8($address_delivery->city), 'other' => Tools::htmlentitiesUTF8($address_delivery->other), 'phone' => Tools::htmlentitiesUTF8($address_delivery->phone), 'phone_mobile' => Tools::htmlentitiesUTF8($address_delivery->phone_mobile), 'alias' => Tools::htmlentitiesUTF8($address_delivery->alias), 'id_country' => (int) $address_delivery->id_country, 'id_state' => (int) $address_delivery->id_state, 'id_gender' => (int) $customer->id_gender, 'sl_year' => $birthday[0], 'sl_month' => $birthday[1], 'sl_day' => $birthday[2]);
     if ($this->inv_first_on || (int) $this->context->cart->id_address_invoice != (int) $this->context->cart->id_address_delivery) {
         $address_invoice = new Address((int) $this->context->cart->id_address_invoice);
         $customers_address = (int) $this->context->cookie->id_customer == $address_invoice->id_customer ? true : false;
         $invoice = array('id_country_invoice' => (int) $address_invoice->id_country, 'id_state_invoice' => (int) $address_invoice->id_state);
         if (Configuration::get('VATNUMBER_MANAGEMENT') && file_exists(_PS_MODULE_DIR_ . '/vatnumber/vatnumber.php') && !class_exists("VatNumber", false)) {
             include _PS_MODULE_DIR_ . '/vatnumber/vatnumber.php';
         }
         if (Configuration::get('VATNUMBER_MANAGEMENT') and file_exists(dirname(__FILE__) . '/../../modules/vatnumber/vatnumber.php') && VatNumber::isApplicable($address_invoice->id_country) && Configuration::get('VATNUMBER_COUNTRY') != $address_invoice->id_country) {
             $allow_eu_vat = 1;
         } else {
             $allow_eu_vat = 0;
         }
         if ($customers_address) {
             $addr = array('company_invoice' => Tools::htmlentitiesUTF8($address_invoice->company), 'lastname_invoice' => Tools::htmlentitiesUTF8($address_invoice->lastname), 'firstname_invoice' => Tools::htmlentitiesUTF8($address_invoice->firstname), 'vat_number_invoice' => Tools::htmlentitiesUTF8($address_invoice->vat_number), 'dni_invoice' => Tools::htmlentitiesUTF8($address_invoice->dni), 'address1_invoice' => Tools::htmlentitiesUTF8($address_invoice->address1), 'address2_invoice' => Tools::htmlentitiesUTF8($address_invoice->address2), 'postcode_invoice' => Tools::htmlentitiesUTF8($address_invoice->postcode), 'city_invoice' => Tools::htmlentitiesUTF8($address_invoice->city), 'other_invoice' => Tools::htmlentitiesUTF8($address_invoice->other), 'phone_invoice' => Tools::htmlentitiesUTF8($address_invoice->phone), 'phone_mobile_invoice' => Tools::htmlentitiesUTF8($address_invoice->phone_mobile), 'alias_invoice' => Tools::htmlentitiesUTF8($address_invoice->alias), 'allow_eu_vat_invoice' => $allow_eu_vat);
         } else {
             $addr = array();
         }
         $invoice = array_merge($invoice, $addr);
         $ret = array_merge($ret, $invoice);
     }
     return $ret;
 }