当前位置: 首页>>代码示例>>PHP>>正文


PHP DataObject::getShippingAmount方法代码示例

本文整理汇总了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;
 }
开发者ID:AmrHassanien,项目名称:magento-prototype,代码行数:26,代码来源:Fee.php

示例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;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:43,代码来源:Tax.php

示例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, ' ');
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:AbstractOrder.php


注:本文中的Magento\Framework\DataObject::getShippingAmount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。