本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getDataUsingMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getDataUsingMethod方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getDataUsingMethod怎么用?PHP Mage_Sales_Model_Quote_Address::getDataUsingMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getDataUsingMethod方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setExportedAddressData
/**
* Sets address data from exported address
*
* @param Mage_Sales_Model_Quote_Address $address
* @param array $exportedAddress
*/
protected function _setExportedAddressData($address, $exportedAddress)
{
foreach ($exportedAddress->getExportedKeys() as $key) {
$oldData = $address->getDataUsingMethod($key);
$isEmpty = null;
if (is_array($oldData)) {
foreach ($oldData as $val) {
if (!empty($val)) {
$isEmpty = false;
break;
}
$isEmpty = true;
}
}
if (empty($oldData) || $isEmpty === true) {
$address->setDataUsingMethod($key, $exportedAddress->getData($key));
}
}
}
示例2: _checkUseForShipping
/**
* Checks the shipping address is equal with billing address
*
* ATTENTION!!!
* It should be removed when mobile app will send just the 'use_for_shipping' flag
* instead of send shipping address same as a billing address
*
* @todo Remove when mobile app will send just the 'use_for_shipping' flag
* @param array $data
* @param Mage_Sales_Model_Quote_Address $billingAddress
* @param integer $shippingAddressId
* @return bool
*/
protected function _checkUseForShipping(array $data, $billingAddress, $shippingAddressId)
{
$useForShipping = !$shippingAddressId || $billingAddress->getId() == $shippingAddressId;
if ($useForShipping) {
foreach ($data as $key => $value) {
if ($key == 'save_in_address_book') {
continue;
}
$billingData = $billingAddress->getDataUsingMethod($key);
if (is_array($value) && is_array($billingData)) {
foreach ($value as $k => $v) {
if (!isset($billingData[$k]) || $billingData[$k] != trim($v)) {
$useForShipping = false;
break;
}
}
} else {
if (is_string($value) && $billingData != trim($value)) {
$useForShipping = false;
break;
} else {
$useForShipping = false;
break;
}
}
}
}
return $useForShipping;
}
示例3: _setExportedAddressData
/**
* Sets address data from exported address
*
* @param Mage_Sales_Model_Quote_Address $address
* @param array $exportedAddress
*/
protected function _setExportedAddressData($address, $exportedAddress)
{
// Exported data is more priority if we came from Express Checkout button
$isButton = (bool) $this->_quote->getPayment()->getAdditionalInformation(self::PAYMENT_INFO_BUTTON);
if (!$isButton) {
foreach ($exportedAddress->getExportedKeys() as $key) {
$oldData = $address->getDataUsingMethod($key);
$isEmpty = null;
if (is_array($oldData)) {
foreach ($oldData as $val) {
if (!empty($val)) {
$isEmpty = false;
break;
}
$isEmpty = true;
}
}
if (empty($oldData) || $isEmpty === true) {
$address->setDataUsingMethod($key, $exportedAddress->getData($key));
}
}
} else {
foreach ($exportedAddress->getExportedKeys() as $key) {
$data = $exportedAddress->getData($key);
if (!empty($data)) {
$address->setDataUsingMethod($key, $data);
}
}
}
}