Example #1
0
 private function updateCustomer(Customer $customer)
 {
     $address = $customer->getShippingAddress();
     if ($customer->hasMatchingAddresses()) {
         $billingAddress = $customer->getBillingAddress();
         $billingAddress->setCountry($_POST['country']);
         $billingAddress->setState($_POST['state']);
         $billingAddress->setPostcode($_POST['postcode']);
     }
     $address->setCountry($_POST['country']);
     $address->setState($_POST['state']);
     $address->setPostcode($_POST['postcode']);
 }
Example #2
0
 /**
  * Abstraction for location update response.
  *
  * Prepares and returns array of updated data for location change requests.
  *
  * @param Customer   $customer The customer (for location).
  * @param CartEntity $cart     Current cart.
  *
  * @return array
  */
 private function getAjaxLocationResponse(Customer $customer, CartEntity $cart)
 {
     $response = $this->getAjaxCartResponse($cart);
     $address = $customer->getShippingAddress();
     // Add some additional fields
     $response['has_states'] = Country::hasStates($address->getCountry());
     $response['states'] = Country::getStates($address->getCountry());
     $response['html']['estimation'] = $address->getLocation();
     return $response;
 }