本文整理汇总了PHP中Mage_Sales_Model_Quote::getAllAddresses方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote::getAllAddresses方法的具体用法?PHP Mage_Sales_Model_Quote::getAllAddresses怎么用?PHP Mage_Sales_Model_Quote::getAllAddresses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote::getAllAddresses方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearQuoteItemsCache
/**
* Mage_Sales_Model_Quote_Address caches items after each collectTotals call. Some extensions calls collectTotals
* after adding new item to quote in observers. So we need clear this cache before adding new item to quote.
*/
private function clearQuoteItemsCache()
{
foreach ($this->quote->getAllAddresses() as $address) {
/** @var $address Mage_Sales_Model_Quote_Address */
$address->unsetData('cached_items_all');
$address->unsetData('cached_items_nominal');
$address->unsetData('cached_items_nonominal');
}
}
示例2: detectWorstAddressScoreByQuote
/**
* @param Mage_Sales_Model_Quote $quote
* @return array
*/
public function detectWorstAddressScoreByQuote(Mage_Sales_Model_Quote $quote)
{
$quoteAddresses = $quote->getAllAddresses();
$addressScores = array();
foreach ($quoteAddresses as $address) {
/** @var $address Mage_Sales_Model_Quote_Address */
$addressScores[] = $address->getPayoneAddresscheckScore();
}
return $this->detectWorstScore($addressScores);
}
示例3: getPgAddress
/**
* Gets a PakjeGemak address for either a quote or an order object.
*
* @param Mage_Sales_Model_Quote|Mage_Sales_Model_Order $object
*
* @return false|Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address|TIG_MyParcel2014_Model_Shipment
*/
public function getPgAddress($object)
{
/**
* Get all addresses for the specified object.
*/
if ($object instanceof Mage_Sales_Model_Quote) {
$addressCollection = $object->getAllAddresses();
} elseif ($object instanceof Mage_Sales_Model_Order) {
$addressCollection = $object->getAddressesCollection();
} elseif ($object instanceof TIG_MyParcel2014_Model_Shipment) {
$order = $object->getOrder();
if (!$order) {
return false;
}
$addressCollection = $order->getAddressesCollection();
} else {
return false;
}
/**
* Go through each address and check if it's a PakjeGemak address.
*
* @var Mage_Sales_Model_Quote_Address|Mage_Sales_Model_Order_Address $address
*/
$pgAddress = false;
foreach ($addressCollection as $address) {
if ($address->getAddressType() == self::PG_ADDRESS_TYPE) {
$pgAddress = $address;
break;
}
}
/**
* Return the PakjeGemak address or false if none was found.
*/
return $pgAddress;
}
示例4: _validateQuote
/**
* Determine if taxes can be collected for the quote.
*
* @param Mage_Sales_Model_Quote
* @return self
* @throws EbayEnterprise_Tax_Exception_Collector_InvalidQuote_Exception If the quote is not valid for making a tax request.
*/
protected function _validateQuote(Mage_Sales_Model_Quote $quote)
{
// At a minimum, the quote must have at least one item and a billing
// address with usable information. Currently, a spot check of address
// data *should* be useful enough to separate a complete address from
// an incomplete address.
$billingAddress = $quote->getBillingAddress();
if ($quote->getItemsCount() && $billingAddress->getFirstname() && $billingAddress->getLastname() && $billingAddress->getStreetFull() && $billingAddress->getCountryId()) {
return $this->_validateAddresses($quote->getAllAddresses());
}
throw Mage::exception('EbayEnterprise_Tax_Exception_Collector_InvalidQuote', 'Quote invalid for tax collection.');
}
示例5: _setQuoteShopCoupons
/**
* Add coupon from this system to quote
*
* @param Mage_Sales_Model_Quote $quote
* @param ShopgateCartBase $order
*
* @return Mage_Sales_Model_Quote
* @throws ShopgateLibraryException
*/
protected function _setQuoteShopCoupons($quote, $order)
{
if (count($order->getExternalCoupons()) > 1) {
throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_TOO_MANY_COUPONS);
}
foreach ($order->getExternalCoupons() as $coupon) {
/* @var $coupon ShopgateShopgateCoupon */
$couponInfos = $this->jsonDecode($coupon->getInternalInfo(), true);
if ($order instanceof ShopgateOrder) {
if (!$coupon->getInternalInfo()) {
throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_NOT_VALID, 'Field "internal_info" is empty.');
}
/** @var Mage_SalesRule_Model_Coupon $mageCoupon */
if ($this->_getConfigHelper()->getIsMagentoVersionLower1410()) {
$mageCoupon = Mage::getModel('salesrule/rule')->load($couponInfos["coupon_id"]);
} else {
$mageCoupon = Mage::getModel('salesrule/coupon')->load($couponInfos["coupon_id"]);
}
$count = (int) $mageCoupon->getTimesUsed();
$count--;
$mageCoupon->setTimesUsed($count);
$mageCoupon->save();
}
$quote->setCouponCode($coupon->getCode());
foreach ($quote->getAllAddresses() as $address) {
$address->setCouponCode($coupon->getCode());
}
$quote->setTotalsCollectedFlag(false);
$quote->collectTotals();
if ($this->_errorOnInvalidCoupon) {
if ($coupon->getCode() != $quote->getCouponCode()) {
throw new ShopgateLibraryException(ShopgateLibraryException::COUPON_NOT_VALID, 'Code transferred by Shopgate"' . $coupon->getCode() . '" != "' . $quote->getCouponCode() . '" code in Magento');
}
}
$quote->save();
}
return $quote;
}
示例6: removePgAddress
/**
* Removes a saved PakjeGemak address from the quote.
*
* @param Mage_Sales_Model_Quote $quote
*
* @return $this
* @throws Exception
*/
public function removePgAddress(Mage_Sales_Model_Quote $quote)
{
if ($quote) {
if ($quote != '{}') {
$addresses = $quote->getAllAddresses();
/** @var Mage_Sales_Model_Quote_Address $address */
foreach ($addresses as $address) {
if ($address->getAddressType() == TIG_MyParcel2014_Helper_Data::PG_ADDRESS_TYPE) {
$address->delete();
}
}
}
}
return $this;
}