当前位置: 首页>>代码示例>>PHP>>正文


PHP Order::getShippingAddress方法代码示例

本文整理汇总了PHP中Order::getShippingAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getShippingAddress方法的具体用法?PHP Order::getShippingAddress怎么用?PHP Order::getShippingAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Order的用法示例。


在下文中一共展示了Order::getShippingAddress方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getGatewayData

 /**
  * Map shop data to omnipay fields
  *
  * @param array $customData Usually user submitted data.
  *
  * @return array
  */
 protected function getGatewayData($customData)
 {
     $shipping = $this->order->getShippingAddress();
     $billing = $this->order->getBillingAddress();
     $numPayments = Payment::get()->filter(array('OrderID' => $this->order->ID))->count() - 1;
     $transactionId = $this->order->Reference . ($numPayments > 0 ? "-{$numPayments}" : '');
     return array_merge($customData, array('transactionId' => $transactionId, 'firstName' => $this->order->FirstName, 'lastName' => $this->order->Surname, 'email' => $this->order->Email, 'company' => $this->order->Company, 'billingAddress1' => $billing->Address, 'billingAddress2' => $billing->AddressLine2, 'billingCity' => $billing->City, 'billingPostcode' => $billing->PostalCode, 'billingState' => $billing->State, 'billingCountry' => $billing->Country, 'billingPhone' => $billing->Phone, 'shippingAddress1' => $shipping->Address, 'shippingAddress2' => $shipping->AddressLine2, 'shippingCity' => $shipping->City, 'shippingPostcode' => $shipping->PostalCode, 'shippingState' => $shipping->State, 'shippingCountry' => $shipping->Country, 'shippingPhone' => $shipping->Phone));
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:15,代码来源:OrderProcessor.php

示例2: getGatewayData

 /**
  * Map shop data to omnipay fields
  *
  * @param array $customData Usually user submitted data.
  *
  * @return array
  */
 protected function getGatewayData($customData)
 {
     $shipping = $this->order->getShippingAddress();
     $billing = $this->order->getBillingAddress();
     $numPayments = Payment::get()->where(array('"OrderID" = ?' => $this->order->ID))->count();
     $numPayments--;
     $transactionId = strtoupper(i18n::get_lang_from_locale(i18n::get_locale())) . $this->order->Reference . ($numPayments > 0 ? '-' . $numPayments : '');
     if (Director::isDev()) {
         $transactionId .= Member::currentUser() ? '-' . Member::currentUserID() : '';
     }
     return array_merge($customData, array('transactionId' => $transactionId, 'firstName' => $this->order->FirstName, 'lastName' => $this->order->Surname, 'email' => $this->order->Email, 'company' => $this->order->Company, 'billingAddress1' => $billing->Address, 'billingAddress2' => $billing->AddressLine2, 'billingCity' => $billing->City, 'billingPostcode' => $billing->PostalCode, 'billingState' => $billing->State, 'billingCountry' => $billing->Country, 'billingPhone' => $billing->Phone, 'shippingAddress1' => $shipping->Address, 'shippingAddress2' => $shipping->AddressLine2, 'shippingCity' => $shipping->City, 'shippingPostcode' => $shipping->PostalCode, 'shippingState' => $shipping->State, 'shippingCountry' => $shipping->Country, 'shippingPhone' => $shipping->Phone));
 }
开发者ID:NobrainerWeb,项目名称:silverstripe-shop,代码行数:19,代码来源:OrderProcessor.php

示例3: setData

 /**
  * @throws ValidationException
  */
 public function setData(Order $order, array $data)
 {
     if (Member::currentUserID()) {
         return;
     }
     if (!Checkout::membership_required() && empty($data['Password'])) {
         return;
     }
     $factory = new ShopMemberFactory();
     $member = $factory->create($data);
     $member->write();
     $member->extend('onAfterMemberCreate');
     $member->logIn();
     if ($order->BillingAddressID) {
         $address = $order->getBillingAddress();
         $address->MemberID = $member->ID;
         $address->write();
         $member->DefaultBillingAddressID = $order->BillingAddressID;
     }
     if ($order->ShippingAddressID) {
         $address = $order->getShippingAddress();
         $address->MemberID = $member->ID;
         $address->write();
         $member->DefaultShippingAddressID = $order->ShippingAddressID;
     }
     if ($member->isChanged()) {
         $member->write();
     }
 }
开发者ID:NobrainerWeb,项目名称:silverstripe-shop,代码行数:32,代码来源:MembershipCheckoutComponent.php

示例4: getGatewayData

 /**
  * Map shop data to omnipay fields
  * 
  * @param array $customData Usually user submitted data.
  * @return array
  */
 protected function getGatewayData($customData)
 {
     $shipping = $this->order->getShippingAddress();
     $billing = $this->order->getBillingAddress();
     return array_merge($customData, array('transactionId' => $this->order->Reference, 'firstName' => $this->order->FirstName, 'lastName' => $this->order->Surname, 'email' => $this->order->Email, 'company' => $this->order->Company, 'billingAddress1' => $billing->Address, 'billingAddress2' => $billing->AddressLine2, 'billingCity' => $billing->City, 'billingPostcode' => $billing->PostalCode, 'billingState' => $billing->State, 'billingCountry' => $billing->Country, 'billingPhone' => $billing->Phone, 'shippingAddress1' => $shipping->Address, 'shippingAddress2' => $shipping->AddressLine2, 'shippingCity' => $shipping->City, 'shippingPostcode' => $shipping->PostalCode, 'shippingState' => $shipping->State, 'shippingCountry' => $shipping->Country, 'shippingPhone' => $shipping->Phone));
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:12,代码来源:OrderProcessor.php

示例5:

 function __construct(Order $order, Address $address = null)
 {
     $this->order = $order;
     $this->address = $address ? $address : $order->getShippingAddress();
 }
开发者ID:burnbright,项目名称:silverstripe-shop-shipping,代码行数:5,代码来源:ShippingEstimator.php


注:本文中的Order::getShippingAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。