Beispiel #1
0
 /**
  * Replace shipping address with pickup location address
  *
  * @param CheckoutOnePage $subject
  * @param array $result
  * @return $this
  */
 public function afterSaveShippingMethod(CheckoutOnePage $subject, array $result)
 {
     if ($result) {
         return $result;
     }
     $quote = $subject->getQuote();
     $shippingAddress = $quote->getShippingAddress();
     $shippingMethod = $shippingAddress->getShippingMethod();
     /**
      * In-Store pickup selected
      * Update Shipping Address
      */
     if (strpos($shippingMethod, $this->carrier->getCarrierCode()) !== false) {
         $locationAddress = $this->carrier->getLocationInfo($shippingMethod);
         $shippingAddress->setCountryId($locationAddress['country_id']);
         $shippingAddress->setRegionId($locationAddress['region_id']);
         $shippingAddress->setPostcode($locationAddress['postcode']);
         $shippingAddress->setCity($locationAddress['city']);
         $shippingAddress->setStreet($locationAddress['street']);
         $shippingAddress->setTelephone($locationAddress['phone']);
     }
     return $result;
 }