本文整理匯總了PHP中Magento\Framework\DataObject::getShippingAmount方法的典型用法代碼示例。如果您正苦於以下問題:PHP DataObject::getShippingAmount方法的具體用法?PHP DataObject::getShippingAmount怎麽用?PHP DataObject::getShippingAmount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\DataObject
的用法示例。
在下文中一共展示了DataObject::getShippingAmount方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: initTotals
/**
* Initialize all order totals relates with tax
*
* @return \Magento\Tax\Block\Sales\Order\Tax
*/
public function initTotals()
{
$parent = $this->getParentBlock();
$this->_order = $parent->getOrder();
$this->_source = $parent->getSource();
// $store = $this->getStore();
/*
Calculates the shoppree discount dynamically
by substracting grandtotal from the Total amount.
Also adds a row in the order view page in my orders page.
*/
$sdcnt = 0;
$totalAmnt = $this->_source->getSubTotal() + $this->_source->getShippingAmount();
$grandTotal = $this->_source->getGrandTotal();
if ($totalAmnt >= $grandTotal) {
$sdcnt = $totalAmnt - $grandTotal;
}
$fee = new \Magento\Framework\DataObject(['code' => 'fee', 'strong' => false, 'value' => $sdcnt, 'label' => __('Shoppree Discount [-]')]);
$parent->addTotal($fee, 'fee');
return $this;
}
示例2: _initShipping
/**
* @return $this
*/
protected function _initShipping()
{
$store = $this->getStore();
$parent = $this->getParentBlock();
$shipping = $parent->getTotal('shipping');
if (!$shipping) {
return $this;
}
if ($this->_config->displaySalesShippingBoth($store)) {
$shipping = (double) $this->_source->getShippingAmount();
$baseShipping = (double) $this->_source->getBaseShippingAmount();
$shippingIncl = (double) $this->_source->getShippingInclTax();
if (!$shippingIncl) {
$shippingIncl = $shipping + (double) $this->_source->getShippingTaxAmount();
}
$baseShippingIncl = (double) $this->_source->getBaseShippingInclTax();
if (!$baseShippingIncl) {
$baseShippingIncl = $baseShipping + (double) $this->_source->getBaseShippingTaxAmount();
}
$totalExcl = new \Magento\Framework\DataObject(['code' => 'shipping', 'value' => $shipping, 'base_value' => $baseShipping, 'label' => __('Shipping & Handling (Excl.Tax)')]);
$totalIncl = new \Magento\Framework\DataObject(['code' => 'shipping_incl', 'value' => $shippingIncl, 'base_value' => $baseShippingIncl, 'label' => __('Shipping & Handling (Incl.Tax)')]);
$parent->addTotal($totalExcl, 'shipping');
$parent->addTotal($totalIncl, 'shipping');
} elseif ($this->_config->displaySalesShippingInclTax($store)) {
$shippingIncl = $this->_source->getShippingInclTax();
if (!$shippingIncl) {
$shippingIncl = $this->_source->getShippingAmount() + $this->_source->getShippingTaxAmount();
}
$baseShippingIncl = $this->_source->getBaseShippingInclTax();
if (!$baseShippingIncl) {
$baseShippingIncl = $this->_source->getBaseShippingAmount() + $this->_source->getBaseShippingTaxAmount();
}
$total = $parent->getTotal('shipping');
if ($total) {
$total->setValue($shippingIncl);
$total->setBaseValue($baseShippingIncl);
}
}
return $this;
}
示例3: displayShippingPriceInclTax
/**
* Retrieve subtotal price include tax html formated content
*
* @param \Magento\Framework\DataObject $order
* @return string
*/
public function displayShippingPriceInclTax($order)
{
$shipping = $order->getShippingInclTax();
if ($shipping) {
$baseShipping = $order->getBaseShippingInclTax();
} else {
$shipping = $order->getShippingAmount() + $order->getShippingTaxAmount();
$baseShipping = $order->getBaseShippingAmount() + $order->getBaseShippingTaxAmount();
}
return $this->displayPrices($baseShipping, $shipping, false, ' ');
}