Пример #1
0
 /**
  * @param Customer $entity
  */
 protected function processChangeAttributes(Customer $entity)
 {
     foreach ($entity->getAddresses() as $address) {
         $address->setOriginId(null);
     }
     $entity->setWebsite($entity->getStore()->getWebsite());
     $entity->setCreatedIn($entity->getStore()->getName());
     $this->setDefaultGroup($entity);
 }
 /**
  * @param Customer $value
  * @return array
  */
 protected function getRemoteCustomers($value)
 {
     $this->transport->init($value->getChannel()->getTransport());
     $filter = new BatchFilterBag();
     $filter->addComplexFilter('email', ['key' => 'email', 'value' => ['key' => 'eq', 'value' => $value->getEmail()]]);
     $filter->addComplexFilter('store_id', ['key' => 'store_id', 'value' => ['key' => 'eq', 'value' => $value->getStore()->getOriginId()]]);
     $filters = $filter->getAppliedFilters();
     $customers = $this->transport->call(SoapTransport::ACTION_CUSTOMER_LIST, $filters);
     return (array) $customers;
 }
Пример #3
0
 /**
  * @param Customer $customer
  *
  * @return array
  */
 protected function getModifiedCustomerOrder(Customer $customer)
 {
     return ['increment_id' => '100000307', 'store_id' => $customer->getStore()->getOriginId(), 'created_at' => '2014-05-29 16:41:43', 'updated_at' => '2014-05-29 16:41:43', 'customer_id' => $customer->getOriginId(), 'tax_amount' => '0.0000', 'shipping_amount' => '5.0000', 'discount_amount' => '0.0000', 'subtotal' => '750.0000', 'grand_total' => '755.0000', 'total_qty_ordered' => '1.0000', 'base_tax_amount' => '0.0000', 'base_shipping_amount' => '5.0000', 'base_discount_amount' => '0.0000', 'base_subtotal' => '750.0000', 'base_grand_total' => '755.0000', 'billing_address_id' => '603', 'billing_firstname' => 'asdf', 'billing_lastname' => 'asdf', 'shipping_address_id' => '604', 'shipping_firstname' => 'asdf', 'shipping_lastname' => 'asdf', 'billing_name' => 'asdf asdf', 'shipping_name' => 'asdf asdf', 'store_to_base_rate' => '1.0000', 'store_to_order_rate' => '1.0000', 'base_to_global_rate' => '1.0000', 'base_to_order_rate' => '1.0000', 'weight' => '0.3000', 'store_name' => $customer->getStore()->getName(), 'status' => 'pending', 'state' => 'new', 'global_currency_code' => 'USD', 'base_currency_code' => 'USD', 'store_currency_code' => 'USD', 'order_currency_code' => 'USD', 'shipping_method' => 'flatrate_flatrate', 'shipping_description' => 'Flat Rate - Fixed', 'customer_email' => '*****@*****.**', 'customer_firstname' => 'asdf', 'customer_lastname' => 'asdf', 'quote_id' => '368', 'is_virtual' => '0', 'customer_group_id' => '1', 'customer_note_notify' => '0', 'customer_is_guest' => '0', 'email_sent' => '1', 'order_id' => '302', 'shipping_address' => [], 'billing_address' => [], 'items' => [], 'payment' => '', 'status_history' => [], 'store_code' => $customer->getStore()->getCode(), 'store_storename' => $customer->getStore()->getName(), 'store_website_id' => $customer->getStore()->getWebsite()->getOriginId(), 'store_website_code' => $customer->getStore()->getWebsite()->getCode(), 'store_website_name' => $customer->getStore()->getWebsite()->getName()];
 }
Пример #4
0
 /**
  * Update $entity with new data from imported $store, $website, $group
  *
  * @param Customer      $entity
  * @param Store         $store
  * @param Website       $website
  * @param CustomerGroup $group
  *
  * @return $this
  */
 protected function updateStoresAndGroup(Customer $entity, Store $store, Website $website, CustomerGroup $group)
 {
     // do not allow to change code/website name by imported entity
     $doNotUpdateFields = ['id', 'code', 'name'];
     if (!isset($this->websiteEntityCache[$website->getCode()])) {
         $this->websiteEntityCache[$website->getCode()] = $this->findAndReplaceEntity($website, MagentoConnectorInterface::WEBSITE_TYPE, ['code' => $website->getCode(), 'channel' => $website->getChannel(), 'originId' => $website->getOriginId()], $doNotUpdateFields);
     }
     $this->websiteEntityCache[$website->getCode()] = $this->merge($this->websiteEntityCache[$website->getCode()]);
     if (!isset($this->storeEntityCache[$store->getCode()])) {
         $this->storeEntityCache[$store->getCode()] = $this->findAndReplaceEntity($store, MagentoConnectorInterface::STORE_TYPE, ['code' => $store->getCode(), 'channel' => $store->getChannel(), 'originId' => $store->getOriginId()], $doNotUpdateFields);
     }
     $this->storeEntityCache[$store->getCode()] = $this->merge($this->storeEntityCache[$store->getCode()]);
     if (!isset($this->groupEntityCache[$group->getName()])) {
         $this->groupEntityCache[$group->getName()] = $this->findAndReplaceEntity($group, MagentoConnectorInterface::CUSTOMER_GROUPS_TYPE, ['name' => $group->getName(), 'channel' => $group->getChannel(), 'originId' => $group->getOriginId()], $doNotUpdateFields);
     }
     $this->groupEntityCache[$group->getName()] = $this->merge($this->groupEntityCache[$group->getName()]);
     $entity->setWebsite($this->websiteEntityCache[$website->getCode()])->setStore($this->storeEntityCache[$store->getCode()])->setGroup($this->groupEntityCache[$group->getName()]);
     $entity->getStore()->setWebsite($entity->getWebsite());
 }