本文整理汇总了PHP中Mage_Sales_Model_Quote_Address::getQuote方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Quote_Address::getQuote方法的具体用法?PHP Mage_Sales_Model_Quote_Address::getQuote怎么用?PHP Mage_Sales_Model_Quote_Address::getQuote使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Quote_Address
的用法示例。
在下文中一共展示了Mage_Sales_Model_Quote_Address::getQuote方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
if (!method_exists($address->getQuote(), 'isR4q') || !$address->getQuote()->isR4q() || Mage::helper('request4quote')->isTaxEstimatesEnabled()) {
parent::fetch($address);
}
return $this;
}
示例3: collect
public function collect(Mage_Sales_Model_Quote_Address $address)
{
if (!$this->_getConfigHelper()->getGeneralConfig('enable', $address->getQuote()->getStoreId())) {
return $this;
}
$customer = $address->getQuote()->getCustomer();
$baseGrandTotal = $address->getBaseGrandTotal();
if (!$customer || !$customer->getId() || $baseGrandTotal <= 0) {
return $this;
}
$baseDiscount = 0;
$luckyCodes = Mage::getModel('luckydraw/code')->getFailedCodes($customer->getId());
$useCodes = array();
foreach ($luckyCodes as $code) {
$codeDiscount = $code->getData('credit_rate');
$useCodes[] = $code->getId();
if ($baseGrandTotal - $codeDiscount <= 0) {
$baseGrandTotal = 0;
$baseDiscount = $address->getBaseGrandTotal();
break;
}
$baseGrandTotal -= $codeDiscount;
$baseDiscount += $codeDiscount;
}
if ($baseDiscount) {
Mage::getSingleton('core/session')->setUseLuckydrawCodes($useCodes);
$discount = Mage::app()->getStore()->convertPrice($baseDiscount);
$address->setBaseLuckydrawDiscount(-$baseDiscount);
$address->setLuckydrawDiscount(-$discount);
$address->setBaseGrandTotal($address->getBaseGrandTotal() - $baseDiscount);
$address->setGrandTotal($address->getGrandTotal() - $discount);
}
return $this;
}
示例4: fetchTotals
public function fetchTotals(Mage_Sales_Model_Quote_Address $address)
{
$amount = $address->getDiscountAmount();
if ($amount != 0) {
$title = Mage::helper('sales')->__('Discount');
if ($address->getQuote()->getCouponCode()) {
$title .= ' (' . $address->getQuote()->getCouponCode() . ')';
}
$address->addTotal(array('code' => 'discount', 'title' => $title, 'value' => -$amount));
}
return $this;
}
示例5: initRates
/**
* Init rates
*
* @param Mage_Sales_Model_Quote_Address $address
* @return $this
*/
public function initRates($address)
{
$this->_address = $address;
$this->setStoreId($address->getQuote()->getStoreId());
$this->_rates = $this->_getService()->getRates($address);
if (isset($this->_rates['failure']) && $this->_rates['failure'] === true) {
// set error flag for processing estimation errors on upper level
$this->_address->getQuote()->setData('estimate_tax_error', true);
$this->_address->getQuote()->setData('estimate_tax_error_details', $this->_rates['failure_details']);
}
return $this;
}
示例6: fetch
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$this->_method = $address->getQuote()->getPayment()->getMethod();
$label = Mage::helper('msp')->getFeeLabel($this->_method);
$quote = $address->getQuote();
$code = $quote->getPayment()->getMethod();
$amount = $address->getShippingAmount();
if ($amount != 0 || $address->getShippingDescription()) {
if ($address->getServicecostAmount()) {
$address->addTotal(array('code' => $this->getCode(), 'title' => $label, 'value' => $address->getServicecostPdf()));
}
}
return $this;
}
示例7: 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;
}
示例8: collect
/**
* Prepare Data to Storage for Order
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Magestore_Webpos_Model_Total_Quote_Cash
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
//Mage::getSingleton('webpos/session')->setWebposCash(null);
$cashin = Mage::getSingleton('webpos/session')->getWebposCash();
$baseCashin = $cashin / $quote->getStore()->convertPrice(1);
$quote->setWebposCash($cashin);
$quote->setWebposBaseCash($baseCashin);
if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
return $this;
}
if ($quote->getWebposCash() < 0.0001) {
return $this;
}
// Order Cash
$address->setWebposCash($quote->getWebposCash())->setWebposBaseCash($quote->getWebposBaseCash());
// Update total Paid and Refund
$address->setTotalPaid($quote->getWebposCash())->setBaseTotalPaid($quote->getWebposBaseCash());
if ($quote->getWebposCash() >= $address->getGrandTotal()) {
$address->setTotalRefunded($quote->getWebposCash() - $address->getGrandTotal())->setBaseTotalRefunded($quote->getWebposBaseCash() - $address->getBaseGrandTotal());
if ($payment = $quote->getPayment()) {
if ($method = $payment->getMethodInstance()) {
if ($method->getCode() == 'cashforpos') {
// prepair for cashin invoice
$address->setTotalPaid($address->getTotalRefunded())->setBaseTotalPaid($address->getBaseTotalRefunded());
}
}
}
}
return $this;
}
示例9: collect
/**
* Prepare Data to Storage for Order
*
* @param Mage_Sales_Model_Quote_Address $address
* @return Magestore_Webpos_Model_Total_Quote_Cash
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
$cashin = Mage::getSingleton('webpos/session')->getWebposCash();
if ($cashin && $cashin <= 0) {
return $this;
}
$baseCashin = $cashin / $quote->getStore()->convertPrice(1);
$quote->setWebposCash($cashin);
$quote->setWebposBaseCash($baseCashin);
if (!$quote->isVirtual() && $address->getAddressType() == 'billing') {
return $this;
}
$address->setWebposCash($quote->getWebposCash())->setWebposBaseCash($quote->getWebposBaseCash());
/*
$address->setTotalPaid($quote->getWebposCash())
->setBaseTotalPaid($quote->getWebposBaseCash());
*/
if ($quote->getWebposCash() >= $address->getGrandTotal()) {
/*
$address->setTotalRefunded($quote->getWebposCash() - $address->getGrandTotal())
->setBaseTotalRefunded($quote->getWebposBaseCash() - $address->getBaseGrandTotal());
if ($payment = $quote->getPayment()) {
if ($method = $payment->getMethodInstance()) {
$address->setTotalPaid($address->getTotalRefunded())
->setBaseTotalPaid($address->getBaseTotalRefunded());
}
}
*/
} else {
//$address->setGrandTotal($address->getGrandTotal() - $quote->getWebposCash() );
//$address->setBaseGrandTotal($address->getBaseGrandTotal() - $quote->getWebposBaseCash());
}
return $this;
}
示例10: collect
/**
* Invoke collector for nominal items
*
* @param Mage_Sales_Model_Quote_Address $address
* @param Mage_Sales_Model_Quote_Address_Total_Nominal
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$collector = Mage::getSingleton('Mage_Sales_Model_Quote_Address_Total_Nominal_Collector', array('store' => $address->getQuote()->getStore()));
// invoke nominal totals
foreach ($collector->getCollectors() as $model) {
$model->collect($address);
}
// aggregate collected amounts into one to have sort of grand total per item
foreach ($address->getAllNominalItems() as $item) {
$rowTotal = 0;
$baseRowTotal = 0;
$totalDetails = array();
foreach ($collector->getCollectors() as $model) {
$itemRowTotal = $model->getItemRowTotal($item);
if ($model->getIsItemRowTotalCompoundable($item)) {
$rowTotal += $itemRowTotal;
$baseRowTotal += $model->getItemBaseRowTotal($item);
$isCompounded = true;
} else {
$isCompounded = false;
}
if ((double) $itemRowTotal > 0 && ($label = $model->getLabel())) {
$totalDetails[] = new Varien_Object(array('label' => $label, 'amount' => $itemRowTotal, 'is_compounded' => $isCompounded));
}
}
$item->setNominalRowTotal($rowTotal);
$item->setBaseNominalRowTotal($baseRowTotal);
$item->setNominalTotalDetails($totalDetails);
}
return $this;
}
示例11: _isAddressActionable
/**
* Check if address actionable to calculate tax
*
* @param Mage_Sales_Model_Quote_Address $address
* @return bool
*/
protected function _isAddressActionable($address)
{
/** @var OnePica_AvaTax_Helper_Data $helper */
$helper = Mage::helper('avatax');
$storeId = $address->getQuote()->getStoreId();
return $helper->isAddressActionable($address, $storeId, OnePica_AvaTax_Model_Config::REGIONFILTER_TAX);
}
示例12: collect
/**
* Collect the order total
*
* @param object $address The address instance to collect from
*
* @return Sisow_Model_Quote_TaxTotal
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
if ($quote->getId() == null || $address->getAddressType() != "shipping") {
return $this;
}
$payment = $quote->getPayment();
if (substr($payment->getMethod(), 0, 6) != 'sisow_' && (!count($quote->getPaymentsCollection()) || !$payment->hasMethodInstance())) {
return $this;
}
$methodInstance = $payment->getMethodInstance();
if (substr($methodInstance->getCode(), 0, 6) != 'sisow_') {
return $this;
}
$helper = Mage::helper('sisow/paymentfee');
$fee = $helper->getPaymentFeeArray($methodInstance->getCode(), $quote);
if (!is_array($fee)) {
return $this;
}
$address->setTaxAmount($address->getTaxAmount() + $fee['taxamount']);
$address->setBaseTaxAmount($address->getBaseTaxAmount() + $fee['base_taxamount']);
$address->setInvoiceTaxAmount($fee['taxamount']);
$address->setBaseInvoiceTaxAmount($fee['base_taxamount']);
return $this;
}
示例13: collect
/**
* @param Mage_Sales_Model_Quote_Address $address
* @return Mage_Sales_Model_Quote_Address_Total_Abstract
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
$quote = $address->getQuote();
$payment = $quote->getPayment();
if ($address->getAddressType() === 'billing') {
return $this;
}
$configId = $payment->getPayoneConfigPaymentMethodId();
if (empty($configId)) {
return $this;
}
$config = $this->helperConfig()->getConfigPaymentMethodById($configId, $quote->getStoreId());
if (empty($config)) {
return $this;
}
$feeConfig = $config->getFeeConfigForQuote($quote);
if (!is_array($feeConfig) or !array_key_exists('fee_config', $feeConfig)) {
return $this;
}
$paymentFee = $feeConfig['fee_config'];
$oldShippingAmount = $address->getBaseShippingAmount();
$newShippingAmount = $oldShippingAmount + $paymentFee;
$address->setBaseShippingAmount($newShippingAmount);
$address->setShippingAmount($quote->getStore()->convertPrice($newShippingAmount, false));
return parent::collect($address);
}
示例14: collect
/**
* Collect the order total
*
* @param object $address The address instance to collect from
*
* @return Sisow_Model_Quote_Total
*/
public function collect(Mage_Sales_Model_Quote_Address $address)
{
if ($address->getAddressType() != "shipping") {
return $this;
}
$this->address = $address;
$this->quote = $address->getQuote();
$this->payment = $this->quote->getPayment();
if (substr($this->payment->getMethod(), 0, 6) != 'sisow_') {
return $this;
}
$this->_resetValues();
if ($this->address->getQuote()->getId() == null) {
return $this;
}
$items = $this->address->getAllItems();
if (!count($items)) {
return $this;
}
if ($this->payment->hasMethodInstance()) {
$this->paymentMethod = $this->payment->getMethodInstance();
if (substr($this->paymentMethod->getCode(), 0, 6) == 'sisow_') {
$this->_initInvoiceFee();
}
}
}
示例15: _processGiftRules
/**
* Process the gift rules
*
* @param Mage_Sales_Model_Quote_Address $address
*/
protected function _processGiftRules($address)
{
$quote = $address->getQuote();
$store = Mage::app()->getStore($quote->getStoreId());
$validator = Mage::getSingleton('gift/rule_validator')->init($store->getWebsiteId(), $quote->getCustomerGroupId());
$validator->process($address);
}