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


PHP Mage_Sales_Model_Order_Invoice::getData方法代码示例

本文整理汇总了PHP中Mage_Sales_Model_Order_Invoice::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Invoice::getData方法的具体用法?PHP Mage_Sales_Model_Order_Invoice::getData怎么用?PHP Mage_Sales_Model_Order_Invoice::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Sales_Model_Order_Invoice的用法示例。


在下文中一共展示了Mage_Sales_Model_Order_Invoice::getData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getData

 public function getData($key = '', $index = null)
 {
     switch ($key) {
         case '0days':
             return $this->getCurrentTotal();
             break;
         case '30days':
             return $this->get30DayTotal();
             break;
         case '60days':
             return $this->get60DayTotal();
             break;
         case '90days':
             return $this->get90DayTotal();
             break;
         case '120days':
             return $this->get120DayTotal();
             break;
         case '180days':
             return $this->get180DayTotal();
             break;
         case '240days':
             return $this->get240DayTotal();
             break;
         default:
             return parent::getData($key, $index);
     }
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:28,代码来源:Invoice.php

示例2: collect

 public function collect(Mage_Sales_Model_Order_Invoice $invoice)
 {
     $order = $invoice->getOrder();
     if ($order->getCustomercreditDiscount() < 0.0001) {
         return;
     }
     if ($invoice->isLast()) {
         $baseDiscount = $order->getBaseCustomercreditDiscount();
         $discount = $order->getCustomercreditDiscount();
         foreach ($order->getInvoiceCollection() as $existedInvoice) {
             if ($baseDiscount > 0.0001) {
                 $baseDiscount -= $existedInvoice->getBaseCustomercreditDiscount();
                 $discount -= $existedInvoice->getCustomercreditDiscount();
             }
         }
     } else {
         $orderData = $order->getData();
         $invoiceData = $invoice->getData();
         if ($invoiceData['shipping_incl_tax']) {
             $ratio = ($invoiceData['subtotal_incl_tax'] + $invoiceData['shipping_incl_tax']) / ($orderData['subtotal_incl_tax'] + $orderData['shipping_incl_tax']);
         } else {
             $ratio = $invoiceData['subtotal_incl_tax'] / ($orderData['subtotal_incl_tax'] + $orderData['shipping_incl_tax']);
         }
         $baseDiscount = $order->getBaseCustomercreditDiscount() * $ratio;
         $discount = $order->getCustomercreditDiscount() * $ratio;
         $maxBaseDiscount = $order->getBaseCustomercreditDiscount();
         $maxDiscount = $order->getCustomercreditDiscount();
         foreach ($order->getInvoiceCollection() as $existedInvoice) {
             if ($maxBaseDiscount > 0.0001) {
                 $maxBaseDiscount -= $existedInvoice->getBaseCustomercreditDiscount();
                 $maxDiscount -= $existedInvoice->getCustomercreditDiscount();
             }
         }
         if ($baseDiscount > $maxBaseDiscount) {
             $baseDiscount = $maxBaseDiscount;
             $discount = $maxDiscount;
         }
     }
     if ($baseDiscount > 0.0001) {
         if ($invoice->getBaseGrandTotal() <= $baseDiscount) {
             $invoice->setBaseCustomercreditDiscount($invoice->getBaseGrandTotal());
             $invoice->setCustomercreditDiscount($invoice->getGrandTotal());
             $invoice->setBaseGrandTotal(0.0);
             $invoice->setGrandTotal(0.0);
         } else {
             $invoice->setBaseCustomercreditDiscount($baseDiscount);
             $invoice->setCustomercreditDiscount($discount);
             $invoice->setBaseGrandTotal($invoice->getBaseGrandTotal() - $baseDiscount);
             $invoice->setGrandTotal($invoice->getGrandTotal() - $discount);
         }
     }
 }
开发者ID:protechhelp,项目名称:gamamba,代码行数:52,代码来源:Discount.php

示例3: initInvoiceData

 /**
  * Init invoice data
  * @param Mage_Sales_Model_Order_Invoice $invoice
  * @return array
  */
 public function initInvoiceData($invoice)
 {
     $order = $invoice->getOrder();
     $orderCurrencyCode = $order->getOrderCurrencyCode();
     $baseCurrencyCode = $order->getBaseCurrencyCode();
     $this->setTranslationByStoreId($invoice->getStoreId());
     $invoiceData = $this->process($invoice->getData(), $orderCurrencyCode, $baseCurrencyCode);
     $orderData = Mage::getModel('pdfpro/order')->initOrderData($order);
     $invoiceData['order'] = unserialize($orderData);
     $invoiceData['customer'] = $this->getCustomerData(Mage::getModel('customer/customer')->load($order->getCustomerId()));
     $invoiceData['created_at_formated'] = $this->getFormatedDate($invoice->getCreatedAt());
     $invoiceData['updated_at_formated'] = $this->getFormatedDate($invoice->getUpdatedAt());
     $invoiceData['billing'] = $this->getAddressData($invoice->getBillingAddress());
     /*if order is not virtual */
     if (!$order->getIsVirtual()) {
         $invoiceData['shipping'] = $this->getAddressData($invoice->getShippingAddress());
     }
     /*Get Payment Info */
     Mage::getDesign()->setPackageName('default');
     /*Set package to default*/
     $paymentInfo = Mage::helper('payment')->getInfoBlock($order->getPayment())->setIsSecureMode(true)->setArea('adminhtml')->toPdf();
     $paymentInfo = str_replace('{{pdf_row_separator}}', "<br />", $paymentInfo);
     $invoiceData['payment'] = array('code' => $order->getPayment()->getMethodInstance()->getCode(), 'name' => $order->getPayment()->getMethodInstance()->getTitle(), 'info' => $paymentInfo);
     $invoiceData['payment_info'] = $paymentInfo;
     $invoiceData['shipping_description'] = $order->getShippingDescription();
     $invoiceData['totals'] = array();
     $invoiceData['items'] = array();
     /*
      * Get Items information
      */
     foreach ($invoice->getAllItems() as $item) {
         if ($item->getOrderItem()->getParentItem()) {
             continue;
         }
         $itemModel = $this->getItemModel($item);
         if ($item->getOrderItem()->getProductType() == 'bundle') {
             $itemData = array('is_bundle' => 1, 'name' => $item->getName(), 'sku' => $item->getSku());
             if ($itemModel->canShowPriceInfo($item)) {
                 $itemData['price'] = Mage::helper('pdfpro')->currency($item->getPrice(), $orderCurrencyCode);
                 $itemData['qty'] = $item->getQty() * 1;
                 $itemData['tax'] = Mage::helper('pdfpro')->currency($item->getTaxAmount(), $orderCurrencyCode);
                 $itemData['subtotal'] = Mage::helper('pdfpro')->currency($item->getRowTotal(), $orderCurrencyCode);
                 $itemData['row_total'] = Mage::helper('pdfpro')->currency($item->getRowTotalInclTax(), $orderCurrencyCode);
             }
             $itemData['sub_items'] = array();
             $items = $itemModel->getChilds($item);
             foreach ($items as $_item) {
                 $bundleItem = array();
                 $attributes = $itemModel->getSelectionAttributes($_item);
                 // draw SKUs
                 if (!$_item->getOrderItem()->getParentItem()) {
                     continue;
                 }
                 $bundleItem['label'] = $attributes['option_label'];
                 /*Product name */
                 if ($_item->getOrderItem()->getParentItem()) {
                     $name = $itemModel->getValueHtml($_item);
                 } else {
                     $name = $_item->getName();
                 }
                 $bundleItem['value'] = $name;
                 /*$bundleItem['sku']		= $_item->getSku();*/
                 /* price */
                 if ($itemModel->canShowPriceInfo($_item)) {
                     $price = $order->formatPriceTxt($_item->getPrice());
                     $bundleItem['price'] = Mage::helper('pdfpro')->currency($_item->getPrice(), $orderCurrencyCode);
                     $bundleItem['qty'] = $_item->getQty() * 1;
                     $bundleItem['tax'] = Mage::helper('pdfpro')->currency($_item->getTaxAmount(), $orderCurrencyCode);
                     $bundleItem['subtotal'] = Mage::helper('pdfpro')->currency($_item->getRowTotal(), $orderCurrencyCode);
                     $bundleItem['row_total'] = Mage::helper('pdfpro')->currency($_item->getRowTotalInclTax(), $orderCurrencyCode);
                 }
                 $bundleItem = new Varien_Object($bundleItem);
                 Mage::dispatchEvent('ves_pdfpro_data_prepare_after', array('source' => $bundleItem, 'model' => $_item, 'type' => 'item'));
                 $itemData['sub_items'][] = $bundleItem;
             }
         } else {
             $itemData = array('name' => $item->getName(), 'sku' => $item->getSku(), 'price' => Mage::helper('pdfpro')->currency($item->getPrice(), $orderCurrencyCode), 'qty' => $item->getQty() * 1, 'tax' => Mage::helper('pdfpro')->currency($item->getTaxAmount(), $orderCurrencyCode), 'subtotal' => Mage::helper('pdfpro')->currency($item->getRowTotal(), $orderCurrencyCode), 'row_total' => Mage::helper('pdfpro')->currency($item->getRowTotalInclTax(), $orderCurrencyCode));
             $options = $itemModel->getItemOptions($item);
             $itemData['options'] = array();
             if ($options) {
                 foreach ($options as $option) {
                     $optionData = array();
                     $optionData['label'] = strip_tags($option['label']);
                     if ($option['value']) {
                         $printValue = isset($option['print_value']) ? $option['print_value'] : strip_tags($option['value']);
                         $optionData['value'] = $printValue;
                     }
                     $itemData['options'][] = new Varien_Object($optionData);
                 }
             }
         }
         $itemData = new Varien_Object($itemData);
         Mage::dispatchEvent('ves_pdfpro_data_prepare_after', array('source' => $itemData, 'model' => $item, 'type' => 'item'));
         $invoiceData['items'][] = $itemData;
     }
//.........这里部分代码省略.........
开发者ID:uibar,项目名称:peggysgift,代码行数:101,代码来源:Invoice.php


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