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


PHP Mage_Sales_Model_Order::getSubtotal方法代码示例

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


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

示例1: logSale

 /**
  * Send order to MailChimp
  *
  * @param Mage_Sales_Model_Order $order
  * @return bool|array
  */
 public function logSale($order)
 {
     $this->_order = $order;
     $api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
     if (!$api) {
         return false;
     }
     $subtotal = $this->_order->getSubtotal();
     $discount = (double) $this->_order->getDiscountAmount();
     if ($discount != 0) {
         $subtotal = $subtotal + $discount;
     }
     $this->_info = array('id' => $this->_order->getIncrementId(), 'total' => $subtotal, 'shipping' => $this->_order->getShippingAmount(), 'tax' => $this->_order->getTaxAmount(), 'store_id' => $this->_order->getStoreId(), 'store_name' => $this->_order->getStoreName(), 'plugin_id' => 1215, 'items' => array());
     $emailCookie = $this->_getEmailCookie();
     $campaignCookie = $this->_getCampaignCookie();
     $this->setItemstoSend();
     if ($emailCookie && $campaignCookie) {
         $this->_info['email_id'] = $emailCookie;
         $this->_info['campaign_id'] = $campaignCookie;
         //Send order to MailChimp
         $rs = $api->campaignEcommOrderAdd($this->_info);
     } else {
         $this->_info['email'] = $this->_order->getCustomerEmail();
         $rs = $api->ecommOrderAdd($this->_info);
     }
     if ($rs === TRUE) {
         $this->_logCall();
         return true;
     } else {
         return $rs;
     }
 }
开发者ID:shashankkanungo,项目名称:magento,代码行数:38,代码来源:Ecommerce360.php

示例2: _prepareOrderData

 /**
  * @return array
  */
 protected function _prepareOrderData()
 {
     // magento 1.5 compat
     $shipping_method_c = $this->_order->getShippingMethod(true);
     $shipping_method = $this->_order->getData('shipping_method');
     $shipping_method_code = $shipping_method_c ? $shipping_method_c->getData('carrier_code') : $shipping_method;
     $data = array_filter(array('currency_code' => $this->_order->getOrderCurrencyCode(), 'shipping_method_code' => $shipping_method_code, 'shipping_method_title' => $this->_order->getShippingDescription(), 'created_on' => $this->_order->getCreatedAt(), 'updated_on' => $this->_order->getUpdatedAt(), 'state' => $this->_order->getState(), 'status' => $this->_order->getStatus(), 'is_gift' => $this->_order->getGiftMessageId() != null, 'ref_quote_id' => $this->_order->getQuoteId(), 'order_subtotal_with_tax' => $this->_order->getSubtotalInclTax(), 'order_subtotal' => $this->_order->getSubtotal(), 'order_tax' => $this->_order->getTaxAmount(), 'order_hidden_tax' => $this->_order->getHiddenTaxAmount(), 'order_shipping_with_tax' => $this->_order->getShippingInclTax(), 'order_shipping' => $this->_order->getShippingAmount(), 'order_discount' => $this->_order->getDiscountAmount(), 'order_shipping_discount' => $this->_order->getShippingDiscountAmount(), 'order_total' => $this->_order->getGrandTotal(), 'order_total_items' => $this->_order->getTotalItemCount()));
     return $data;
 }
开发者ID:payin7-payments,项目名称:payin7-magento,代码行数:12,代码来源:Submit.php

示例3: _render

 /**
  * (re)Render all items and totals
  */
 protected function _render()
 {
     if (!$this->_shouldRender) {
         return;
     }
     // regular items from the sales entity
     $this->_items = array();
     foreach ($this->_salesEntity->getAllItems() as $item) {
         if (!$item->getParentItem()) {
             $this->_addRegularItem($item);
         }
     }
     end($this->_items);
     $lastRegularItemKey = key($this->_items);
     // regular totals
     $shippingDescription = '';
     if ($this->_salesEntity instanceof Mage_Sales_Model_Order) {
         $shippingDescription = $this->_salesEntity->getShippingDescription();
         $this->_totals = array(self::TOTAL_SUBTOTAL => $this->_salesEntity->getSubtotal(), self::TOTAL_TAX => $this->_salesEntity->getTaxAmount(), self::TOTAL_SHIPPING => $this->_salesEntity->getShippingAmount(), self::TOTAL_DISCOUNT => abs($this->_salesEntity->getDiscountAmount()));
         $this->_applyHiddenTaxWorkaround($this->_salesEntity);
     } else {
         $address = $this->_salesEntity->getIsVirtual() ? $this->_salesEntity->getBillingAddress() : $this->_salesEntity->getShippingAddress();
         $shippingDescription = $address->getShippingDescription();
         $this->_totals = array(self::TOTAL_SUBTOTAL => $this->_salesEntity->getSubtotal(), self::TOTAL_TAX => $address->getTaxAmount(), self::TOTAL_SHIPPING => $address->getShippingAmount(), self::TOTAL_DISCOUNT => abs($address->getDiscountAmount()));
         $this->_applyHiddenTaxWorkaround($address);
     }
     $originalDiscount = $this->_totals[self::TOTAL_DISCOUNT];
     // arbitrary items, total modifications
     Mage::dispatchEvent('paypal_prepare_line_items', array('paypal_cart' => $this));
     // distinguish original discount among the others
     if ($originalDiscount > 0.0001 && isset($this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT])) {
         $this->_totalLineItemDescriptions[self::TOTAL_DISCOUNT][] = Mage::helper('sales')->__('Discount (%s)', Mage::app()->getStore()->convertPrice($originalDiscount, true, false));
     }
     // discount, shipping as items
     if ($this->_isDiscountAsItem && $this->_totals[self::TOTAL_DISCOUNT]) {
         $this->addItem(Mage::helper('paypal')->__('Discount'), 1, -1.0 * $this->_totals[self::TOTAL_DISCOUNT], $this->_renderTotalLineItemDescriptions(self::TOTAL_DISCOUNT));
     }
     $shippingItemId = $this->_renderTotalLineItemDescriptions(self::TOTAL_SHIPPING, $shippingDescription);
     if ($this->_isShippingAsItem && (double) $this->_totals[self::TOTAL_SHIPPING]) {
         $this->addItem(Mage::helper('paypal')->__('Shipping'), 1, (double) $this->_totals[self::TOTAL_SHIPPING], $shippingItemId);
     }
     $this->_validate();
     // if cart items are invalid, prepare cart for transfer without line items
     if (!$this->_areItemsValid) {
         $this->removeItem($shippingItemId);
     }
     // compound non-regular items into subtotal
     foreach ($this->_items as $key => $item) {
         if ($key > $lastRegularItemKey && $item->getAmount() != 0) {
             $this->_totals[self::TOTAL_SUBTOTAL] += $item->getAmount();
         }
     }
     $this->_shouldRender = false;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:57,代码来源:Cart.php

示例4: autoExportJobs

 /** Send order to MailChimp Automatically by Order Status
  *
  *
  */
 public function autoExportJobs()
 {
     $allow_sent = false;
     $orderIds[] = '0';
     $ecommerceOrders = Mage::getModel('monkey/ecommerce')->getCollection()->getData();
     if ($ecommerceOrders) {
         foreach ($ecommerceOrders as $ecommerceOrder) {
             $orderIds[] = $ecommerceOrder['order_id'];
         }
     }
     $orders = Mage::getResourceModel('sales/order_collection');
     //Get ALL orders which has not been sent to MailChimp
     $orders->getSelect()->where('main_table.entity_id NOT IN(?)', $orderIds);
     //Get status options selected in the Configuration
     $states = explode(',', Mage::helper('monkey')->config('order_status'));
     foreach ($orders as $order) {
         foreach ($states as $state) {
             if ($order->getStatus() == $state || $state == 'all_status') {
                 $allow_sent = true;
             }
         }
         if ($allow_sent == true) {
             $this->_order = $order;
             $api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
             if (!$api) {
                 return false;
             }
             $subtotal = $this->_order->getSubtotal();
             $discount = (double) $this->_order->getDiscountAmount();
             if ($discount != 0) {
                 $subtotal = $subtotal + $discount;
             }
             $this->_info = array('id' => $this->_order->getIncrementId(), 'total' => $subtotal, 'shipping' => $this->_order->getShippingAmount(), 'tax' => $this->_order->getTaxAmount(), 'store_id' => $this->_order->getStoreId(), 'store_name' => $this->_order->getStoreName(), 'plugin_id' => 1215, 'items' => array());
             $email = $this->_order->getCustomerEmail();
             $campaign = $this->_order->getEbizmartsMagemonkeyCampaignId();
             $this->setItemstoSend();
             if ($email && $campaign) {
                 $this->_info['email_id'] = $email;
                 $this->_info['campaign_id'] = $campaign;
                 //Send order to MailChimp
                 $rs = $api->campaignEcommOrderAdd($this->_info);
             } else {
                 $this->_info['email'] = $email;
                 $rs = $api->ecommOrderAdd($this->_info);
             }
             $allow_sent = false;
             if ($rs === TRUE) {
                 $this->_logCall();
             }
         }
     }
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:56,代码来源:Ecommerce360.php

示例5: toQuoteShippingAddress

 /**
  * Convert order to shipping address
  *
  * @param   Mage_Sales_Model_Order $order
  * @return  Mage_Sales_Model_Quote_Address
  */
 public function toQuoteShippingAddress(Mage_Sales_Model_Order $order)
 {
     $address = $this->addressToQuoteAddress($order->getShippingAddress());
     $address->setWeight($order->getWeight())->setShippingMethod($order->getShippingMethod())->setShippingDescription($order->getShippingDescription())->setShippingRate($order->getShippingRate())->setSubtotal($order->getSubtotal())->setTaxAmount($order->getTaxAmount())->setDiscountAmount($order->getDiscountAmount())->setShippingAmount($order->getShippingAmount())->setGiftcertAmount($order->getGiftcertAmount())->setCustbalanceAmount($order->getCustbalanceAmount())->setGrandTotal($order->getGrandTotal())->setBaseSubtotal($order->getBaseSubtotal())->setBaseTaxAmount($order->getBaseTaxAmount())->setBaseDiscountAmount($order->getBaseDiscountAmount())->setBaseShippingAmount($order->getBaseShippingAmount())->setBaseGiftcertAmount($order->getBaseGiftcertAmount())->setBaseCustbalanceAmount($order->getBaseCustbalanceAmount())->setBaseGrandTotal($order->getBaseGrandTotal());
     return $address;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:12,代码来源:Order.php

示例6: makeDonation

 public function makeDonation(Mage_Sales_Model_Order $order, $charityId)
 {
     $amount = Mage::helper('donations')->getCommissionRate() * 0.01 * $order->getSubtotal();
     $this->setOrderId($order->getId())->setAmount((double) $amount)->setCharityId($charityId)->save();
     return $this;
 }
开发者ID:eadsimone,项目名称:moduleforben,代码行数:6,代码来源:Donation.php


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