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


PHP Quote::getIsVirtual方法代码示例

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


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

示例1: updateQuoteAddress

 /**
  * Update quote address
  *
  * @param Quote $quote
  * @param array $details
  * @return void
  */
 private function updateQuoteAddress(Quote $quote, array $details)
 {
     if (!$quote->getIsVirtual()) {
         $this->updateShippingAddress($quote, $details);
     }
     $this->updateBillingAddress($quote, $details);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:14,代码来源:QuoteUpdater.php

示例2: _beforeToHtml

 /**
  * Retrieve payment method and assign additional template values
  *
  * @return $this
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 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;
                     }
                 }
             }
         }
         $canEditShippingAddress = $this->_quote->getMayEditShippingAddress() && $this->_quote->getPayment()->getAdditionalInformation(\Magento\Paypal\Model\Express\Checkout::PAYMENT_INFO_BUTTON) == 1;
         // misc shipping parameters
         $this->setShippingMethodSubmitUrl($this->getUrl("{$this->_controllerPath}/saveShippingMethod"))->setCanEditShippingAddress($canEditShippingAddress)->setCanEditShippingMethod($this->_quote->getMayEditShippingMethod());
     }
     $this->setEditUrl($this->getUrl("{$this->_controllerPath}/edit"))->setPlaceOrderUrl($this->getUrl("{$this->_controllerPath}/placeOrder"));
     return parent::_beforeToHtml();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:36,代码来源:Review.php

示例3: populateQuoteAddress

 /**
  * @param \Magento\Quote\Model\Quote $quote
  * @param array $details
  * @return $this
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function populateQuoteAddress($quote, $details)
 {
     // import shipping address
     $exportedShippingAddress = isset($details['shippingAddress']) ? $details['shippingAddress'] : null;
     if (!$quote->getIsVirtual()) {
         $shippingAddress = $quote->getShippingAddress();
         if ($exportedShippingAddress) {
             $this->importAddressData($shippingAddress, $exportedShippingAddress);
         }
         // PayPal doesn't provide detailed shipping info: prefix, suffix
         $shippingAddress->setLastname($details['lastName']);
         $shippingAddress->setFirstname($details['firstName']);
         $shippingAddress->setEmail($details['email']);
         $shippingAddress->setCollectShippingRates(true);
     }
     $exportedBillingAddress = isset($details['billingAddress']) ? $details['billingAddress'] : null;
     $billingAddress = $quote->getBillingAddress();
     if ($exportedBillingAddress) {
         $this->importBillingAddressData($billingAddress, $exportedBillingAddress);
         $billingAddress->setFirstname($details['firstName']);
         $billingAddress->setLastname($details['lastName']);
         $billingAddress->setEmail($details['email']);
     } elseif ($billingAddress->getEmail() == null) {
         $this->importAddressData($billingAddress, $exportedShippingAddress);
         $billingAddress->setFirstname($details['firstName']);
         $billingAddress->setLastname($details['lastName']);
         $billingAddress->setEmail($details['email']);
     }
     return $this;
 }
开发者ID:nja78,项目名称:magento2,代码行数:36,代码来源:Checkout.php

示例4: _ignoreAddressValidation

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

示例5: disabledQuoteAddressValidation

 /**
  * Make sure addresses will be saved without validation errors
  *
  * @param Quote $quote
  * @return void
  */
 protected function disabledQuoteAddressValidation(Quote $quote)
 {
     $billingAddress = $quote->getBillingAddress();
     $billingAddress->setShouldIgnoreValidation(true);
     if (!$quote->getIsVirtual()) {
         $shippingAddress = $quote->getShippingAddress();
         $shippingAddress->setShouldIgnoreValidation(true);
         if (!$billingAddress->getEmail()) {
             $billingAddress->setSameAsBilling(1);
         }
     }
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:18,代码来源:AbstractHelper.php

示例6: setShippingOptions

 /**
  * Set shipping options to api
  * @param \Magento\Paypal\Model\Cart $cart
  * @param \Magento\Quote\Model\Quote\Address|null $address
  * @return void
  */
 private function setShippingOptions(PaypalCart $cart, Address $address = null)
 {
     // for included tax always disable line items (related to paypal amount rounding problem)
     $this->_api->setIsLineItemsEnabled($this->_config->getValue(PaypalConfig::TRANSFER_CART_LINE_ITEMS));
     // add shipping options if needed and line items are available
     $cartItems = $cart->getAllItems();
     if ($this->_config->getValue(PaypalConfig::TRANSFER_CART_LINE_ITEMS) && $this->_config->getValue(PaypalConfig::TRANSFER_SHIPPING_OPTIONS) && !empty($cartItems)) {
         if (!$this->_quote->getIsVirtual()) {
             $options = $this->_prepareShippingOptions($address, true);
             if ($options) {
                 $this->_api->setShippingOptionsCallbackUrl($this->_coreUrl->getUrl('*/*/shippingOptionsCallback', ['quote_id' => $this->_quote->getId()]))->setShippingOptions($options);
             }
         }
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:21,代码来源:Checkout.php

示例7: execute

 /**
  * Execute operation
  *
  * @param string $shippingMethod
  * @param Quote $quote
  * @return void
  * @throws \InvalidArgumentException
  */
 public function execute($shippingMethod, Quote $quote)
 {
     if (empty($shippingMethod)) {
         throw new \InvalidArgumentException('The "shippingMethod" field does not exists.');
     }
     if (!$quote->getIsVirtual()) {
         $shippingAddress = $quote->getShippingAddress();
         if ($shippingMethod !== $shippingAddress->getShippingMethod()) {
             $this->disabledQuoteAddressValidation($quote);
             $shippingAddress->setShippingMethod($shippingMethod);
             $shippingAddress->setCollectShippingRates(true);
             $quote->collectTotals();
             $this->quoteRepository->save($quote);
         }
     }
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:24,代码来源:ShippingMethodUpdater.php

示例8: getTaxContainer

 /**
  * {@inheritdoc}
  */
 public function getTaxContainer()
 {
     return $this->_salesModel->getIsVirtual() ? $this->_salesModel->getBillingAddress() : $this->_salesModel->getShippingAddress();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:Quote.php


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