Exemplo n.º 1
0
 public function __construct(Wordpress $wp, \Jigoshop\Core\Options $options, ProductServiceInterface $productService, TaxServiceInterface $taxService)
 {
     $this->wp = $wp;
     $this->options = $options;
     $this->productService = $productService;
     if ($this->options->get('tax.included')) {
         $address = new Customer\Address();
         $address->setCountry($this->options->get('general.country'));
         $address->setState($this->options->get('general.state'));
         $this->taxes = $taxService->getDefinitions($address);
     }
     $wp->addAction('wp_ajax_jigoshop.admin.migration.products', array($this, 'ajaxMigrationProducts'), 10, 0);
 }
Exemplo n.º 2
0
 private function createAddress($data)
 {
     if (!empty($data['company'])) {
         $address = new CustomerEntity\CompanyAddress();
         $address->setCompany($data['company']);
         if (isset($data['euvatno'])) {
             $address->setVatNumber($data['euvatno']);
         }
     } else {
         $address = new CustomerEntity\Address();
     }
     $address->setFirstName($data['first_name']);
     $address->setLastName($data['last_name']);
     $address->setAddress($data['address']);
     $address->setCountry($data['country']);
     $address->setState($data['state']);
     $address->setCity($data['city']);
     $address->setPostcode($data['postcode']);
     if (isset($data['phone'])) {
         $address->setPhone($data['phone']);
     }
     if (isset($data['email'])) {
         $address->setEmail($data['email']);
     }
     return $address;
 }
Exemplo n.º 3
0
 private function _migrateCustomer($customer, $data)
 {
     $data = $this->_fetchCustomerData($data);
     if (!$customer) {
         $customer = new Customer();
     } else {
         $customer = maybe_unserialize(maybe_unserialize($customer));
     }
     if (!$customer instanceof Customer) {
         $customer = new Customer();
     }
     if (!empty($data['billing_company']) && !empty($data['billing_euvatno'])) {
         $address = new Customer\CompanyAddress();
         $address->setCompany($data['billing_company']);
         $address->setVatNumber($data['billing_euvatno']);
     } else {
         $address = new Customer\Address();
     }
     $address->setFirstName($data['billing_first_name']);
     $address->setLastName($data['billing_last_name']);
     $address->setAddress($data['billing_address_1'] . ' ' . $data['billing_address_2']);
     $address->setCountry($data['billing_country']);
     $address->setState($data['billing_state']);
     $address->setPostcode($data['billing_postcode']);
     $address->setPhone($data['billing_phone']);
     $address->setEmail($data['billing_email']);
     $customer->setBillingAddress($address);
     if (!empty($data['shipping_company'])) {
         $address = new Customer\CompanyAddress();
         $address->setCompany($data['shipping_company']);
     } else {
         $address = new Customer\Address();
     }
     $address->setFirstName($data['shipping_first_name']);
     $address->setLastName($data['shipping_last_name']);
     $address->setAddress($data['shipping_address_1'] . ' ' . $data['shipping_address_2']);
     $address->setCountry($data['shipping_country']);
     $address->setState($data['shipping_state']);
     $address->setPostcode($data['shipping_postcode']);
     $customer->setShippingAddress($address);
     return $customer;
 }