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


PHP Mage_Sales_Model_Quote_Address::setPaymentCharge方法代码示例

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


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

示例1: collect

 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $address->setPaymentCharge(0);
     $address->setBasePaymentCharge(0);
     $items = $address->getAllItems();
     if (!count($items)) {
         return $this;
     }
     $paymentMethod = $address->getQuote()->getPayment()->getMethod();
     if (Mage::getStoreConfig('tax/calculation/price_includes_tax') != 1) {
         $tax = $address->getTaxAmount();
     }
     if ($paymentMethod) {
         $amount1 = Mage::helper('paymentcharge')->getPaymentCharge($paymentMethod, $address->getQuote());
         $amount = Mage::helper('directory')->currencyConvert($amount1, Mage::app()->getWebsite()->getConfig('currency/options/default'), Mage::app()->getStore()->getCurrentCurrencyCode());
         //			if(Mage::getStoreConfig('payment/paypal_payment_solutions/charge_type')!="percentage"){
         $address->setPaymentCharge($amount);
         $address->setBasePaymentCharge($amount1);
         /*			} else {
         					$address->setPaymentCharge($amount);
         				   
         					$subTotal = $address->getBaseSubtotal();	
         					$amount12 = ($subTotal+ $tax) * floatval(Mage::getStoreConfig('payment/paypal_payment_solutions/charge_value')) / 100;
         					$address->setBasePaymentCharge($amount12);
         			}*/
     }
     $address->setGrandTotal($address->getGrandTotal() + $tax + $address->getPaymentCharge());
     $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
     return $this;
 }
开发者ID:purpleweb,项目名称:flywebdesign_paypalfee,代码行数:30,代码来源:Paymentcharge.php

示例2: collect

 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $address->setPaymentCharge(0);
     $address->setBasePaymentCharge(0);
     $storeId = Mage::app()->getStore()->getId();
     $items = $address->getAllItems();
     if (!count($items)) {
         return $this;
     }
     $paymentMethod = $address->getQuote()->getPayment()->getMethod();
     $quote = $address->getQuote();
     if ($paymentMethod && substr($paymentMethod, 0, 11) == 'pay_payment') {
         $baseAmount = Mage::helper('pay_payment')->getPaymentCharge($paymentMethod, $address->getQuote());
         $amount = Mage::helper('directory')->currencyConvert($baseAmount, Mage::app()->getWebsite()->getConfig('currency/options/default'), Mage::app()->getStore()->getCurrentCurrencyCode());
         $address->setPaymentCharge($amount);
         $address->setBasePaymentCharge($baseAmount);
         $taxClass = Mage::helper('pay_payment')->getPaymentChargeTaxClass($paymentMethod);
         $taxCalculationModel = Mage::getSingleton('tax/calculation');
         $request = $taxCalculationModel->getRateRequest($quote->getShippingAddress(), $quote->getBillingAddress(), null, $storeId);
         $request->setStore(Mage::app()->getStore());
         $rate = $taxCalculationModel->getRate($request->setProductClassId($taxClass));
         //$rate = 21;
         if ($rate > 0) {
             //                $includesTax = Mage::getStoreConfig('tax/calculation/price_includes_tax');
             $baseChargeTax = round($address->getBasePaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
             $chargeTax = round($address->getPaymentCharge() / (1 + $rate / 100) * ($rate / 100), 2);
         } else {
             $baseChargeTax = 0;
             $chargeTax = 0;
         }
         $rates = array();
         $applied = false;
         foreach ($address->getAppliedTaxes() as $arrRate) {
             // maximaal 1 keer de btw voor de extra kosten toevoegen
             if ($arrRate['percent'] == $rate && !$applied) {
                 $applied = true;
                 $arrRate['amount'] = $arrRate['amount'] + $chargeTax;
                 $arrRate['base_amount'] = $arrRate['base_amount'] + $baseChargeTax;
             }
             $rates[] = $arrRate;
         }
         $address->setAppliedTaxes($rates);
         $address->setBaseTaxAmount($address->getBaseTaxAmount() + $baseChargeTax);
         $address->setTaxAmount($address->getTaxAmount() + $chargeTax);
         $address->setGrandTotal($address->getGrandTotal() + $address->getPaymentCharge());
         $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
     }
     return $this;
 }
开发者ID:paynl,项目名称:magento-plugin,代码行数:49,代码来源:Paymentcharge.php

示例3: collect

 public function collect(Mage_Sales_Model_Quote_Address $address)
 {
     $address->setPaymentCharge(0);
     $address->setBasePaymentCharge(0);
     $items = $address->getAllItems();
     if (!count($items)) {
         return $this;
     }
     $paymentMethod = $address->getQuote()->getPayment()->getMethod();
     if ($paymentMethod) {
         $amount = Mage::helper('paymentcharge')->getPaymentCharge($paymentMethod, $address->getQuote());
         $address->setPaymentCharge($amount['amount']);
         $address->setBasePaymentCharge($amount['base_amount']);
     }
     $address->setGrandTotal($address->getGrandTotal() + $address->getPaymentCharge());
     $address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
     return $this;
 }
开发者ID:vasuscoin,项目名称:Payment_Surcharge,代码行数:18,代码来源:Paymentcharge.php


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