本文整理汇总了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));
}
示例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));
}
示例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();
}
}
示例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));
}
示例5:
function __construct(Order $order, Address $address = null)
{
$this->order = $order;
$this->address = $address ? $address : $order->getShippingAddress();
}