本文整理匯總了PHP中Magento\Quote\Model\Quote\Address::getBaseGrandTotal方法的典型用法代碼示例。如果您正苦於以下問題:PHP Address::getBaseGrandTotal方法的具體用法?PHP Address::getBaseGrandTotal怎麽用?PHP Address::getBaseGrandTotal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Quote\Model\Quote\Address
的用法示例。
在下文中一共展示了Address::getBaseGrandTotal方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: collect
/**
* @param \Magento\Quote\Model\Quote\Address $address
* @return $this
*/
public function collect(\Magento\Quote\Model\Quote\Address $address)
{
$address->setCustbalanceAmount(0);
$address->setBaseCustbalanceAmount(0);
$address->setGrandTotal($address->getGrandTotal() - $address->getCustbalanceAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getBaseCustbalanceAmount());
return $this;
}
示例2: collect
/**
* Collect grand total address amount
*
* @param \Magento\Quote\Model\Quote\Address $address
* @return $this
*/
public function collect(\Magento\Quote\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;
}
示例3: collect
/**
* @param \Magento\Quote\Model\Quote\Address $address
* @return $this
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function collect(\Magento\Quote\Model\Quote\Address $address)
{
$quote = $address->getQuote();
$eventArgs = ['website_id' => $this->_storeManager->getStore($quote->getStoreId())->getWebsiteId(), 'customer_group_id' => $quote->getCustomerGroupId(), 'coupon_code' => $quote->getCouponCode()];
$address->setFreeShipping(0);
$totalDiscountAmount = 0;
$subtotalWithDiscount = 0;
$baseTotalDiscountAmount = 0;
$baseSubtotalWithDiscount = 0;
$items = $address->getAllItems();
if (!count($items)) {
$address->setDiscountAmount($totalDiscountAmount);
$address->setSubtotalWithDiscount($subtotalWithDiscount);
$address->setBaseDiscountAmount($baseTotalDiscountAmount);
$address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
return $this;
}
foreach ($items as $item) {
if ($item->getNoDiscount()) {
$item->setDiscountAmount(0);
$item->setBaseDiscountAmount(0);
$item->setRowTotalWithDiscount($item->getRowTotal());
$item->setBaseRowTotalWithDiscount($item->getRowTotal());
$subtotalWithDiscount += $item->getRowTotal();
$baseSubtotalWithDiscount += $item->getBaseRowTotal();
} else {
/**
* Child item discount we calculate for parent
*/
if ($item->getParentItemId()) {
continue;
}
/**
* Composite item discount calculation
*/
if ($item->getHasChildren() && $item->isChildrenCalculated()) {
foreach ($item->getChildren() as $child) {
$eventArgs['item'] = $child;
$this->_eventManager->dispatch('sales_quote_address_discount_item', $eventArgs);
/**
* Parent free shipping we apply to all children
*/
if ($item->getFreeShipping()) {
$child->setFreeShipping($item->getFreeShipping());
}
if (!$child->getDiscountAmount() && $item->getDiscountPercent()) {
$child->setDiscountAmount($child->getRowTotal() * $item->getDiscountPercent());
}
$totalDiscountAmount += $child->getDiscountAmount();
//*$item->getQty();
$baseTotalDiscountAmount += $child->getBaseDiscountAmount();
//*$item->getQty();
$child->setRowTotalWithDiscount($child->getRowTotal() - $child->getDiscountAmount());
$child->setBaseRowTotalWithDiscount($child->getBaseRowTotal() - $child->getBaseDiscountAmount());
$subtotalWithDiscount += $child->getRowTotalWithDiscount();
$baseSubtotalWithDiscount += $child->getBaseRowTotalWithDiscount();
}
} else {
$eventArgs['item'] = $item;
$this->_eventManager->dispatch('sales_quote_address_discount_item', $eventArgs);
$totalDiscountAmount += $item->getDiscountAmount();
$baseTotalDiscountAmount += $item->getBaseDiscountAmount();
$item->setRowTotalWithDiscount($item->getRowTotal() - $item->getDiscountAmount());
$item->setBaseRowTotalWithDiscount($item->getBaseRowTotal() - $item->getBaseDiscountAmount());
$subtotalWithDiscount += $item->getRowTotalWithDiscount();
$baseSubtotalWithDiscount += $item->getBaseRowTotalWithDiscount();
}
}
}
$address->setDiscountAmount($totalDiscountAmount);
$address->setSubtotalWithDiscount($subtotalWithDiscount);
$address->setBaseDiscountAmount($baseTotalDiscountAmount);
$address->setBaseSubtotalWithDiscount($baseSubtotalWithDiscount);
$address->setGrandTotal($address->getGrandTotal() - $address->getDiscountAmount());
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $address->getBaseDiscountAmount());
return $this;
}