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


PHP Mage_Sales_Model_Quote::isVirtual方法代码示例

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


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

示例1: createNewOrder

 /**
  * @param Mage_Sales_Model_Quote $quote
  * @return Mage_Sales_Model_Order
  * @throws Exception
  */
 public function createNewOrder($quote)
 {
     $convert = Mage::getModel('sales/convert_quote');
     if ($quote->isVirtual()) {
         $this->setOrder($convert->addressToOrder($quote->getBillingAddress()));
     } else {
         $this->setOrder($convert->addressToOrder($quote->getShippingAddress()));
     }
     $this->getOrder()->setBillingAddress($convert->addressToOrderAddress($quote->getBillingAddress()));
     if ($quote->getBillingAddress()->getCustomerAddress()) {
         $this->getOrder()->getBillingAddress()->setCustomerAddress($quote->getBillingAddress()->getCustomerAddress());
     }
     if (!$quote->isVirtual()) {
         $this->getOrder()->setShippingAddress($convert->addressToOrderAddress($quote->getShippingAddress()));
         if ($quote->getShippingAddress()->getCustomerAddress()) {
             $this->getOrder()->getShippingAddress()->setCustomerAddress($quote->getShippingAddress()->getCustomerAddress());
         }
     }
     $this->getOrder()->setPayment($convert->paymentToOrderPayment($quote->getPayment()));
     $this->getOrder()->getPayment()->setTransactionId($quote->getPayment()->getTransactionId());
     foreach ($quote->getAllItems() as $item) {
         /** @var Mage_Sales_Model_Order_Item $item */
         $orderItem = $convert->itemToOrderItem($item);
         if ($item->getParentItem()) {
             $orderItem->setParentItem($this->getOrder()->getItemByQuoteItemId($item->getParentItem()->getId()));
         }
         $this->getOrder()->addItem($orderItem);
     }
     $this->getOrder()->setQuote($quote);
     $this->getOrder()->setExtOrderId($quote->getPayment()->getTransactionId());
     $this->getOrder()->setCanSendNewEmailFlag(false);
     $this->_initTransaction($quote);
     return $this->getOrder();
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:39,代码来源:AbstractPayol.php

示例2: validateQuote

 /**
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return array[]
  */
 public function validateQuote(Mage_Sales_Model_Quote $quote)
 {
     $errors = [];
     if (!$quote->isVirtual()) {
         // Copy data from billing address
         if ($quote->getShippingAddress()->getSameAsBilling()) {
             $quote->getShippingAddress()->importCustomerAddress($quote->getBillingAddress()->exportCustomerAddress());
             $quote->getShippingAddress()->setSameAsBilling(1);
         }
         $addressErrors = $this->validateQuoteAddress($quote->getShippingAddress());
         if (!empty($addressErrors)) {
             $errors['shipping_address'] = $addressErrors;
         }
         $method = $quote->getShippingAddress()->getShippingMethod();
         $rate = $quote->getShippingAddress()->getShippingRateByCode($method);
         if (!$method || !$rate) {
             $errors['shipping_method'] = [$this->__('Please specify a valid shipping method.')];
         }
     }
     $addressErrors = $this->validateQuoteAddress($quote->getBillingAddress());
     if (!empty($addressErrors)) {
         $errors['billing_address'] = $addressErrors;
     }
     try {
         if (!$quote->getPayment()->getMethod() || !$quote->getPayment()->getMethodInstance()) {
             $errors['payment'] = [$this->__('Please select a valid payment method.')];
         }
     } catch (Mage_Core_Exception $e) {
         $errors['payment'] = [$this->__('Please select a valid payment method.')];
     }
     return $errors;
 }
开发者ID:aoepeople,项目名称:aoe_cartapi,代码行数:37,代码来源:Data.php

示例3: prepareCollection

 /**
  * Convert the resource model collection to an array
  *
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return array
  */
 public function prepareCollection(Mage_Sales_Model_Quote $quote, $applyCollectionModifiers = true)
 {
     // This collection should always be a key/value hash and never a simple array
     $data = new ArrayObject();
     if ($quote->isVirtual()) {
         return $data;
     }
     // Store current state
     $actionType = $this->getActionType();
     $operation = $this->getOperation();
     // Change state
     $this->setActionType(self::ACTION_TYPE_COLLECTION);
     $this->setOperation(self::OPERATION_RETRIEVE);
     // Get filter
     $filter = $this->getFilter();
     // Prepare collection
     foreach ($this->getCrosssellProducts($quote, $applyCollectionModifiers) as $product) {
         $data[$product->getSku()] = $this->prepareProduct($product, $filter);
     }
     // Restore old state
     $this->setActionType($actionType);
     $this->setOperation($operation);
     // Return prepared outbound data
     return $data;
 }
开发者ID:aoepeople,项目名称:aoe_cartapi,代码行数:32,代码来源:Crosssell.php

示例4: collect

 /**
  * collect reward points that customer earned (per each item and address) total
  * 
  * @param Mage_Sales_Model_Quote_Address $address
  * @param Mage_Sales_Model_Quote $quote
  * @return Magestore_RewardPoints_Model_Total_Quote_Point
  */
 public function collect($address, $quote)
 {
     if (!Mage::helper('rewardpoints')->isEnable($quote->getStoreId())) {
         return $this;
     }
     // get points that customer can earned by Rates
     if ($quote->isVirtual()) {
         $address = $quote->getBillingAddress();
     } else {
         $address = $quote->getShippingAddress();
     }
     $baseGrandTotal = $quote->getBaseGrandTotal();
     if (!Mage::getStoreConfigFlag(Magestore_RewardPoints_Helper_Calculation_Earning::XML_PATH_EARNING_BY_SHIPPING, $quote->getStoreId())) {
         $baseGrandTotal -= $address->getBaseShippingAmount();
     }
     if (!Mage::getStoreConfigFlag(Magestore_RewardPoints_Helper_Calculation_Earning::XML_PATH_EARNING_BY_TAX, $quote->getStoreId())) {
         $baseGrandTotal -= $address->getBaseTaxAmount();
     }
     $baseGrandTotal = max(0, $baseGrandTotal);
     $earningPoints = Mage::helper('rewardpoints/calculation_earning')->getRateEarningPoints($baseGrandTotal, $quote->getStoreId());
     if ($earningPoints > 0) {
         $address->setRewardpointsEarn($earningPoints);
     }
     Mage::dispatchEvent('rewardpoints_collect_earning_total_points_before', array('address' => $address));
     // Update earning point for each items
     $this->_updateEarningPoints($address);
     Mage::dispatchEvent('rewardpoints_collect_earning_total_points_after', array('address' => $address));
     return $this;
 }
开发者ID:kanotest15,项目名称:cbmagento,代码行数:36,代码来源:Earning.php

示例5: _prepareCustomerQuote

 /**
  * Prepare quote customer address information and set the customer on the quote
  *
  * @return self
  */
 protected function _prepareCustomerQuote()
 {
     $shipping = $this->_quote->isVirtual() ? null : $this->_quote->getShippingAddress();
     $customer = $this->_getCustomerSession()->getCustomer();
     $customerBilling = $this->_prepareCustomerBilling($customer);
     if ($shipping) {
         $customerShipping = $this->_prepareCustomerShipping($customer, $shipping);
         if ($customerBilling && !$customer->getDefaultShipping() && $shipping->getSameAsBilling()) {
             $customerBilling->setIsDefaultShipping(true);
         } elseif (isset($customerShipping) && !$customer->getDefaultShipping()) {
             $customerShipping->setIsDefaultShipping(true);
         }
     }
     $this->_quote->setCustomer($customer);
     return $this;
 }
开发者ID:adderall,项目名称:magento-retail-order-management,代码行数:21,代码来源:Checkout.php

示例6: savePayment

 /**
  * Specify quote payment method
  *
  * @param array $data
  * @return array
  */
 public function savePayment($data)
 {
     if ($this->_quote->isVirtual()) {
         $this->_quote->getBillingAddress()->setPaymentMethod($this->_methodType);
     } else {
         $this->_quote->getShippingAddress()->setPaymentMethod($this->_methodType);
     }
     $payment = $this->_quote->getPayment();
     $data['method'] = $this->_methodType;
     $payment->importData($data);
     $email = isset($data['payer']) ? $data['payer'] : null;
     $payment->setAdditionalInformation(self::PAYMENT_INFO_PAYER_EMAIL, $email);
     $payment->setAdditionalInformation(self::PAYMENT_INFO_TRANSACTION_ID, isset($data['transaction_id']) ? $data['transaction_id'] : null);
     $this->_quote->setCustomerEmail($email);
     $this->_quote->collectTotals()->save();
     return array();
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:23,代码来源:Checkout.php

示例7: prepareCollection

 /**
  * Convert the resource model collection to an array
  *
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return array
  */
 public function prepareCollection(Mage_Sales_Model_Quote $quote)
 {
     if ($quote->isVirtual()) {
         return [];
     }
     // Store current state
     $actionType = $this->getActionType();
     $operation = $this->getOperation();
     // Change state
     $this->setActionType(self::ACTION_TYPE_COLLECTION);
     $this->setOperation(self::OPERATION_RETRIEVE);
     $data = [];
     // Load and prep shipping address
     $address = $quote->getShippingAddress();
     $address->setCollectShippingRates(true);
     $address->collectShippingRates();
     $address->save();
     // Load rates
     /** @var Mage_Sales_Model_Resource_Quote_Address_Rate_Collection $rateCollection */
     $rateCollection = $address->getShippingRatesCollection();
     $rates = [];
     foreach ($rateCollection as $rate) {
         /** @var Mage_Sales_Model_Quote_Address_Rate $rate */
         if (!$rate->isDeleted() && $rate->getCarrierInstance()) {
             $rates[] = $rate;
         }
     }
     uasort($rates, [$this, 'sortRates']);
     // Get filter
     $filter = $this->getFilter();
     // Prepare rates
     foreach ($rates as $rate) {
         /** @var Mage_Sales_Model_Quote_Address_Rate $rate */
         $data[] = $this->prepareRate($rate, $filter);
     }
     // Restore old state
     $this->setActionType($actionType);
     $this->setOperation($operation);
     // Return prepared outbound data
     return $data;
 }
开发者ID:aoepeople,项目名称:aoe_cartapi,代码行数:48,代码来源:ShippingMethod.php

示例8: savePayment

 /**
  * Specify quote payment method
  *
  * @param   array $data
  * @return  array
  */
 public function savePayment($data)
 {
     if ($this->_quote->isVirtual()) {
         $this->_quote->getBillingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
     } else {
         $this->_quote->getShippingAddress()->setPaymentMethod(isset($data['method']) ? $data['method'] : null);
     }
     // shipping totals may be affected by payment method
     if (!$this->_quote->isVirtual() && $this->_quote->getShippingAddress()) {
         $this->_quote->getShippingAddress()->setCollectShippingRates(true);
     }
     //        $data['checks'] = Mage_Payment_Model_Method_Abstract::CHECK_USE_CHECKOUT
     //            | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_COUNTRY
     //            | Mage_Payment_Model_Method_Abstract::CHECK_USE_FOR_CURRENCY
     //            | Mage_Payment_Model_Method_Abstract::CHECK_ORDER_TOTAL_MIN_MAX
     //            | Mage_Payment_Model_Method_Abstract::CHECK_ZERO_TOTAL;
     $data['checks'] = array();
     $payment = $this->_quote->getPayment();
     $payment->importData($data);
     $this->_quote->save();
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:27,代码来源:Checkout.php

示例9: getQuoteBaseTotal

 /**
  * Changed By Adam 06/11/2014: Fix bug hidden tax
  * pre collect total for quote/address and return quote total
  * 
  * @param Mage_Sales_Model_Quote $quote
  * @param null|Mage_Sales_Model_Quote_Address $address
  * @return float
  */
 public function getQuoteBaseTotal($quote, $address = null)
 {
     $cacheKey = 'quote_base_total';
     if ($this->hasCache($cacheKey)) {
         return $this->getCache($cacheKey);
     }
     if (is_null($address)) {
         if ($quote->isVirtual()) {
             $address = $quote->getBillingAddress();
         } else {
             $address = $quote->getShippingAddress();
         }
     }
     $baseTotal = 0;
     foreach ($address->getAllItems() as $item) {
         if ($item->getParentItemId()) {
             continue;
         }
         if ($item->getHasChildren() && $item->isChildrenCalculated()) {
             foreach ($item->getChildren() as $child) {
                 $baseTotal += $item->getQty() * ($child->getQty() * $this->_getItemBasePrice($child)) - $child->getBaseDiscountAmount() - $child->getMagestoreBaseDiscount();
             }
         } elseif ($item->getProduct()) {
             $baseTotal += $item->getQty() * $this->_getItemBasePrice($item) - $item->getBaseDiscountAmount() - $item->getMagestoreBaseDiscount();
         }
     }
     //        if (Mage::getStoreConfig(self::XML_PATH_SPEND_FOR_SHIPPING, $quote->getStoreId())) {
     //            $shippingAmount = $address->getShippingAmountForDiscount();
     //            if ($shippingAmount !== null) {
     //                $baseShippingAmount = $address->getBaseShippingAmountForDiscount();
     //            } else {
     //                $baseShippingAmount = $address->getBaseShippingAmount();
     //            }
     //            $baseTotal += $baseShippingAmount - $address->getBaseShippingDiscountAmount() - $address->getMagestoreBaseDiscountForShipping();
     //        }
     $this->saveCache($cacheKey, $baseTotal);
     return $baseTotal;
 }
开发者ID:cabrerabywaters,项目名称:magentoSunshine,代码行数:46,代码来源:Spending.php

示例10: getDisabledSectionHash

 /**
  * Get disabled steps
  * @param Mage_Sales_Model_Quote $quote checkout quote
  * @return array
  */
 public function getDisabledSectionHash($quote)
 {
     if (Mage::registry('bDisabledSectionRegistered')) {
         return Mage::registry('disabledSectionHash');
     }
     $originalCodes = array('shipping', 'shipping_method', 'payment');
     if ($quote->isVirtual()) {
         $originalCodes = array('payment');
     }
     $disabledSectionHash = array();
     foreach ($originalCodes as $stepKey) {
         if (!Mage::getStoreConfig('aitconfcheckout/' . $stepKey . '/active')) {
             $needForDisable = true;
             if ($stepKey == 'shipping_method') {
                 $needForDisable = $this->_getShippingMethods();
             } elseif ($stepKey == 'payment') {
                 $needForDisable = $this->_getPaymentMethods($quote);
             }
             if ($needForDisable) {
                 $disabledSectionHash[] = $stepKey;
             }
         }
     }
     /* {#AITOC_COMMENT_END#}
             $iStoreId = Mage::app()->getStore()->getId();
             $iSiteId  = Mage::app()->getWebsite()->getId();
     
             $performer = Aitoc_Aitsys_Abstract_Service::get()->platform()->getModule('Aitoc_Aitconfcheckout')->getLicense()->getPerformer();
             $ruler     = $performer->getRuler();
             if (!($ruler->checkRule('store', $iStoreId, 'store') || $ruler->checkRule('store', $iSiteId, 'website')))
             {
                 $disabledSectionHash = array();
             }
             {#AITOC_COMMENT_START#} */
     Mage::register('disabledSectionHash', $disabledSectionHash);
     Mage::register('bDisabledSectionRegistered', true);
     return $disabledSectionHash;
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:43,代码来源:Aitconfcheckout.php

示例11: CreateMagentoShopRequest


//.........这里部分代码省略.........
         $request->setGender($g);
         Mage::getSingleton('checkout/session')->setData('gender_amasty', $g);
     }
     if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && !empty($_POST["billing"]["prefix"])) {
         if (strtolower($_POST["billing"]["prefix"]) == 'herr') {
             $request->setGender('1');
             Mage::getSingleton('checkout/session')->setData('gender_amasty', '1');
         } else {
             if (strtolower($_POST["billing"]["prefix"]) == 'frau') {
                 $request->setGender('2');
                 Mage::getSingleton('checkout/session')->setData('gender_amasty', '2');
             }
         }
     }
     $extraInfo["Name"] = 'ORDERCLOSED';
     $extraInfo["Value"] = 'NO';
     $request->setExtraInfo($extraInfo);
     $extraInfo["Name"] = 'ORDERAMOUNT';
     $extraInfo["Value"] = number_format($quote->getGrandTotal(), 2, '.', '');
     $request->setExtraInfo($extraInfo);
     $extraInfo["Name"] = 'ORDERCURRENCY';
     $extraInfo["Value"] = $quote->getBaseCurrencyCode();
     $request->setExtraInfo($extraInfo);
     $extraInfo["Name"] = 'IP';
     $extraInfo["Value"] = $this->getClientIp();
     $request->setExtraInfo($extraInfo);
     $sesId = Mage::getSingleton('checkout/session')->getData("byjuno_session_id");
     if (Mage::getStoreConfig('byjuno/api/tmxenabled', Mage::app()->getStore()) == 'enable' && !empty($sesId)) {
         $extraInfo["Name"] = 'DEVICE_FINGERPRINT_ID';
         $extraInfo["Value"] = Mage::getSingleton('checkout/session')->getData("byjuno_session_id");
         $request->setExtraInfo($extraInfo);
     }
     /* shipping information */
     if (!$quote->isVirtual()) {
         $extraInfo["Name"] = 'DELIVERY_FIRSTNAME';
         $extraInfo["Value"] = $quote->getShippingAddress()->getFirstname();
         if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && empty($_POST["shipping"]["same_as_billing"])) {
             if (!empty($_POST["shipping"]["firstname"])) {
                 $extraInfo["Value"] = $_POST["shipping"]["firstname"];
             }
         }
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_LASTNAME';
         $extraInfo["Value"] = $quote->getShippingAddress()->getLastname();
         if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && empty($_POST["shipping"]["same_as_billing"])) {
             if (!empty($_POST["shipping"]["lastname"])) {
                 $extraInfo["Value"] = $_POST["shipping"]["lastname"];
             }
         }
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_FIRSTLINE';
         $extraInfo["Value"] = trim($quote->getShippingAddress()->getStreetFull());
         if (Mage::getStoreConfig('byjuno/api/plugincheckouttype', Mage::app()->getStore()) == 'amasty' && empty($_POST["shipping"]["same_as_billing"])) {
             $extraInfo["Value"] = '';
             if (!empty($_POST["shipping"]["street"][0])) {
                 $extraInfo["Value"] = $_POST["shipping"]["street"][0];
             }
             if (!empty($_POST["shipping"]["street"][1])) {
                 $extraInfo["Value"] .= ' ' . $_POST["shipping"]["street"][1];
             }
             $extraInfo["Value"] = trim($extraInfo["Value"]);
         }
         $request->setExtraInfo($extraInfo);
         $extraInfo["Name"] = 'DELIVERY_HOUSENUMBER';
         $extraInfo["Value"] = '';
         $request->setExtraInfo($extraInfo);
开发者ID:istgin,项目名称:Byjuno,代码行数:67,代码来源:Observer.php

示例12: _prepareCustomerQuote

 /**
  * Prepare quote for customer order submit
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return Mage_Checkout_Model_Api_Resource_Customer
  */
 protected function _prepareCustomerQuote(Mage_Sales_Model_Quote $quote)
 {
     $billing = $quote->getBillingAddress();
     $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
     $customer = $quote->getCustomer();
     if (!$billing->getCustomerId() || $billing->getSaveInAddressBook()) {
         $customerBilling = $billing->exportCustomerAddress();
         $customer->addAddress($customerBilling);
         $billing->setCustomerAddress($customerBilling);
     }
     if ($shipping && (!$shipping->getCustomerId() && !$shipping->getSameAsBilling() || !$shipping->getSameAsBilling() && $shipping->getSaveInAddressBook())) {
         $customerShipping = $shipping->exportCustomerAddress();
         $customer->addAddress($customerShipping);
         $shipping->setCustomerAddress($customerShipping);
     }
     if (isset($customerBilling) && !$customer->getDefaultBilling()) {
         $customerBilling->setIsDefaultBilling(true);
     }
     if ($shipping && isset($customerShipping) && !$customer->getDefaultShipping()) {
         $customerShipping->setIsDefaultShipping(true);
     } else {
         if (isset($customerBilling) && !$customer->getDefaultShipping()) {
             $customerBilling->setIsDefaultShipping(true);
         }
     }
     $quote->setCustomer($customer);
     return $this;
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:34,代码来源:Customer.php

示例13: isAllowedBillSafe

 /**
  * BillSAFE does not allow:
  * - virtual quotes
  * - differing shipping/billing address
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 protected function isAllowedBillSafe(Mage_Sales_Model_Quote $quote)
 {
     if ($quote->isVirtual()) {
         return false;
     }
     $billingAddress = $quote->getBillingAddress();
     $shippingAddress = $quote->getShippingAddress();
     if (!$shippingAddress->getSameAsBilling()) {
         // Double check, in case the customer has chosen to enter a separate shipping address, but filled in the same values as in billing address:
         if (!$this->helper()->addressesAreEqual($billingAddress, $shippingAddress)) {
             return false;
         }
     }
     return true;
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:23,代码来源:SafeInvoice.php

示例14: mustCheckAddress

 /**
  * checks if an addresscheck must be performed
  *
  * @param $addressType
  * @param Payone_Core_Model_Config_Protect_AddressCheck $config
  * @param Mage_Sales_Model_Quote $quote
  * @param $useForShipping
  * @return bool
  */
 protected function mustCheckAddress($addressType, Payone_Core_Model_Config_Protect_AddressCheck $config, Mage_Sales_Model_Quote $quote, $useForShipping)
 {
     // check if address is shipping-address an shipping-address has to be checked
     if ($addressType === 'shipping' && !$this->_alreadyCheckedAndChangeWasDenied($addressType) && $config->mustCheckShipping()) {
         return true;
     }
     // check if address is billing-address
     if ($addressType === 'billing' && !$this->_alreadyCheckedAndChangeWasDenied($addressType)) {
         // check if billing-address has to be checked
         if ($config->mustCheckBilling()) {
             return true;
         }
         // check if billing-address is used for shipping address and shipping-address has to be checked
         if ($useForShipping === true and $config->mustCheckShipping() and !$quote->isVirtual()) {
             return true;
         }
         // check if billing-address has to be checked for virtual order
         if ($quote->isVirtual() and $config->mustCheckBillingForVirtualOrder()) {
             return true;
         }
     }
     return false;
 }
开发者ID:kirchbergerknorr,项目名称:Payone_Core,代码行数:32,代码来源:Address.php

示例15: getFeeConfigForQuote

 /**
  * @param Mage_Sales_Model_Quote $quote
  * @return array|bool
  */
 public function getFeeConfigForQuote(Mage_Sales_Model_Quote $quote)
 {
     // No handling fee for virtual quotes
     if ($quote->isVirtual()) {
         return false;
     }
     $shippingAddress = $quote->getShippingAddress();
     $country = $shippingAddress->getCountry();
     $shippingMethod = $shippingAddress->getShippingMethod();
     $feeConfigs = $this->getFeeConfig();
     if (!is_array($feeConfigs)) {
         return false;
     }
     foreach ($feeConfigs as $key => $feeConfig) {
         if (in_array($shippingMethod, $feeConfig['shipping_method']) === false) {
             unset($feeConfigs[$key]);
             continue;
         }
         if (array_key_exists('countries', $feeConfig) and in_array($country, $feeConfig['countries']) === false) {
             unset($feeConfigs[$key]);
             continue;
         }
     }
     if (count($feeConfigs) > 0) {
         return array_shift($feeConfigs);
     } else {
         return false;
     }
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:33,代码来源:Method.php


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