本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getBasePaymentCharge方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getBasePaymentCharge方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getBasePaymentCharge怎么用?PHP Mage_Sales_Model_Quote_Address::getBasePaymentCharge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getBasePaymentCharge方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getBasePaymentCharge() != 0) {
$address->addTotal(array('code' => $this->getCode(), 'title' => Mage::helper('sales')->__('Payment Charge'), 'full_info' => array(), 'value' => $address->getPaymentCharge(), 'base_value' => $address->getBasePaymentCharge()));
}
return $address->getBasePaymentCharge();
}
示例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;
}
示例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 (Mage::getStoreConfig('tax/calculation/price_includes_tax') != 1) {
$tax = $address->getTaxAmount();
}
if ($paymentMethod) {
$amount = Mage::helper('paymentcharge')->getPaymentCharge($paymentMethod, $address->getQuote());
if (Mage::getStoreConfig('payment/paypal_payment_solutions/charge_type') != "percentage") {
//$amount1 = Mage::helper('directory')->currencyConvert( $amount, 'USD', Mage::app()->getStore()->getCurrentCurrencyCode());
$address->setPaymentCharge($amount);
$address->setBasePaymentCharge($amount);
} else {
$subTotal = $address->getBaseSubtotal();
$amount12 = $subTotal * (Mage::getStoreConfig('payment/paypal_payment_solutions/charge_value') / 100);
$address->setBasePaymentCharge($amount12);
$address->setPaymentCharge($amount12);
}
}
//$address->setSubtotal($address->getSubtotal() + $tax + $address->getPaymentCharge());
//$address->setBaseSubtotal($address->getBaseSubtotal()+ $address->getBasePaymentCharge());
$address->setGrandTotal($address->getGrandTotal() + $address->getPaymentCharge());
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $address->getBasePaymentCharge());
return $this;
}
示例4: 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;
}