Exemplo n.º 1
0
 /**
  * Fetch customer balance
  *
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return $this
  */
 public function fetchTotals(\Magento\Quote\Model\Quote\Address $address)
 {
     $custbalance = $address->getCustbalanceAmount();
     if ($custbalance != 0) {
         $address->addTotal(['code' => 'custbalance', 'title' => __('Store Credit'), 'value' => -$custbalance]);
     }
     return $this;
 }
Exemplo n.º 2
0
 /**
  * Fetch totals
  *
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return $this
  */
 public function fetchTotals(\Magento\Quote\Model\Quote\Address $address)
 {
     $amount = $address->getTaxAmount();
     if ($amount != 0) {
         $address->addTotal(['code' => 'tax', 'title' => __('Tax'), 'value' => $amount]);
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Fetch totals
  *
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return $this
  */
 public function fetchTotals(\Magento\Quote\Model\Quote\Address $address)
 {
     $amount = $address->getShippingAmount();
     if ($amount != 0) {
         $title = __('Shipping & Handling');
         if ($address->getShippingDescription()) {
             $title .= sprintf(' (%s)', $address->getShippingDescription());
         }
         $address->addTotal(['code' => 'shipping', 'title' => $title, 'value' => $address->getShippingAmount()]);
     }
     return $this;
 }
Exemplo n.º 4
0
 /**
  * Fetch discount
  *
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return $this
  */
 public function fetchTotals(\Magento\Quote\Model\Quote\Address $address)
 {
     $amount = $address->getDiscountAmount();
     if ($amount != 0) {
         $title = __('Discount');
         $couponCode = $address->getQuote()->getCouponCode();
         if (strlen($couponCode)) {
             $title .= sprintf(' (%s)', $couponCode);
         }
         $address->addTotal(['code' => 'discount', 'title' => $title, 'value' => -$amount]);
     }
     return $this;
 }
Exemplo n.º 5
0
 /**
  * Add shipping totals information to address object
  *
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return $this
  */
 public function fetch(\Magento\Quote\Model\Quote\Address $address)
 {
     $amount = $address->getShippingAmount();
     $shippingDescription = $address->getShippingDescription();
     if ($amount != 0 || $shippingDescription) {
         $title = $shippingDescription ? __('Shipping & Handling (%1)', $shippingDescription) : __('Shipping & Handling');
         $address->addTotal(['code' => $this->getCode(), 'title' => $title, 'value' => $amount]);
     }
     return $this;
 }
Exemplo n.º 6
0
 /**
  * Add total
  *
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return $this
  */
 public function fetchTotals(\Magento\Quote\Model\Quote\Address $address)
 {
     $address->addTotal(['code' => 'subtotal', 'title' => __('Subtotal'), 'value' => $address->getSubtotal()]);
     return $this;
 }
Exemplo n.º 7
0
 /**
  * Assign subtotal amount and label to address object
  *
  * @param Address $address
  * @return $this
  */
 public function fetch(Address $address)
 {
     $address->addTotal(['code' => $this->getCode(), 'title' => __('Subtotal'), 'value' => $address->getSubtotal()]);
     return $this;
 }
Exemplo n.º 8
0
 /**
  * Fetch grand total
  *
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return $this
  */
 public function fetchTotals(\Magento\Quote\Model\Quote\Address $address)
 {
     $address->addTotal(['code' => 'grand_total', 'title' => __('Grand Total'), 'value' => $address->getGrandTotal(), 'area' => 'footer']);
     return $this;
 }
Exemplo n.º 9
0
 /**
  * Add discount total information to address
  *
  * @param Address $address
  * @return $this
  */
 public function fetch(Address $address)
 {
     $amount = $address->getDiscountAmount();
     if ($amount != 0) {
         $description = $address->getDiscountDescription();
         $title = __('Discount');
         if (strlen($description)) {
             $title = __('Discount (%1)', $description);
         }
         $address->addTotal(['code' => $this->getCode(), 'title' => $title, 'value' => $amount]);
     }
     return $this;
 }
Exemplo n.º 10
0
 /**
  * @param \Magento\Quote\Model\Quote\Address $address
  * @return $this
  */
 public function fetch(\Magento\Quote\Model\Quote\Address $address)
 {
     $applied = $address->getAppliedTaxes();
     $store = $address->getQuote()->getStore();
     $amount = $address->getTaxAmount();
     if ($amount != 0 || $this->_taxData->displayZeroTax($store)) {
         $address->addTotal(['code' => $this->getCode(), 'title' => __('Tax'), 'full_info' => $applied ? $applied : [], 'value' => $amount]);
     }
     return $this;
 }