Esempio n. 1
0
 public function testToHtmlChildrenInitialized()
 {
     $block = new Mage_Sales_Block_Order_Totals();
     $block->setOrder(new Mage_Sales_Model_Order())->setTemplate('order/totals.phtml');
     $layout = new Mage_Core_Model_Layout();
     $layout->addBlock($block, 'block');
     $child1 = $this->getMock('Mage_Core_Block_Text', array('initTotals'));
     $child1->expects($this->once())->method('initTotals');
     $layout->addBlock($child1, 'child1', 'block');
     $layout->addBlock('Mage_Core_Block_Text', 'child2', 'block');
     $child3 = $this->getMock('Mage_Core_Block_Text', array('initTotals'));
     $child3->expects($this->once())->method('initTotals');
     $layout->addBlock($child3, 'child3', 'block');
     $block->toHtml();
 }
Esempio n. 2
0
 protected function _beforeToHtml()
 {
     if (!Mage::helper('magenotification')->checkLicenseKey('onestepcheckout')) {
         $this->setTemplate(null);
     }
     return parent::_beforeToHtml();
 }
Esempio n. 3
0
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $source = $this->getSource();
     /**
      * Add store rewards
      */
     $totals = $this->_totals;
     $newTotals = array();
     if (count($totals) > 0) {
         foreach ($totals as $index => $arr) {
             if ($index == "grand_total") {
                 /*if (((float)$this->getSource()->getPaymentCharge()) != 0) {
                 			$label = $this->__('Payment Charge');
                       $newTotals['payment_charge'] = new Varien_Object(array(
                           'code'  => 'payment_charge',
                           'field' => 'payment_charge',
                           'value' => $source->getPaymentCharge(),
                           'label' => $label
                       ));
                 		}*/
             }
             $newTotals[$index] = $arr;
         }
         $this->_totals = $newTotals;
     }
     return $this;
 }
Esempio n. 4
0
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $this->removeTotal('base_grandtotal');
     if ((double) $this->getSource()->getAdjustmentPositive()) {
         $total = new Varien_Object(array('code' => 'adjustment_positive', 'value' => $this->getSource()->getAdjustmentPositive(), 'label' => $this->__('Adjustment Refund')));
         $this->addTotal($total);
     }
     if ((double) $this->getSource()->getAdjustmentNegative()) {
         $total = new Varien_Object(array('code' => 'adjustment_negative', 'value' => $this->getSource()->getAdjustmentNegative(), 'label' => $this->__('Adjustment Fee')));
         $this->addTotal($total);
     }
     /**
             <?php if ($this->getCanDisplayTotalPaid()): ?>
             <tr>
        <td colspan="6" class="a-right"><strong><?php echo $this->__('Total Paid') ?></strong></td>
        <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalPaid()) ?></strong></td>
             </tr>
             <?php endif; ?>
             <?php if ($this->getCanDisplayTotalRefunded()): ?>
             <tr>
        <td colspan="6" class="a-right"><strong><?php echo $this->__('Total Refunded') ?></strong></td>
        <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalRefunded()) ?></strong></td>
             </tr>
             <?php endif; ?>
             <?php if ($this->getCanDisplayTotalDue()): ?>
             <tr>
        <td colspan="6" class="a-right"><strong><?php echo $this->__('Total Due') ?></strong></td>
        <td class="last a-right"><strong><?php echo $_order->formatPrice($_creditmemo->getTotalDue()) ?></strong></td>
             </tr>
             <?php endif; ?>
     */
     return $this;
 }
Esempio n. 5
0
 protected function _initTotals()
 {
     parent::_initTotals();
     $initAmount = $this->getOrder()->getSubscriptionInitAmount();
     if ($initAmount != 0) {
         $this->addTotal(new Varien_Object(array('code' => 'subscription_init_amount', 'value' => $initAmount, 'base_value' => $initAmount, 'label' => $initAmount > 0 ? Mage::helper('customweb_subscription')->__('Initial Subscription Fee') : Mage::helper('customweb_subscription')->__('Initial Subscription Discount'))), $initAmount > 0 ? 'fee' : 'discount');
     }
     return $this;
 }
Esempio n. 6
0
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $source = $this->getSource();
     if ($this->getSource()->getInterest() > 0) {
         $this->addTotalBefore(new Varien_Object(array('code' => 'interest', 'field' => 'interest', 'value' => $this->getSource()->getInterest(), 'label' => $this->__('Interest'))), 'grand_total');
     }
     return $this;
 }
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $amount = number_format($this->getOrder()->getGiftcardDiscount(), 2);
     $gcCode = $this->getOrder()->getGiftcardCode();
     if ($amount > 0) {
         $this->addTotalBefore(new Varien_Object(array('code' => $this->getCode(), 'value' => -$amount, 'base_value' => -$amount, 'label' => 'Gift Card (' . $gcCode . ')')), 'grand_total');
     }
     return $this;
 }
Esempio n. 8
0
 protected function _initTotals()
 {
     parent::_initTotals();
     if (Mage::getStoreConfig('vc_giftwrap/general/enable')) {
         $price = Mage::helper('vc_giftwrap')->getAmountByOrderId($this->getOrder()->getId());
         $giftwrap = new Varien_Object(array('code' => 'giftcard', 'value' => $price, 'base_value' => $price, 'label' => $this->helper('vc_giftwrap')->__('Gift Wrap')));
         $this->addTotalBefore($giftwrap, 'grand_total');
     }
     return $this;
 }
Esempio n. 9
0
 protected function _initTotals()
 {
     parent::_initTotals();
     if (Mage::helper('customfee')->canApply()) {
         $subtotal = $this->getSource()->getSubtotal();
         $amount = $this->getFeeAmount($subtotal);
         $this->addTotalBefore(new Varien_Object(array('code' => 'customfee', 'value' => $amount, 'base_value' => $amount, 'label' => $this->getLabel()), array('shipping', 'tax')));
     }
     return $this;
 }
 protected function _initTotals()
 {
     parent::_initTotals();
     $current_order_id = $this->getRequest()->getParam('order_id');
     $discount = Mage::getModel('storecredit/storecredit')->getOrderDiscount($current_order_id);
     if ($discount > 0) {
         $this->addTotal(new Varien_Object(array('code' => 'StoreCredit', 'value' => -$discount, 'label' => 'Store Credit Discount')), 'discount');
     }
     return $this;
 }
Esempio n. 11
0
 protected function _initTotals()
 {
     parent::_initTotals();
     $amt = $this->getSource()->getFeeAmount();
     $baseAmt = $this->getSource()->getBaseFeeAmount();
     if ($amt != 0) {
         $this->addTotal(new Varien_Object(array('code' => 'codpayment', 'value' => $amt, 'base_value' => $baseAmt, 'label' => 'Cash On Delivery Charges')), 'fee_amount');
     }
     return $this;
 }
Esempio n. 12
0
 protected function _initTotals()
 {
     parent::_initTotals();
     if ((double) $this->getSource()->getPaymentFeeAmount() != 0) {
         $this->addTotal(new Varien_Object(array('code' => 'payment_fee', 'strong' => false, 'value' => $this->getSource()->getPaymentFeeAmount(), 'base_value' => $this->getSource()->getBasePaymentFeeAmount(), 'label' => $this->helper('adyen')->__('Payment Fee'), 'area' => '')), 'subtotal');
     }
     if ((double) $this->getSource()->getPaymentInstallmentFeeAmount() != 0) {
         $this->addTotal(new Varien_Object(array('code' => 'payment_installment_fee', 'strong' => false, 'value' => $this->getSource()->getPaymentInstallmentFeeAmount(), 'base_value' => $this->getSource()->getBasePaymentInstallmentFeeAmount(), 'label' => $this->helper('adyen')->__('Payment Fee Installments'), 'area' => '')), 'subtotal');
     }
     return $this;
 }
Esempio n. 13
0
 protected function _initTotals()
 {
     parent::_initTotals();
     if ((double) $this->getOrder()->getBaseCreditpointAmount()) {
         $source = $this->getSource();
         $creditPoints = number_format(Mage::getModel('creditpoint/creditpoint')->load($source->getEntityId(), 'order_id')->getAppliedCreditPoint());
         $value = '-' . $source->getCreditpointAmount();
         $this->addTotalBefore(new Varien_Object(array('code' => Mage::helper('creditpoint')->getCode(), 'strong' => false, 'label' => Mage::helper('creditpoint')->getCreditPointLabel($creditPoints), 'value' => $source instanceof Mage_Sales_Model_Order_Creditmemo ? -$value : $value)));
     }
     return $this;
 }
Esempio n. 14
0
 protected function _initTotals()
 {
     parent::_initTotals();
     $order = $this->getSource();
     $code = $this->getOrder()->getPayment()->getMethod();
     $amount = $order->getServicecostPdf();
     $method = $order->getPayment()->getMethodInstance();
     if ($amount) {
         $this->addTotalBefore(new Varien_Object(array('code' => 'servicecost', 'value' => $amount, 'base_value' => $amount, 'label' => Mage::helper('msp')->getFeeLabel($code)), array('tax')));
     }
     return $this;
 }
Esempio n. 15
0
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $source = $this->getSource();
     if ($this->getSource()->getJuros() > 0) {
         $this->addTotalBefore(new Varien_Object(array('code' => 'juros', 'field' => 'juros', 'value' => $this->getSource()->getJuros(), 'label' => Mage::getStoreConfig('payment/apelidocielo/texto_juros'))), 'grand_total');
     }
     if ($this->getSource()->getDesconto() < 0) {
         $this->addTotalBefore(new Varien_Object(array('code' => 'desconto', 'field' => 'desconto', 'value' => $this->getSource()->getDesconto(), 'label' => Mage::getStoreConfig('payment/apelidocielo/texto_desconto_a_vista'))), 'grand_total');
     }
     return $this;
 }
Esempio n. 16
0
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 public function _initTotals()
 {
     parent::_initTotals();
     $payment = $this->getOrder()->getPayment();
     if (substr($payment->getMethod(), 0, 5) != "sisow") {
         return $this;
     }
     $info = $payment->getMethodInstance()->getInfoInstance();
     if (!$info->getAdditionalInformation("invoice_fee")) {
         return $this;
     }
     return Mage::helper('sisow/paymentfee')->addToBlock($this);
 }
Esempio n. 17
0
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $order = $this->getOrder();
     $payment = $order->getPayment();
     $paymentMethodCode = $payment->getMethodInstance()->getCode();
     if (Mage::helper('base')->isIdeasaPaymentMethod($paymentMethodCode)) {
         $amount = Mage::getModel($paymentMethodCode . '/discount')->getIdeasaDiscount($order);
         if (abs($amount) > 0) {
             $baseAmount = Mage::getModel($paymentMethodCode . '/discount')->getIdeasaBaseDiscount($order);
             $code = Mage::getModel($paymentMethodCode . '/discount')->getIdeasaDiscountCode();
             $this->addTotal(new Varien_Object(array('code' => $code, 'value' => $amount, 'base_value' => $baseAmount, 'label' => Mage::helper($paymentMethodCode)->__('Payment Discount'))));
         }
     }
     return $this;
 }
Esempio n. 18
0
 protected function _initTotals()
 {
     parent::_initTotals();
     $add_giftwrap = false;
     $items = $this->getSource()->getAllItems();
     foreach ($items as $item) {
         if ($item->getData('gomage_gift_wrap')) {
             $add_giftwrap = true;
             break;
         }
     }
     if ($add_giftwrap) {
         $gift_wrap_totals = new Varien_Object(array('code' => 'gomage_gift_wrap', 'value' => $this->getSource()->getGomageGiftWrapAmount(), 'base_value' => $this->getSource()->getBaseGomageGiftWrapAmount(), 'label' => Mage::helper('gomage_checkout')->getConfigData('gift_wrapping/title')));
         $this->addTotalBefore($gift_wrap_totals, 'grand_total');
     }
     return $this;
 }
Esempio n. 19
0
 protected function _initTotals()
 {
     parent::_initTotals();
     $affiliate_credit = Mage::getModel('credit/creditorder')->load($this->getOrder()->getIncrementId());
     $affiliate = $affiliate_credit->getAffiliate();
     $credit = $affiliate_credit->getCredit();
     $baseCurrencyCode = Mage::getModel('sales/order')->loadByIncrementId($this->getOrder()->getIncrementId())->getData('base_currency_code');
     $currentCurrencyCode = Mage::getModel('sales/order')->loadByIncrementId($this->getOrder()->getIncrementId())->getData('order_currency_code');
     $affiliate_show = Mage::helper('directory')->currencyConvert($affiliate, $baseCurrencyCode, $currentCurrencyCode);
     $credit_show = Mage::helper('directory')->currencyConvert($credit, $baseCurrencyCode, $currentCurrencyCode);
     if ($affiliate > 0) {
         //$this->_totals['affiliate_discount'] = new Varien_Object(array(
         $total = new Varien_Object(array('code' => 'affiliate_discount', 'value' => -$affiliate_show, 'base_value' => -$affiliate, 'label' => Mage::helper('affiliate')->__('Affiliate Discount')));
         $this->addTotal($total);
     }
     if ($credit > 0) {
         //$this->_totals['credit_discount'] = new Varien_Object(array(
         $total = new Varien_Object(array('code' => 'credit_discount', 'value' => -$credit_show, 'base_value' => -$credit, 'label' => Mage::helper('credit')->__('Credit Discount')));
         $this->addTotal($total);
     }
     return $this;
 }
Esempio n. 20
0
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $source = $this->getSource();
     /**
      * Add store rewards
      */
     $totals = $this->_totals;
     $newTotals = array();
     if (count($totals) > 0) {
         foreach ($totals as $index => $arr) {
             if ($index == "grand_total") {
                 if ((double) $this->getSource()->getPaymentCharge() != 0) {
                     $label = Mage::getStoreConfig('pay_payment/general/text_payment_charge', Mage::app()->getStore());
                     $newTotals['payment_charge'] = new Varien_Object(array('code' => 'payment_charge', 'field' => 'payment_charge', 'value' => $source->getPaymentCharge(), 'label' => $label));
                 }
             }
             $newTotals[$index] = $arr;
         }
         $this->_totals = $newTotals;
     }
     return $this;
 }
Esempio n. 21
0
 /**
  * Initialize order totals array
  *
  * @return Mage_Sales_Block_Order_Totals
  */
 protected function _initTotals()
 {
     parent::_initTotals();
     $this->removeTotal('base_grandtotal');
     return $this;
 }
Esempio n. 22
0
 protected function _initTotals()
 {
     parent::_initTotals();
 }