本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getAllTotalAmounts方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getAllTotalAmounts方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getAllTotalAmounts怎么用?PHP Mage_Sales_Model_Quote_Address::getAllTotalAmounts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getAllTotalAmounts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: collect
/**
* Collect grand total address amount
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Grand
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$grandTotal = $address->getGrandTotal();
$baseGrandTotal = $address->getBaseGrandTotal();
$totals = array_sum($address->getAllTotalAmounts());
$baseTotals = array_sum($address->getAllBaseTotalAmounts());
$address->setGrandTotal($grandTotal + $totals);
$address->setBaseGrandTotal($baseGrandTotal + $baseTotals);
return $this;
}
示例2: collect
/**
* Collect grand total address amount
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Grand
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
/** @var $helper Openstream_RappenRounding_Helper_Data */
$helper = Mage::helper('rappenrounding');
$grandTotal = $address->getGrandTotal();
$baseGrandTotal = $address->getBaseGrandTotal();
$totals = array_sum($address->getAllTotalAmounts());
$baseTotals = array_sum($address->getAllBaseTotalAmounts());
if ($helper->getScope() == 'totals' || $helper->getScope() == 'all') {
$address->setGrandTotal($helper->_roundBase5($grandTotal + $totals));
$address->setBaseGrandTotal($helper->_roundBase5($baseGrandTotal + $baseTotals));
} else {
$address->setGrandTotal($grandTotal + $totals);
$address->setBaseGrandTotal($baseGrandTotal + $baseTotals);
}
return $this;
}
示例3: getFeeBaseAmount
/**
* Get base amount for calculation of fee (for Magento 1.4.X - 1.6.X)
* @param Mage_Sales_Model_Quote_Address $shippingAddress
* @return number
*/
public function getFeeBaseAmount(Mage_Sales_Model_Quote_Address $shippingAddress)
{
return array_sum($shippingAddress->getAllTotalAmounts());
}
示例4: calculateDiscount
public function calculateDiscount(Mage_Sales_Model_Quote_Address $address, $currencyCode)
{
$giftCardDiscount = 0;
$total = 0;
$totals = $address->getAllTotalAmounts();
$quote = $address->getQuote();
if (count($totals) > 0) {
foreach ($totals as $amount) {
$total += $amount;
}
}
if ($total > 0) {
$giftCardDiscount = 0;
$appliedGiftCardCollection = $this->getGiftCardCollection($quote->getId());
if (count($appliedGiftCardCollection) > 0) {
foreach ($appliedGiftCardCollection as $giftCard) {
$balance = $giftCard->getBalance($currencyCode);
$giftCardDiscount -= $balance;
}
}
//if total less than gift cards balance
if ($giftCardDiscount < $total * -1) {
$giftCardDiscount = $total * -1;
}
}
return $giftCardDiscount;
}