Ejemplo n.º 1
0
 /**
  * @return $this
  */
 public function initTotals()
 {
     $parent = $this->getParentBlock();
     $this->_order = $parent->getOrder();
     $this->_source = $parent->getSource();
     // $store = $this->getStore();
     $fee = new \Magento\Framework\DataObject(['code' => 'fee', 'strong' => false, 'value' => $this->_source->getFee(), 'label' => $this->_dataHelper->getFeeLabel()]);
     $parent->addTotal($fee, 'fee');
     return $this;
 }
Ejemplo n.º 2
0
 /**
  *
  *
  * @return $this
  */
 public function initTotals()
 {
     $this->getParentBlock();
     $this->getOrder();
     $this->getSource();
     if (!$this->getSource()->getFee()) {
         return $this;
     }
     $total = new \Magento\Framework\DataObject(['code' => 'fee', 'value' => $this->getSource()->getFee(), 'label' => $this->_dataHelper->getFeeLabel()]);
     $this->getParentBlock()->addTotalBefore($total, 'grand_total');
     return $this;
 }
 /**
  * @return array
  */
 public function getConfig()
 {
     $customFeeConfig = [];
     $enabled = $this->dataHelper->isModuleEnabled();
     $minimumOrderAmount = $this->dataHelper->getMinimumOrderAmount();
     $customFeeConfig['fee_label'] = $this->dataHelper->getFeeLabel();
     $quote = $this->checkoutSession->getQuote();
     $subtotal = $quote->getSubtotal();
     $customFeeConfig['custom_fee_amount'] = $this->dataHelper->getCustomFee();
     $customFeeConfig['show_hide_customfee_block'] = $enabled && $minimumOrderAmount <= $subtotal && $quote->getFee() ? true : false;
     $customFeeConfig['show_hide_customfee_shipblock'] = $enabled && $minimumOrderAmount <= $subtotal ? true : false;
     return $customFeeConfig;
 }