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


PHP Mage_Sales_Model_Quote_Address::getSubtotal方法代码示例

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


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

示例1: fetch

 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $store = $address->getQuote()->getStore();
     $taxConfig = Mage::getSingleton('tax/config');
     $salesHelper = Mage::helper('sales');
     if ($taxConfig->displayCartSubtotalBoth($store) || $taxConfig->displayCartSubtotalInclTax($store)) {
         if ($address->getSubtotalInclTax() > 0) {
             $subtotalInclTax = $address->getSubtotalInclTax();
         } else {
             $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount() - $address->getPaymentFeeTax();
         }
         $address->addTotal(array('code' => 'subtotal', 'title' => $salesHelper->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
     }
     return $this;
 }
开发者ID:Maikel-Koek,项目名称:magento,代码行数:15,代码来源:PaymentFee.php

示例2: addressToOrder

 /**
  * Convert quote address model to order
  *
  * @param   Mage_Sales_Model_Quote $quote
  * @return  Mage_Sales_Model_Order
  */
 public function addressToOrder(Mage_Sales_Model_Quote_Address $address, $order = null)
 {
     if (!$order instanceof Mage_Sales_Model_Order) {
         $order = $this->toOrder($address->getQuote());
     }
     $order->setWeight($address->getWeight())->setShippingMethod($address->getShippingMethod())->setShippingDescription($address->getShippingDescription())->setShippingRate($address->getShippingRate())->setSubtotal($address->getSubtotal())->setTaxAmount($address->getTaxAmount())->setDiscountAmount($address->getDiscountAmount())->setShippingAmount($address->getShippingAmount())->setGiftcertAmount($address->getGiftcertAmount())->setCustbalanceAmount($address->getCustbalanceAmount())->setGrandTotal($address->getGrandTotal())->setBaseSubtotal($address->getBaseSubtotal())->setBaseTaxAmount($address->getBaseTaxAmount())->setBaseDiscountAmount($address->getBaseDiscountAmount())->setBaseShippingAmount($address->getBaseShippingAmount())->setBaseGiftcertAmount($address->getBaseGiftcertAmount())->setBaseCustbalanceAmount($address->getBaseCustbalanceAmount())->setBaseGrandTotal($address->getBaseGrandTotal());
     Mage::dispatchEvent('sales_convert_quote_address_to_order', array('address' => $address, 'order' => $order));
     return $order;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:15,代码来源:Quote.php

示例3: fetch

 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     if ($address->getAddressType() == 'billing') {
         return $this;
     }
     if (Mage::helper('customfee')->canApply()) {
         $amount = $this->getFeeAmount($address->getSubtotal());
         $address->addTotal(array('code' => $this->getCode(), 'title' => $this->getLabel(), 'value' => $amount));
     }
     return $this;
 }
开发者ID:vijays91,项目名称:Magento-Custom-Fee,代码行数:11,代码来源:Customfee.php

示例4: resetAddress

 protected function resetAddress(Mage_Sales_Model_Quote_Address $address)
 {
     $address->setDiscountAmount(0.0);
     $address->setBaseDiscountAmount(0.0);
     $address->setSubtotalWithDiscount($address->getSubtotal());
     $address->setBaseSubtotalWithDiscount($address->getBaseSubtotal());
     $address->setDiscountDescription('');
     $address->setDiscountDescriptionArray([]);
     if (!$address->getData('__applied_rules_reset__')) {
         $address->setAppliedRuleIds('');
         $address->setData('__applied_rules_reset__', true);
     }
     $address->setShippingDiscountAmount(0);
     $address->setBaseShippingDiscountAmount(0);
     $address->setFreeShipping(false);
 }
开发者ID:aoepeople,项目名称:aoe_salesrule,代码行数:16,代码来源:Discount.php

示例5: collect

 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     if (!Mage::getSingleton('checkout/session')->getQuoteId()) {
         return $this;
     }
     $_helper = Mage::helper('msp_cashondelivery');
     $_model = Mage::getModel('msp_cashondelivery/cashondelivery');
     $_subtotal = $address->getSubtotal();
     $quote = $address->getQuote();
     $baseAmount = $_model->getBaseExtraFee($_subtotal);
     $amount = $_model->getExtraFee($_subtotal);
     $codTax = $_helper->getTaxAmount($amount);
     $codBaseTax = $_helper->getTaxAmount($baseAmount);
     if ($quote->getPayment()->getMethod() == $_model->getCode() && $address->getAddressType() == Mage_Sales_Model_Quote_Address::TYPE_SHIPPING) {
         $address->setTaxAmount($address->getTaxAmount() + $codTax);
         $address->setBaseTaxAmount($address->getBaseTaxAmount() + $codBaseTax);
         $this->_saveAppliedTaxes($address, $_helper->getAppliedRates(), $codTax, $codBaseTax, $_helper->getRate());
         $address->setGrandTotal($address->getGrandTotal() + $codTax);
         $address->setBaseGrandTotal($address->getBaseGrandTotal() + $codBaseTax);
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:22,代码来源:Tax.php

示例6: fetch

 /**
  * Assign subtotal amount and label to address object
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_Sales_Model_Quote_Address_Total_Subtotal
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $address->getSubtotal()));
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:11,代码来源:Subtotal.php

示例7: collect

 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $helper = Mage::helper('mageworx_customoptions');
     if (!$helper->isEnabled() || !$helper->isSkuPriceLinkingEnabled()) {
         return $this;
     }
     if ($address->getSubtotal() == 0) {
         return $this;
     }
     $this->_address = $address;
     $this->_store = $address->getQuote()->getStore();
     $this->_config = Mage::getSingleton('tax/config');
     $this->_helper = Mage::helper('tax');
     if (method_exists($this, '_getAddressItems')) {
         $items = $this->_getAddressItems($address);
     } else {
         $items = $address->getAllItems();
     }
     if (!$items) {
         return $this;
     }
     $quote = $address->getQuote();
     $address->setSubtotalInclTax(0);
     $address->setBaseSubtotalInclTax(0);
     $address->setTotalAmount('subtotal', 0);
     $address->setBaseTotalAmount('subtotal', 0);
     $totalDiffTax = 0;
     foreach ($items as $item) {
         $diffTax = 0;
         $product = $item->getProduct();
         // if bad magento))
         if (is_null($product->getHasOptions())) {
             $product->load($product->getId());
         }
         if (($product->getTypeId() == 'simple' || $product->getTypeId() == 'configurable' || $product->getTypeId() == 'virtual' || $product->getTypeId() == 'downloadable') && $product->getHasOptions()) {
             $store = $product->getStore();
             $post = $helper->getInfoBuyRequest($product);
             if (isset($post['options'])) {
                 $options = $post['options'];
             } else {
                 $options = array();
             }
             $qty = $item->getQty();
             if ($options) {
                 $priceIncludesTax = Mage::helper('tax')->priceIncludesTax($store);
                 foreach ($options as $optionId => $option) {
                     $optionModel = $product->getOptionById($optionId);
                     if (!$optionModel) {
                         continue;
                     }
                     $optionModel->setProduct($product);
                     $optionType = $optionModel->getType();
                     if ($optionModel->getGroupByType($optionType) != Mage_Catalog_Model_Product_Option::OPTION_GROUP_SELECT) {
                         if (!$optionModel->getIsSkuPrice()) {
                             continue;
                         }
                         $taxClassId = $optionModel->getTaxClassId();
                         if (is_null($taxClassId) || $product->getTaxClassId() == $taxClassId || $priceIncludesTax) {
                             continue;
                         }
                         $optionTotalQty = $optionModel->getCustomoptionsIsOnetime() ? 1 : $qty;
                         $price = $helper->getOptionPriceByQty($optionModel, $optionTotalQty);
                         $tax1 = $helper->getTaxPrice($price, $quote, $product->getTaxClassId(), $address);
                         $tax2 = $helper->getTaxPrice($price, $quote, $taxClassId, $address);
                         $diffTax += $tax2 - $tax1;
                     } else {
                         if (!is_array($option)) {
                             $option = array($option);
                         }
                         foreach ($option as $optionTypeId) {
                             if (!$optionTypeId) {
                                 continue;
                             }
                             $valueModel = $optionModel->getValueById($optionTypeId);
                             if (!$valueModel || !$valueModel->getIsSkuPrice()) {
                                 continue;
                             }
                             $taxClassId = $valueModel->getTaxClassId();
                             if (is_null($taxClassId) || $product->getTaxClassId() == $taxClassId || $priceIncludesTax) {
                                 continue;
                             }
                             // get total option qty
                             switch ($optionType) {
                                 case 'checkbox':
                                 case 'multiswatch':
                                 case 'hidden':
                                     if (isset($post['options_' . $optionId . '_' . $optionTypeId . '_qty'])) {
                                         $optionQty = intval($post['options_' . $optionId . '_' . $optionTypeId . '_qty']);
                                     } else {
                                         $optionQty = 1;
                                     }
                                     break;
                                 case 'drop_down':
                                 case 'radio':
                                 case 'swatch':
                                     if (isset($post['options_' . $optionId . '_qty'])) {
                                         $optionQty = intval($post['options_' . $optionId . '_qty']);
                                     } else {
                                         $optionQty = 1;
                                     }
//.........这里部分代码省略.........
开发者ID:Eximagen,项目名称:pfizer,代码行数:101,代码来源:Total.php

示例8: fetch

 /**
  * Add tax totals information to address object
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $applied = $address->getAppliedTaxes();
     $store = $address->getQuote()->getStore();
     $amount = $address->getTaxAmount();
     $area = null;
     if ($this->_config->displayCartTaxWithGrandTotal($store) && $address->getGrandTotal()) {
         $area = 'taxes';
     }
     if ($amount != 0 || $this->_config->displayCartZeroTax($store)) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $applied ? $applied : array(), 'value' => $amount, 'area' => $area));
     }
     $store = $address->getQuote()->getStore();
     /**
      * Modify subtotal
      */
     if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
         if ($address->getSubtotalInclTax() > 0) {
             $subtotalInclTax = $address->getSubtotalInclTax();
         } else {
             $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
         }
         $address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
     }
     return $this;
 }
开发者ID:redesignMob,项目名称:extensii,代码行数:32,代码来源:Tax.php

示例9: fetchTotals

 /**
  * Add total
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return Mage_Sales_Model_Resource_Quote_Address_Attribute_Frontend_Subtotal
  */
 public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
 {
     $address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('Mage_Sales_Helper_Data')->__('Subtotal'), 'value' => $address->getSubtotal()));
     return $this;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:11,代码来源:Subtotal.php

示例10: collect

 /**
  * @param Mage_Sales_Model_Quote_Address $address
  * @return $this|Mage_Sales_Model_Quote_Address_Total_Abstract
  */
 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $helper = Mage::helper('mageworx_multifees');
     if ($address->getSubtotal() == 0 && floatval($address->getCustomerCreditAmount()) == 0) {
         return $this;
     }
     if ($this->_collected) {
         return $this;
     }
     ////////////////////////////////////////////////////////////////////
     $subtotalRowTOTAL = 0;
     $CompanyTotal = 0;
     $PersonTotal = 0;
     $quote = Mage::getSingleton('checkout/cart')->getQuote();
     $cartItems = $quote->getAllVisibleItems();
     $userGroupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
     foreach ($cartItems as $item) {
         $subtotalRow = 0;
         $_product = Mage::getModel('catalog/product')->load($item->getProductId());
         $ids = $_product->getCategoryIds();
         $productId = $item->getProductId();
         $qty = $item->getQty();
         $price = $item->getProduct()->getPrice();
         $subtotalRow = $subtotalRow + $price * $qty;
         //If the product has perception tax for persons
         if (array_search("372", $ids) != false && $subtotalRow >= 100) {
             $PersonTotal = $PersonTotal + $subtotalRow;
         }
         //If the product has perception tax for persons
         if (array_search("373", $ids) != false) {
             $CompanyTotal = $CompanyTotal + $subtotalRow;
         }
     }
     //If the user is Not log in
     if ($userGroupId == 0 || $userGroupId == 8) {
         $subtotalRowTOTAL = $PersonTotal;
         $subtotalRowTOTAL = $subtotalRowTOTAL / 1.18;
     } elseif ($userGroupId == 8) {
         $subtotalRowTOTAL = $CompanyTotal;
         $subtotalRowTOTAL = $subtotalRowTOTAL / 1.18;
     } else {
         $subtotalRowTOTAL = 0;
     }
     //////////////////////////////////////////////////////////////////////////////////////////////////////
     $baseSubtotalRow = floatval($subtotalRowTOTAL);
     $baseSubtotal = floatval($address->getBaseSubtotalWithDiscount());
     $baseShipping = floatval($address->getBaseShippingAmount());
     // - $address->getBaseShippingTaxAmount()
     $baseTax = floatval($address->getBaseTaxAmount());
     //amount
     $address->setMultifeesAmount(0);
     $address->setBaseMultifeesAmount(0);
     $address->setDetailsMultifees(null);
     $quote = $address->getQuote();
     $feeMessages = new Varien_Data_Collection();
     // add payment fee (front and admin)
     if (Mage::app()->getRequest()->getPost('is_payment_fee', false)) {
         $feesPost = Mage::app()->getRequest()->getPost('fee', array());
         foreach ($feesPost as $feeId => $data) {
             if (isset($data['message'])) {
                 $obj = new Varien_Object();
                 $obj->setFeeId($feeId);
                 $obj->setMessage($data['message']);
                 $feeMessages->addItem($obj);
             }
         }
         $helper->addFeesToCart($feesPost, $quote->getStoreId(), false, 2, 0);
     }
     // add shipping fee (front and admin)
     if (Mage::app()->getRequest()->getPost('is_shipping_fee', false)) {
         $feesPost = Mage::app()->getRequest()->getPost('fee', array());
         foreach ($feesPost as $feeId => $data) {
             if (isset($data['message'])) {
                 $obj = new Varien_Object();
                 $obj->setFeeId($feeId);
                 $obj->setMessage($data['message']);
                 $feeMessages->addItem($obj);
             }
         }
         $helper->addFeesToCart($feesPost, $quote->getStoreId(), false, 3, 0);
     }
     $feesData = $helper->getQuoteDetailsMultifees($address->getId());
     // autoadd default cart fees, no hidden
     if (is_null($feesData) && $helper->isEnableCartFees()) {
         $this->autoAddFeesByParams(1, 0, 2, 1, '', $quote, $address, $helper, null);
     }
     // autoadd hidden cart fees
     if ($helper->isEnableCartFees()) {
         $this->autoAddFeesByParams(1, 0, 1, 1, '', $quote, $address, $helper, null);
     }
     // autoadd hidden shipping fees
     if ($helper->isEnableShippingFees() && $address->getShippingMethod()) {
         $this->autoAddFeesByParams(3, 0, 1, 1, strval($address->getShippingMethod()), $quote, $address, $helper, $feeMessages);
     }
     // autoadd hidden fees
     if ($helper->isEnablePaymentFees() && $quote->getPayment()->getMethod()) {
//.........这里部分代码省略.........
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:101,代码来源:Total.php

示例11: fetch

 /**
  * Add tax totals information to address object
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  Mage_Tax_Model_Sales_Total_Quote
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $config = Mage::getSingleton('tax/config');
     $quote = $address->getQuote();
     $store = $quote->getStore();
     $amount = $address->getTaxAmount();
     $fullInfo = array();
     $summary = Mage::getModel('avatax/avatax_estimate')->getSummary($address->getId());
     foreach ($summary as $key => $row) {
         $id = 'avatax-' . $key;
         $fullInfo[$id] = array('rates' => array(array('code' => $row['name'], 'title' => $row['name'], 'percent' => $row['rate'], 'position' => $key, 'priority' => $key, 'rule_id' => 0)), 'percent' => $row['rate'], 'id' => $id, 'process' => 0, 'amount' => $row['amt'], 'base_amount' => $row['amt']);
     }
     if ($amount != 0 || Mage::helper('tax')->displayZeroTax($store)) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $fullInfo, 'value' => $amount, 'area' => null));
     }
     /**
      * Modify subtotal
      */
     if (method_exists($config, "displayCartSubtotalBoth") && method_exists($config, "displayCartSubtotalInclTax") && ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store))) {
         $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
         $address->setSubtotalInclTax($subtotalInclTax);
         $address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
     }
     return $this;
 }
开发者ID:shabirm,项目名称:avatax,代码行数:31,代码来源:Tax.php

示例12: fetch

 /**
  * Add tax totals information to address object
  *
  * @param   Mage_Sales_Model_Quote_Address $address
  * @return  $this
  */
 public function fetch(Mage_Sales_Model_Quote_Address $address)
 {
     $config = Mage::getSingleton('tax/config');
     $quote = $address->getQuote();
     $store = $quote->getStore();
     $amount = $address->getTaxAmount();
     if ($amount != 0 || Mage::helper('tax')->displayZeroTax($store)) {
         $address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('tax')->__('Tax'), 'full_info' => $address->getAppliedTaxes(), 'value' => $amount, 'area' => null));
     }
     /**
      * Modify subtotal
      */
     if (method_exists($config, "displayCartSubtotalBoth") && method_exists($config, "displayCartSubtotalInclTax") && ($config->displayCartSubtotalBoth($store) || $config->displayCartSubtotalInclTax($store))) {
         if ($address->getSubtotalInclTax() > 0) {
             $subtotalInclTax = $address->getSubtotalInclTax();
         } else {
             $subtotalInclTax = $address->getSubtotal() + $address->getTaxAmount() - $address->getShippingTaxAmount();
         }
         $address->addTotal(array('code' => 'subtotal', 'title' => Mage::helper('sales')->__('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $address->getSubtotal()));
     }
     return $this;
 }
开发者ID:onepica,项目名称:avatax,代码行数:28,代码来源:Tax.php

示例13: calculateCartTotal

 /**
  * Calculate cart total net
  *
  * @param Mage_Sales_Model_Quote_Address $address
  * @return int
  */
 private function calculateCartTotal($address)
 {
     if ($address->getTaxAmount() > 0) {
         $value = $address->getGrandTotal() - $address->getTaxAmount();
         return $this->currencyToSmallerUnit($value);
     } else {
         $discount = $address->getDiscountAmount() < 0 ? -$address->getDiscountAmount() : $address->getDiscountAmount();
         $value = $address->getSubtotal() + $address->getShippingAmount() + $this->getQuote()->getBillpayChargedFeeNet() - $discount;
         // TODO: for rate payment add fee tax amount
         return $this->currencyToSmallerUnit($value);
     }
 }
开发者ID:xiaoguizhidao,项目名称:bilderrahmen,代码行数:18,代码来源:Api.php


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