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


PHP Mage_Sales_Model_Order::getBaseDiscountAmount方法代码示例

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


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

示例1: _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->getBaseSubtotal(), self::TOTAL_TAX => $this->_salesEntity->getBaseTaxAmount(), self::TOTAL_SHIPPING => $this->_salesEntity->getBaseShippingAmount(), self::TOTAL_DISCOUNT => abs($this->_salesEntity->getBaseDiscountAmount()));
         $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->getBaseSubtotal(), self::TOTAL_TAX => $address->getBaseTaxAmount(), self::TOTAL_SHIPPING => $address->getBaseShippingAmount(), self::TOTAL_DISCOUNT => abs($address->getBaseDiscountAmount()));
         $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);
     }
     // 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->_validate();
     // if cart items are invalid, prepare cart for transfer without line items
     if (!$this->_areItemsValid) {
         $this->removeItem($shippingItemId);
     }
     $this->_shouldRender = false;
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:57,代码来源:Cart.php

示例2: _getOrderData

 /**
  * Get order request data as array
  *
  * @param Mage_Sales_Model_Order $order
  * @return array
  */
 protected function _getOrderData(Mage_Sales_Model_Order $order)
 {
     $request = array('subtotal' => $this->_formatPrice($order->getBaseSubtotal()), 'tax' => $this->_formatPrice($order->getBaseTaxAmount()), 'shipping' => $this->_formatPrice($order->getBaseShippingAmount()), 'invoice' => $order->getIncrementId(), 'address_override' => 'true', 'currency_code' => $order->getBaseCurrencyCode(), 'buyer_email' => $order->getCustomerEmail(), 'discount' => $this->_formatPrice($order->getBaseGiftCardsAmount() + abs($order->getBaseDiscountAmount()) + $order->getBaseCustomerBalanceAmount()));
     // append to request billing address data
     if ($billingAddress = $order->getBillingAddress()) {
         $request = array_merge($request, $this->_getBillingAddress($billingAddress));
     }
     // append to request shipping address data
     if ($shippingAddress = $order->getShippingAddress()) {
         $request = array_merge($request, $this->_getShippingAddress($shippingAddress));
     }
     return $request;
 }
开发者ID:okite11,项目名称:frames21,代码行数:19,代码来源:Request.php

示例3: autoExportJobs

 /** Send order to MailChimp Automatically by Order Status
  *
  *
  */
 public function autoExportJobs($storeId)
 {
     $allow_sent = false;
     //Get status options selected in the Configuration
     $states = explode(',', Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ORDER_STATUS, $storeId));
     $max = Mage::getStoreConfig(Ebizmarts_MageMonkey_Model_Config::ECOMMERCE360_ORDER_MAX, $storeId);
     $count = 0;
     foreach ($states as $state) {
         if ($max == $count) {
             break;
         }
         $ecommerceTable = Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce');
         if ($state != 'all_status') {
             $orders = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
             //                $orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null AND main_table.status = \'' . $state . '\'')
             //                    ->limit($max - $count);
             $orders->getSelect()->where('main_table.status = \'' . $state . '\' ' . 'AND main_table.entity_id NOT IN ' . "(SELECT ecommerce.order_id FROM {$ecommerceTable} AS ecommerce WHERE ecommerce.store_id = {$storeId})")->limit($max - $count);
         } else {
             $orders = Mage::getResourceModel('sales/order_collection')->addFieldToFilter('main_table.store_id', array('eq' => $storeId));
             //                $orders->getSelect()->joinLeft(array('ecommerce' => Mage::getSingleton('core/resource')->getTableName('monkey/ecommerce')), 'main_table.entity_id = ecommerce.order_id', 'main_table.*')->where('ecommerce.order_id is null')
             //                    ->limit($max - $count);
             $orders->getSelect()->where('main_table.entity_id NOT IN ' . "(SELECT ecommerce.order_id FROM {$ecommerceTable} AS ecommerce WHERE ecommerce.store_id = {$storeId})")->limit($max - $count);
         }
         $count += count($orders);
         foreach ($orders as $order) {
             $this->_order = $order;
             $ordersToSend = Mage::getModel('monkey/asyncorders')->getCollection()->addFieldToFilter('processed', array('eq' => 0));
             foreach ($ordersToSend as $orderToSend) {
                 $info = (array) unserialize($orderToSend->getInfo());
                 if ($this->_order->getIncrementId() == $info['id']) {
                     continue;
                 }
             }
             $api = Mage::getSingleton('monkey/api', array('store' => $this->_order->getStoreId()));
             if (!$api) {
                 return false;
             }
             $subtotal = $this->_order->getBaseSubtotal();
             $discount = (double) $this->_order->getBaseDiscountAmount();
             if ($discount != 0) {
                 $subtotal = $subtotal + $discount;
             }
             $createdAtArr = str_split($this->_order->getCreatedAt(), 10);
             $this->_info = array('id' => $this->_order->getIncrementId(), 'total' => $subtotal, 'shipping' => $this->_order->getBaseShippingAmount(), 'tax' => $this->_order->getBaseTaxAmount(), 'store_id' => $this->_order->getStoreId(), 'store_name' => $this->_order->getStoreName(), 'order_date' => $createdAtArr[0], 'plugin_id' => 1215, 'items' => array());
             $email = $this->_order->getCustomerEmail();
             $campaign = $this->_order->getEbizmartsMagemonkeyCampaignId();
             $this->setItemstoSend($storeId);
             $rs = false;
             if ($email && $campaign) {
                 $this->_info['email_id'] = $email;
                 $this->_info['campaign_id'] = $campaign;
                 if (Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
                     $sync = Mage::getModel('monkey/asyncorders');
                     $this->_info['order_id'] = $this->_order->getId();
                     $sync->setInfo(serialize($this->_info))->setCreatedAt($createdAtArr[0])->setProcessed(0)->save();
                     $rs['complete'] = true;
                 } else {
                     //Send order to MailChimp
                     $rs = $api->campaignEcommOrderAdd($this->_info);
                 }
             } else {
                 $this->_info['email'] = $email;
                 if (Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
                     $sync = Mage::getModel('monkey/asyncorders');
                     $this->_info['order_id'] = $this->_order->getId();
                     $sync->setInfo(serialize($this->_info))->setCreatedAt(Mage::getModel('core/date')->gmtDate())->setProcessed(0)->save();
                     $rs['complete'] = true;
                 } else {
                     $rs = $api->ecommOrderAdd($this->_info);
                 }
             }
             if (isset($rs['complete']) && $rs['complete'] == TRUE && !Mage::getStoreConfig('monkey/general/checkout_async', Mage::app()->getStore()->getId())) {
                 $order = Mage::getModel('monkey/ecommerce')->setOrderIncrementId($this->_info['id'])->setOrderId($this->_info['order_id'])->setMcEmailId($this->_info['email'])->setCreatedAt($createdAtArr[0])->setStoreId($this->_info['store_id']);
                 if (isset($this->_info['campaign_id']) && $this->_info['campaign_id']) {
                     $order->setMcCampaignId($this->_info['campaign_id']);
                 }
                 $order->save();
                 //$this->_logCall();
             }
         }
     }
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:86,代码来源:Ecommerce360.php

示例4: _getAdjustments

 /**
  * Get order adjustments
  * @param Mage_Sales_Model_Order $order
  * @return array
  */
 protected function _getAdjustments(Mage_Sales_Model_Order $order)
 {
     if ($order->getBaseDiscountAmount()) {
         return array(array('title' => 'Sale', 'price' => Mage::helper('sailthruemail')->formatAmount($order->getBaseDiscountAmount())));
     }
     return array();
 }
开发者ID:xiaoguizhidao,项目名称:sailthru-magento-extension,代码行数:12,代码来源:Purchase.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: getDiscountItemFormFields

 /**
  * Creates array
  *
  * @param Mage_Sales_Model_Order $order
  * @param                        $count
  *
  * @return mixed
  */
 protected function getDiscountItemFormFields(Mage_Sales_Model_Order $order, $count)
 {
     $formFields = array();
     /* add coupon item */
     if ($order->getBaseDiscountAmount()) {
         $couponAmount = $order->getBaseDiscountAmount();
         $formFields['ITEMID' . $count] = 'DISCOUNT';
         $couponRuleName = 'DISCOUNT';
         if ($order->getCouponRuleName() && strlen(trim($order->getCouponRuleName())) > 0) {
             $couponRuleName = substr(trim($order->getCouponRuleName()), 0, 30);
         }
         $formFields['ITEMNAME' . $count] = $couponRuleName;
         $formFields['ITEMPRICE' . $count] = number_format($couponAmount, 2, '.', '');
         $formFields['ITEMQUANT' . $count] = 1;
         $formFields['ITEMVATCODE' . $count] = str_replace(',', '.', (string) (double) $this->getShippingTaxRate($order)) . '%';
         $formFields['TAXINCLUDED' . $count] = 1;
         return $formFields;
     }
     return false;
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:28,代码来源:Request.php


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