本文整理匯總了PHP中Magento\Quote\Model\Quote\Address::setStreet方法的典型用法代碼示例。如果您正苦於以下問題:PHP Address::setStreet方法的具體用法?PHP Address::setStreet怎麽用?PHP Address::setStreet使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Quote\Model\Quote\Address
的用法示例。
在下文中一共展示了Address::setStreet方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testExportCustomerAddressData
/**
* Export customer address from quote address
*/
public function testExportCustomerAddressData()
{
$street = ['Street1'];
$company = 'TestCompany';
$this->_address->setStreet($street);
$this->_address->setCompany($company);
$customerAddress = $this->_address->exportCustomerAddress();
$this->assertEquals($street, $customerAddress->getStreet(), 'Street was exported incorrectly.');
$this->assertEquals($company, $customerAddress->getCompany(), 'Company was exported incorrectly.');
}
示例2: updateAddressData
/**
* Sets address data from exported address
*
* @param Address $address
* @param array $addressData
* @return void
*/
private function updateAddressData(Address $address, array $addressData)
{
$extendedAddress = isset($addressData['extendedAddress']) ? $addressData['extendedAddress'] : null;
$address->setStreet([$addressData['streetAddress'], $extendedAddress]);
$address->setCity($addressData['locality']);
$address->setRegionCode($addressData['region']);
$address->setCountryId($addressData['countryCodeAlpha2']);
$address->setPostcode($addressData['postalCode']);
}
示例3: importBillingAddressData
/**
* The billing address returned from Braintree may have different format than the shipping address
*
* @param Address $address
* @param array $exportedAddress
* @return $this
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function importBillingAddressData($address, $exportedAddress)
{
$line1 = isset($exportedAddress['streetAddress']) ? $exportedAddress['streetAddress'] : $exportedAddress['line1'];
$line2 = isset($exportedAddress['extendedAddress']) ? $exportedAddress['extendedAddress'] : $exportedAddress['line2'];
$city = isset($exportedAddress['locality']) ? $exportedAddress['locality'] : $exportedAddress['city'];
$regionCode = isset($exportedAddress['region']) ? $exportedAddress['region'] : $exportedAddress['state'];
$countryCode = isset($exportedAddress['countryCodeAlpha2']) ? $exportedAddress['countryCodeAlpha2'] : $exportedAddress['countryCode'];
$address->setStreet([$line1, $line2]);
$address->setCity($city);
$address->setRegionCode($regionCode);
$address->setCountryId($countryCode);
$address->setPostcode($exportedAddress['postalCode']);
return $this;
}