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


PHP Mage_Sales_Model_Quote::getShippingAddress方法代码示例

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


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

示例1: getAddress

 /**
  * Return address base on quote shipping address
  *
  * @return Mage_Sales_Quote_Address
  */
 public function getAddress()
 {
     if (empty($this->_address)) {
         $this->_address = $this->_quote->getShippingAddress();
     }
     return $this->_address;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:12,代码来源:Review.php

示例2: 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

示例3: _ignoreAddressValidation

 /**
  * Make sure addresses will be saved without validation errors
  */
 private function _ignoreAddressValidation()
 {
     $this->_quote->getBillingAddress()->setShouldIgnoreValidation(true);
     if (!$this->_quote->getIsVirtual()) {
         $this->_quote->getShippingAddress()->setShouldIgnoreValidation(true);
     }
 }
开发者ID:xiaoguizhidao,项目名称:mydigibits,代码行数:10,代码来源:PaypalexpressController.php

示例4: 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

示例5: getProductTaxRate

 private function getProductTaxRate()
 {
     /** @var $taxCalculator Mage_Tax_Model_Calculation */
     $taxCalculator = Mage::getSingleton('tax/calculation');
     $request = $taxCalculator->getRateRequest($this->quote->getShippingAddress(), $this->quote->getBillingAddress(), $this->quote->getCustomerTaxClassId(), $this->quote->getStore());
     $request->setProductClassId($this->getProduct()->getTaxClassId());
     return $taxCalculator->getRate($request);
 }
开发者ID:ReeceCrossland,项目名称:essua-m2epro,代码行数:8,代码来源:Item.php

示例6: getCurrentRateCode

 public function getCurrentRateCode()
 {
     $postCode = $this->_quote->getShippingAddress()->getPostcode();
     if (Mage::getStoreConfig('payment/ewayrapid_general/connection_type') === Eway_Rapid31_Model_Config::CONNECTION_SHARED_PAGE) {
         $sharedpageModel = Mage::getModel('ewayrapid/request_sharedpage', array('quote' => $this->_quote));
         return $sharedpageModel->getShippingByCode($postCode);
     } elseif (Mage::getStoreConfig('payment/ewayrapid_general/connection_type') === Eway_Rapid31_Model_Config::CONNECTION_TRANSPARENT) {
         $transModel = Mage::getModel('ewayrapid/request_transparent');
         return $transModel->getShippingByCode($this->_quote, $postCode);
     }
     return false;
 }
开发者ID:programmerrahul,项目名称:vastecom,代码行数:12,代码来源:PaypalReview.php

示例7: _beforeToHtml

 /**
  * Retrieve payment method and assign additional template values
  *
  * @return EbayEnterprise_Paypal_Block_Express_Review
  */
 protected function _beforeToHtml()
 {
     $methodInstance = $this->_quote->getPayment()->getMethodInstance();
     $this->setPaymentMethodTitle($methodInstance->getTitle());
     $this->setShippingRateRequired(true);
     if ($this->_quote->getIsVirtual()) {
         $this->setShippingRateRequired(false);
     } else {
         // prepare shipping rates
         $this->_address = $this->_quote->getShippingAddress();
         $groups = $this->_address->getGroupedAllShippingRates();
         if ($groups && $this->_address) {
             $this->setShippingRateGroups($groups);
             // determine current selected code & name
             foreach ($groups as $rates) {
                 foreach ($rates as $rate) {
                     if ($this->_address->getShippingMethod() == $rate->getCode()) {
                         $this->_currentShippingRate = $rate;
                         break 2;
                     }
                 }
             }
         }
         $canEditShippingAddress = $this->_quote->getMayEditShippingAddress() && $this->_quote->getPayment()->getAdditionalInformation(EbayEnterprise_PayPal_Model_Express_Checkout::PAYMENT_INFO_BUTTON) == 1;
         // misc shipping parameters
         $this->setShippingMethodSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/checkout/saveShippingMethod"))->setCanEditShippingAddress($canEditShippingAddress)->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod());
     }
     $this->setEditUrl($this->getUrl("{$this->_paypalActionPrefix}/checkout/edit"))->setPlaceOrderUrl($this->getUrl("{$this->_paypalActionPrefix}/checkout/placeOrder"));
     return parent::_beforeToHtml();
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:35,代码来源:Review.php

示例8: _beforeToHtml

 /**
  * Retrieve payment method and assign additional template values
  *
  * @return Mage_Paypal_Block_Express_Review
  */
 protected function _beforeToHtml()
 {
     $methodInstance = $this->_quote->getPayment()->getMethodInstance();
     $this->setPaymentMethodTitle($methodInstance->getTitle());
     $this->setUpdateOrderSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/updateOrder"));
     $this->setUpdateShippingMethodsUrl($this->getUrl("{$this->_paypalActionPrefix}/express/updateShippingMethods"));
     $this->setShippingRateRequired(true);
     if ($this->_quote->getIsVirtual()) {
         $this->setShippingRateRequired(false);
     } else {
         // prepare shipping rates
         $this->_address = $this->_quote->getShippingAddress();
         $groups = $this->_address->getGroupedAllShippingRates();
         if ($groups && $this->_address) {
             $this->setShippingRateGroups($groups);
             // determine current selected code & name
             foreach ($groups as $code => $rates) {
                 foreach ($rates as $rate) {
                     if ($this->_address->getShippingMethod() == $rate->getCode()) {
                         $this->_currentShippingRate = $rate;
                         break 2;
                     }
                 }
             }
         }
         // misc shipping parameters
         $this->setShippingMethodSubmitUrl($this->getUrl("{$this->_paypalActionPrefix}/express/saveShippingMethod"))->setCanEditShippingAddress($this->_quote->getMayEditShippingAddress())->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod());
     }
     $this->setEditUrl($this->getUrl("{$this->_paypalActionPrefix}/express/edit"))->setPlaceOrderUrl($this->getUrl("{$this->_paypalActionPrefix}/express/placeOrder"));
     return parent::_beforeToHtml();
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:36,代码来源:Review.php

示例9: _beforeToHtml

 /**
  * Retrieve payment method and assign additional template values
  *
  * @return Mage_Paypal_Block_Express_Review
  */
 protected function _beforeToHtml()
 {
     $methodInstance = $this->_quote->getPayment()->getMethodInstance();
     $this->setPaymentMethodTitle($methodInstance->getTitle());
     $this->setShippingRateRequired(true);
     if ($this->_quote->getIsVirtual()) {
         $this->setShippingRateRequired(false);
     } else {
         // prepare shipping rates
         $this->_address = $this->_quote->getShippingAddress();
         $groups = $this->_address->getGroupedAllShippingRates();
         if ($groups && $this->_address) {
             $this->setShippingRateGroups($groups);
             // determine current selected code & name
             foreach ($groups as $code => $rates) {
                 foreach ($rates as $rate) {
                     if ($this->_address->getShippingMethod() == $rate->getCode()) {
                         $this->_currentShippingRate = $rate;
                         break 2;
                     }
                 }
             }
         }
     }
     return parent::_beforeToHtml();
 }
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:31,代码来源:Review.php

示例10: 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

示例11: validateAlias

 /**
  * Validates alias for in quote provided addresses
  * @param Mage_Sales_Model_Quote $quote
  * @param Varien_Object $payment
  * @throws Mage_Core_Exception
  */
 protected function validateAlias($quote, $payment)
 {
     $alias = $payment->getAdditionalInformation('alias');
     if (0 < strlen(trim($alias)) && is_numeric($payment->getAdditionalInformation('cvc')) && false === Mage::helper('ops/alias')->isAliasValidForAddresses($quote->getCustomerId(), $alias, $quote->getBillingAddress(), $quote->getShippingAddress(), $quote->getStoreId())) {
         $this->getOnepage()->getCheckout()->setGotoSection('payment');
         Mage::throwException($this->getHelper()->__('Invalid payment information provided!'));
     }
 }
开发者ID:roshu1980,项目名称:add-computers,代码行数:14,代码来源:Cc.php

示例12: _placeOrder

 protected function _placeOrder($checkoutMessage, $orderStatus = 'pending', $notifyCreateOrder = false)
 {
     $this->_quote->collectTotals();
     $this->_quote->reserveOrderId();
     error_reporting(E_ERROR);
     $service = Mage::getModel('sales/service_quote', $this->_quote);
     // If file not exist may catch warring
     error_reporting(E_ALL);
     if ($service != false && method_exists($service, 'submitAll')) {
         // Magento version 1.4.1.x
         //  $service = Mage::getModel('sales/service_quote', $quote);
         $service->submitAll();
         $orderObj = $service->getOrder();
     } else {
         // Magento version 1.4.0.x , 1.3.x
         $convertQuoteObj = Mage::getSingleton('sales/convert_quote');
         $orderObj = $convertQuoteObj->addressToOrder($this->_quote->getShippingAddress());
         $orderObj->setBillingAddress($convertQuoteObj->addressToOrderAddress($this->_quote->getBillingAddress()));
         $orderObj->setShippingAddress($convertQuoteObj->addressToOrderAddress($this->_quote->getShippingAddress()));
         $orderObj->setPayment($convertQuoteObj->paymentToOrderPayment($this->_quote->getPayment()));
         $items = $this->_quote->getShippingAddress()->getAllItems();
         foreach ($items as $item) {
             //@var $item Mage_Sales_Model_Quote_Item
             $orderItem = $convertQuoteObj->itemToOrderItem($item);
             if ($item->getParentItem()) {
                 $orderItem->setParentItem($orderObj->getItemByQuoteItemId($item->getParentItem()->getId()));
             }
             $orderObj->addItem($orderItem);
         }
         $orderObj->setCanShipPartiallyItem(false);
         $orderObj->place();
     }
     $orderMessages = '';
     $notifyMessages = $this->_processNotifyMessage();
     if ($checkoutMessage || $notifyMessages) {
         $orderMessages .= '<br /><b><u>' . Mage::helper('M2ePro')->__('M2E Pro Notes') . ':</u></b><br /><br />';
         if ($checkoutMessage) {
             $orderMessages .= '<b>' . Mage::helper('M2ePro')->__('Checkout Message From Buyer') . ':</b>';
             $orderMessages .= $checkoutMessage . '<br />';
         }
         if ($notifyMessages) {
             $orderMessages .= $notifyMessages;
         }
     }
     // Adding notification to order
     $orderObj->addStatusToHistory($orderStatus, $orderMessages, false);
     $orderObj->save();
     // --------------------
     Mage::helper('M2ePro/Module')->getConfig()->setGroupValue('/synchronization/orders/', 'current_magento_order_id', $orderObj->getId());
     $this->setFatalErrorHandler();
     // --------------------
     // Send Notification to customer after create order
     if ($notifyCreateOrder) {
         // Send new order E-mail only if select such mode
         $orderObj->sendNewOrderEmail();
     }
     return $orderObj;
 }
开发者ID:par-orillonsoft,项目名称:app,代码行数:58,代码来源:Order.php

示例13: getDiscountData

 /**
  * Gets the total discount from $quote
  * inkl. and excl. tax
  * Data is returned as a Varien_Object with these data-keys set:
  *  - discount_incl_tax
  *  - discount_excl_tax
  *
  *
  * @param Mage_Sales_Model_Quote $quote
  *
  * @return Varien_Object
  */
 public function getDiscountData(Mage_Sales_Model_Quote $quote)
 {
     // if catalog-prices includes tax
     $CatPriceIncl = Mage::getStoreConfig(Mage_Tax_Model_Config::CONFIG_XML_PATH_PRICE_INCLUDES_TAX);
     /** @var Mage_Sales_Model_Quote_Address $shippingAddress */
     $shippingAddress = $quote->getShippingAddress();
     $discountIncl = 0;
     $discountExcl = 0;
     // find discount on the items
     foreach ($quote->getItemsCollection() as $item) {
         /** @var Mage_Sales_Model_Quote_Item $item */
         if (!$CatPriceIncl) {
             $discountExcl += $item->getDiscountAmount();
             $discountIncl += $item->getDiscountAmount() * ($item->getTaxPercent() / 100 + 1);
         } else {
             $discountExcl += $item->getDiscountAmount() / ($item->getTaxPercent() / 100 + 1);
             $discountIncl += $item->getDiscountAmount();
         }
     }
     // find out tax-rate for the shipping
     if ((double) $shippingAddress->getShippingInclTax() && (double) $shippingAddress->getShippingAmount()) {
         $shippingTaxRate = $shippingAddress->getShippingInclTax() / $shippingAddress->getShippingAmount();
     } else {
         $shippingTaxRate = 1;
     }
     // how much differs between $discountExcl and total discount?
     // (the difference is due to discount on the shipping)
     if (!$CatPriceIncl) {
         $shippingDiscount = abs($quote->getShippingAddress()->getDiscountAmount()) - $discountExcl;
     } else {
         $shippingDiscount = abs($quote->getShippingAddress()->getDiscountAmount()) - $discountIncl;
     }
     // apply/remove tax to shipping-discount
     if (!$CatPriceIncl) {
         $discountIncl += $shippingDiscount * $shippingTaxRate;
         $discountExcl += $shippingDiscount;
     } else {
         $discountIncl += $shippingDiscount;
         $discountExcl += $shippingDiscount / $shippingTaxRate;
     }
     $return = new Varien_Object();
     return $return->setDiscountInclTax($discountIncl)->setDiscountExclTax($discountExcl);
 }
开发者ID:AndreKlang,项目名称:Payex-Modules-Test,代码行数:55,代码来源:Discount.php

示例14: _ignoreAddressValidation

 /**
  * Make sure addresses will be saved without validation errors
  */
 private function _ignoreAddressValidation()
 {
     $this->_quote->getBillingAddress()->setShouldIgnoreValidation(true);
     if (!$this->_quote->getIsVirtual()) {
         $this->_quote->getShippingAddress()->setShouldIgnoreValidation(true);
         if (!$this->_config->requireBillingAddress && !$this->_quote->getBillingAddress()->getEmail()) {
             $this->_quote->getBillingAddress()->setSameAsBilling(1);
         }
     }
 }
开发者ID:ksaltik,项目名称:tooldexlive,代码行数:13,代码来源:Checkout.php

示例15: callGetTaxForQuote

 public function callGetTaxForQuote(Mage_Sales_Model_Quote $quote)
 {
     $request = $this->createTaxRequestFromQuoteAddress($quote->getShippingAddress());
     $request = $this->prepareGetTaxRequest($request);
     $errors = $this->validateTaxRequest($request);
     if (count($errors)) {
         return $errors;
     }
     return $this->call($quote->getStore(), '1.0/tax/get', $request);
 }
开发者ID:aoepeople,项目名称:aoe_avatax,代码行数:10,代码来源:RestApi.php


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