public function initTotals() { $parent = $this->getParentBlock(); $paymentMethod = $parent->getOrder()->getPayment()->getMethodInstance()->getCode(); if (!in_array($paymentMethod, self::$_allowed_methods)) { return $this; } if ($parent->getOrder()->getBasePayexPaymentFeeTax()) { $total = new Varien_Object(); $total->setLabel(Mage::helper('payex')->__('Payment fee (Incl.Tax)')); $total->setValue($parent->getOrder()->getPayexPaymentFee() + $parent->getOrder()->getPayexPaymentFeeTax()); $total->setBaseValue($parent->getOrder()->getPayexBasePaymentFee() + $parent->getOrder()->getPayexBasePaymentFeeTax()); $total->setCode('payex_payment_fee_with_tax'); $parent->addTotalBefore($total, 'tax'); } if ($parent->getOrder()->getBasePayexPaymentFee()) { $total = new Varien_Object(); $total->setLabel(Mage::helper('payex')->__('Payment fee (Excl.Tax)')); $total->setValue($parent->getOrder()->getPayexPaymentFee()); $total->setBaseValue($parent->getOrder()->getPayexBasePaymentFee()); $total->setCode('payex_payment_fee'); $parent->addTotalBefore($total, 'payex_payment_fee_with_tax'); } return $this; }
/** * Initialize order totals array * * @return $this */ public function initTotals() { $parent = $this->getParentBlock(); $order = $this->getOrder(); $fee = $order->getBuckarooFee(); $baseFee = $order->getBaseBuckarooFee(); if ($fee < 0.01 || $baseFee < 0.01) { return $this; } $paymentMethod = $order->getPayment()->getMethod(); $displayMode = $this->getDisplayMode(); $baseLabel = Mage::helper('buckaroo3extended')->getBuckarooFeeLabel($order->getStoreId(), $paymentMethod); if ($displayMode === self::DISPLAY_MODE_EXCL || $displayMode === self::DISPLAY_MODE_BOTH) { $label = $baseLabel; if ($displayMode === self::DISPLAY_MODE_BOTH) { $label .= ' (' . $this->getTaxLabel(false) . ')'; } $total = new Varien_Object(); $total->setLabel($label)->setValue($fee)->setBaseValue($baseFee)->setCode('buckaroo_fee'); $parent->addTotalBefore($total, 'shipping'); } if ($displayMode === self::DISPLAY_MODE_INCL || $displayMode === self::DISPLAY_MODE_BOTH) { $label = $baseLabel; if ($displayMode === self::DISPLAY_MODE_BOTH) { $label .= ' (' . $this->getTaxLabel(true) . ')'; } $totalInclTax = new Varien_Object(); $totalInclTax->setLabel($label)->setValue($fee + $order->getBuckarooFeeTax())->setBaseValue($baseFee + $order->getBaseBuckarooFeeTax())->setCode('buckaroo_fee_incl_tax'); $parent->addTotalBefore($totalInclTax, 'shipping'); } return $this; }
public function initTotals() { $parent = $this->getParentBlock(); $this->_invoice = $parent->getInvoice(); if ($this->_invoice->getCodFee()) { $cod = new Varien_Object(); $cod->setLabel($this->__('Cash on Delivery fee')); $cod->setValue($this->_invoice->getCodFee()); $cod->setBaseValue($this->_invoice->getBaseCodFee()); $cod->setCode('cod_fee'); if (Mage::helper('cashondelivery')->displayCodBothPrices()) { $cod->setLabel($this->__('Cash on Delivery fee (Excl.Tax)')); $codIncl = new Varien_Object(); $codIncl->setLabel($this->__('Cash on Delivery fee (Incl.Tax)')); $codIncl->setValue($this->_invoice->getCodFee() + $this->_invoice->getCodTaxAmount()); $codIncl->setBaseValue($this->_invoice->getBaseCodFee() + $this->_invoice->getBaseCodTaxAmount()); $codIncl->setCode('cod_fee_incl'); $parent->addTotalBefore($cod, 'tax'); $parent->addTotalBefore($codIncl, 'tax'); } elseif (Mage::helper('cashondelivery')->displayCodFeeIncludingTax()) { $cod->setValue($this->_invoice->getCodFee() + $this->_invoice->getCodTaxAmount()); $cod->setBaseValue($this->_invoice->getBaseCodFee() + $this->_invoice->getBaseCodTaxAmount()); $parent->addTotalBefore($cod, 'tax'); } else { $parent->addTotalBefore($cod, 'tax'); } } return $this; }
protected function _initCounter() { $counter = new Varien_Object(); $counter->setLabel($this->_counterLabel); $counter->setCount(0); $this->_counter = $counter; }
/** * add a new feed * * @access public * @param string $label * @param string $url * @param bool $prepare * @return Stovpak_Article_Block_Rss * @author Ultimate Module Creator */ public function addFeed($label, $url, $prepare = false) { $link = $prepare ? $this->getUrl($url) : $url; $feed = new Varien_Object(); $feed->setLabel($label); $feed->setUrl($link); $this->_feeds[$link] = $feed; return $this; }
public function initTotals() { if ($this->giftwrapAmount() > 0) { $total = new Varien_Object(); $total->setCode('giftwrap'); $total->setValue($this->giftwrapAmount()); $total->setBaseValue(0); $total->setLabel('Gift wrap'); $parent = $this->getParentBlock(); $parent->addTotal($total, 'subtotal'); } }
public function addToBlock($block) { $order = $block->getOrder(); $label = Mage::getStoreConfig('payment/' . $order->getPayment()->getMethod() . '/surcharge_label'); $fee = new Varien_Object(); $fee->setCode('surcharge_incl'); $fee->setLabel($label); $fee->setBaseValue(10); $fee->setValue(11); $block->addTotalBefore($fee, 'shipping'); return $block; }
public function initTotals() { if ($this->discountAmount() != 0) { $total = new Varien_Object(); $total->setCode('webposdiscount'); $total->setValue(-$this->discountAmount()); $total->setBaseValue(0); $total->setLabel('Discount(Admin)'); $parent = $this->getParentBlock(); $parent->addTotal($total, 'subtotal'); } }
public function initTotals() { $parent = $this->getParentBlock(); if ($this->_invoice->getCodFee()) { $cod = new Varien_Object(); $cod->setLabel($this->__('Refund Cash on Delivery fee')); $cod->setValue($parent->getSource()->getCodFee()); $cod->setBaseValue($parent->getSource()->getBaseCodFee()); $cod->setCode('cod_fee'); $parent->addTotalBefore($cod, 'adjustment_positive'); } return $this; }
public function initTotals() { $amount = $this->getLuckydrawDiscount(); if (floatval($amount)) { $total = new Varien_Object(); $total->setCode('luckydraw_discount'); $total->setValue($amount); $total->setBaseValue($this->getBaseLuckydrawDiscount()); $total->setLabel('Lucky Draw Discount'); $parent = $this->getParentBlock(); $parent->addTotal($total, 'subtotal'); } }
public function initTotals() { $amount = $this->getAffiliateplusDiscount(); if (floatval($amount)) { $total = new Varien_Object(); $total->setCode('affiliateplus_discount'); $total->setValue($amount); $total->setBaseValue($this->getBaseAffiliateplusDiscount()); $total->setLabel('Affiliate Discount' . $this->getAffiliateCouponLabel()); $parent = $this->getParentBlock(); $parent->addTotal($total, 'subtotal'); } }
public function initTotals() { // var_dump($this->discountAmount()); if ($this->discountAmount() != 0) { $total = new Varien_Object(); $total->setCode('onestepcheckoutdiscount'); $total->setValue(-$this->discountAmount()); $total->setBaseValue(-$this->baseDiscountAmout()); $total->setLabel('Discount(Admin)'); $parent = $this->getParentBlock(); $parent->addTotal($total, 'subtotal'); } }
public function initTotals() { $parent = $this->getParentBlock(); if ($parent->getSource()) { $fee = new Varien_Object(); $fee->setLabel($this->__('Refund Payment fee')); $fee->setValue($parent->getSource()->getCapayableFee()); $fee->setBaseValue($parent->getSource()->getBaseCapayableFee()); $fee->setCode('payment_fee'); $fee->setBlockName('capayable_fee'); $parent->addTotalBefore($fee, 'adjustment_positive'); } return $this; }
/** * add fee to order detail view * * @return $this */ public function initTotals() { $parent = $this->getParentBlock(); $this->_order = $parent->getOrder(); if ($this->_order->getShopgatePaymentFee()) { $fee = new Varien_Object(); $fee->setLabel($this->__('Payment Fee')); $fee->setValue($this->_order->getShopgatePaymentFee()); $fee->setBaseValue($this->_order->getBaseShopgatePaymentFee()); $fee->setCode($this->getCode()); $parent->addTotalBefore($fee, 'tax'); } return $this; }
public function initTotals() { $parent = $this->getParentBlock(); if ($parent->getOrder()->getPayment()->getMethodInstance()->getCode() !== 'factoring') { return $this; } if ($parent->getOrder()->getBaseFactoringPaymentFee()) { $total = new Varien_Object(); $total->setLabel($this->__('Payment fee')); $total->setValue($parent->getOrder()->getFactoringPaymentFee()); $total->setBaseValue($parent->getOrder()->getFactoringBasePaymentFee()); $total->setCode('factoring_payment_fee'); $parent->addTotalBefore($total, 'tax'); } return $this; }
/** * Load data * * @param bool $printQuery * @param bool $logQuery * @return Mage_XmlConnect_Model_Resource_Filter_Collection */ public function load($printQuery = false, $logQuery = false) { if (empty($this->_items)) { $layer = Mage::getSingleton('catalog/layer'); foreach ($this->_filters as $filter) { if ('category_id' == $filter['field']) { $layer->setCurrentCategory((int) $filter['value']); } } if ($layer->getCurrentCategory()->getIsAnchor()) { foreach ($layer->getFilterableAttributes() as $attributeItem) { $filterModelName = 'catalog/layer_filter_attribute'; switch ($attributeItem->getAttributeCode()) { case 'price': $filterModelName = 'catalog/layer_filter_price'; break; case 'decimal': $filterModelName = 'catalog/layer_filter_decimal'; break; default: $filterModelName = 'catalog/layer_filter_attribute'; break; } $filterModel = Mage::getModel($filterModelName); $filterModel->setLayer($layer)->setAttributeModel($attributeItem); $filterValues = new Varien_Data_Collection(); foreach ($filterModel->getItems() as $valueItem) { $valueObject = new Varien_Object(); $valueObject->setLabel($valueItem->getLabel()); $valueObject->setValueString($valueItem->getValueString()); $valueObject->setProductsCount($valueItem->getCount()); $filterValues->addItem($valueObject); } $item = new Varien_Object(); $item->setCode($attributeItem->getAttributeCode()); $item->setName($filterModel->getName()); $item->setValues($filterValues); $this->addItem($item); } } } return $this; }
public function addToBlock($block) { $order = $block->getOrder(); $info = $order->getPayment()->getMethodInstance()->getInfoInstance(); $storeId = Mage::app()->getStore()->getId(); $vatOption = Mage::getStoreConfig("tax/sales_display/price", $storeId); $invoiceFee = $info->getAdditionalInformation('billmateinvoice_fee'); $invoiceTax = $info->getAdditionalInformation('billmateinvoice_fee_tax'); $origInvFee = Mage::getStoreConfig('payment/billmateinvoice/billmate_fee'); if ($invoiceTax != 0 && $invoiceFee == $origInvFee) { $invoiceFee += $invoiceTax; } $extra = ''; $fee = new Varien_Object(); $fee->setCode('billmateinvoice_fee'); $label = Mage::helper('billmateinvoice')->__('Billmate Invoice Fee (Incl. Vat)'); $fee->setLabel($label); $fee->setBaseValue($invoiceFee); $fee->setValue($invoiceFee); $block->addTotalBefore($fee, 'shipping'); return $block; }
public function initTotals() { // $parent = Mage_Adminhtml_Block_Sales_Order_Invoice_Totals // $this->_invoice = Mage_Sales_Model_Order_Invoice $parent = $this->getParentBlock(); $this->_invoice = $parent->getInvoice(); if (!$this->_invoice) { return $this; } $payment = $this->_invoice->getOrder()->getPayment(); $methodTitle = Mage::helper('capayable')->getMethodTitle($payment->getMethod()); if ($this->_invoice->getCapayableFee()) { $fee = new Varien_Object(); $fee->setLabel($this->__($methodTitle)); $fee->setValue($this->_invoice->getCapayableFee()); $fee->setBaseValue($this->_invoice->getBaseCapayableFee()); $fee->setCode('payment_fee'); if (Mage::helper('capayable')->displayBothPrices()) { $fee->setLabel($this->__('Payment fee (Excl.Tax)')); $feeIncl = new Varien_Object(); $feeIncl->setLabel($this->__('Payment fee (Incl.Tax)')); $feeIncl->setValue($this->_invoice->getCapayableFee() + $this->_invoice->getCapayableFeeTaxAmount()); $feeIncl->setBaseValue($this->_invoice->getBaseCapayableFee() + $this->_invoice->getBaseCapayableFeeTaxAmount()); $feeIncl->setCode('payment_fee_incl'); $parent->addTotalBefore($fee, 'tax'); $parent->addTotalBefore($feeIncl, 'tax'); } elseif (Mage::helper('capayable')->displayFeeIncludingTax()) { $fee->setValue($this->_invoice->getCapayableFee() + $this->_invoice->getCapayableFeeTaxAmount()); $fee->setBaseValue($this->_invoice->getBaseCapayableFee() + $this->_invoice->getBaseCapayableFeeTaxAmount()); $parent->addTotalBefore($fee, 'tax'); } else { $parent->addTotalBefore($fee, 'tax'); } } return $this; }
/** * Initialize order totals array * * @return $this */ public function initTotals() { /** * @var Mage_Adminhtml_Block_Sales_Order_Invoice_Totals $parent * @var Mage_Sales_Model_Order_Creditmemo $creditmemo */ $parent = $this->getParentBlock(); $creditmemo = $parent->getCreditmemo(); $fee = $creditmemo->getBuckarooFee(); $baseFee = $creditmemo->getBaseBuckarooFee(); if ($fee < 0.01 || $baseFee < 0.01) { return $this; } $paymentMethod = $creditmemo->getOrder()->getPayment()->getMethod(); $displayMode = $this->getDisplayMode(); $baseLabel = Mage::helper('buckaroo3extended')->getBuckarooFeeLabel($creditmemo->getStoreId(), $paymentMethod); if ($displayMode === self::DISPLAY_MODE_EXCL || $displayMode === self::DISPLAY_MODE_BOTH && $creditmemo->getId()) { $label = $baseLabel; if ($displayMode === self::DISPLAY_MODE_BOTH) { $label .= ' (' . $this->getTaxLabel(false) . ')'; } $total = new Varien_Object(); $total->setLabel($label)->setValue($fee)->setBaseValue($baseFee)->setCode('buckaroo_fee'); $parent->addTotal($total, 'subtotal_incl'); } if ($displayMode === self::DISPLAY_MODE_INCL || $displayMode === self::DISPLAY_MODE_BOTH && $creditmemo->getId()) { $label = $baseLabel; if ($displayMode === self::DISPLAY_MODE_BOTH) { $label .= ' (' . $this->getTaxLabel(true) . ')'; } $totalInclTax = new Varien_Object(); $totalInclTax->setLabel($label)->setValue($fee + $creditmemo->getBuckarooFeeTax())->setBaseValue($baseFee + $creditmemo->getBaseBuckarooFeeTax())->setCode('buckaroo_fee_incl_tax'); $parent->addTotal($totalInclTax, 'subtotal_incl'); } return $this; }
/** * Enter description here... * * @return array */ public function getMediaAttributes() { $attributeCollection = new Varien_Data_Collection(); $attribute1 = new Varien_Object(); $attribute1->setAttributeCode('attribute1'); $attribute1->setLabel('attribute1'); $attributeCollection->addItem($attribute1); $attribute2 = new Varien_Object(); $attribute2->setAttributeCode('attribute2'); $attribute2->setLabel('attribute2'); //$attributeCollection->addItem($attribute2); return $attributeCollection; //$this->getElement()->getDataObject()->getMediaAttributes(); }
public function addToBlock($block) { $order = $block->getOrder(); $info = $order->getPayment()->getMethodInstance()->getInfoInstance(); $storeId = Mage::app()->getStore()->getId(); $taxOption = Mage::getStoreConfig("tax/sales_display/shipping", $storeId); $country = $order->getShippingAddress()->getCountry(); //$lang = Mage::helper('klarnaPaymentModule/lang'); $label = Mage::getStoreConfig('payment/' . $order->getPayment()->getMethod() . '/payment_fee_label'); $paymentFee = $info->getAdditionalInformation('invoice_fee'); $basePaymentFee = $info->getAdditionalInformation('base_invoice_fee'); $paymentFeeExcludingVat = $info->getAdditionalInformation('invoice_fee_exluding_vat'); $basePaymentFeeExcludingVat = $info->getAdditionalInformation('base_invoice_fee_exluding_vat'); /** * 1 : Show exluding tax * 2 : Show including tax * 3 : Show both */ if ($taxOption === '1' || $taxOption === '3') { $label = Mage::getStoreConfig('payment/' . $order->getPayment()->getMethod() . '/payment_fee_label'); $fee = new Varien_Object(); $fee->setCode('invoice_fee_excl'); if ($taxOption == '3') { $label .= ' (Excl.Tax)'; } $fee->setLabel($label); $fee->setBaseValue($basePaymentFeeExcludingVat); $fee->setValue($paymentFeeExcludingVat); $block->addTotalBefore($fee, 'shipping'); } if ($taxOption === '2' || $taxOption === '3') { $label = Mage::getStoreConfig('payment/' . $order->getPayment()->getMethod() . '/payment_fee_label'); $fee = new Varien_Object(); $fee->setCode('invoice_fee_incl'); if ($taxOption == '3') { $label .= ' (Incl.Tax)'; } $fee->setLabel($label); $fee->setBaseValue($basePaymentFee); $fee->setValue($paymentFee); $block->addTotalBefore($fee, 'shipping'); } return $block; }
/** * Generate an Varien_Object which could be set as total to the parent block. * * @param $label string * @param $value string * @param $baseValue string * @param $code string * @return Varien_Object */ protected function _getTotalObject($label, $value, $baseValue, $code) { $total = new Varien_Object(); $total->setLabel($label)->setValue($value)->setBaseValue($baseValue)->setCode($code); return $total; }