當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Quote::load方法代碼示例

本文整理匯總了PHP中Magento\Quote\Model\Quote::load方法的典型用法代碼示例。如果您正苦於以下問題:PHP Quote::load方法的具體用法?PHP Quote::load怎麽用?PHP Quote::load使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Quote\Model\Quote的用法示例。


在下文中一共展示了Quote::load方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 /**
  * @inheritdoc
  */
 public function setUp()
 {
     parent::setUp();
     $this->quote = $this->_objectManager->create('Magento\\Quote\\Model\\Quote');
     $this->checkoutSession = $this->_objectManager->get('Magento\\Checkout\\Model\\Session');
     $this->quote->load('test01', 'reserved_order_id');
     $this->checkoutSession->setQuoteId($this->quote->getId());
     $this->checkoutSession->setCartWasUpdated(false);
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:12,代碼來源:CheckoutTest.php

示例2: setUp

 /**
  * Initialize quote and customer fixtures
  */
 public function setUp()
 {
     $this->_quote = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Quote\\Model\\Quote');
     $this->_quote->load('test01', 'reserved_order_id');
     $this->_quote->setIsMultiShipping('0');
     $this->customerRepository = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Customer\\Api\\CustomerRepositoryInterface');
     $this->_customer = $this->customerRepository->getById(1);
     /** @var \Magento\Sales\Model\Order\Address $address */
     $this->_address = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Quote\\Model\\Quote\\Address');
     $this->_address->setId(1);
     $this->_address->load($this->_address->getId());
     $this->_address->setQuote($this->_quote);
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:16,代碼來源:AddressTest.php

示例3: testSetMethodWithoutShippingAddress

 /**
  * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
  */
 public function testSetMethodWithoutShippingAddress()
 {
     $this->quote->load('test_order_with_simple_product_without_address', 'reserved_order_id');
     $serviceInfo = $this->getServiceInfo();
     $requestData = ['cartId' => $this->quote->getId(), 'carrierCode' => 'flatrate', 'methodCode' => 'flatrate'];
     try {
         $this->_webApiCall($serviceInfo, $requestData);
     } catch (\SoapFault $e) {
         $message = $e->getMessage();
     } catch (\Exception $e) {
         $message = json_decode($e->getMessage())->message;
     }
     $this->assertEquals('Shipping address is not set', $message);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:17,代碼來源:ShippingMethodManagementTest.php

示例4: testGetListForMyCart

 /**
  * @magentoApiDataFixture Magento/Customer/_files/customer.php
  * @magentoApiDataFixture Magento/Checkout/_files/quote_with_address_saved.php
  */
 public function testGetListForMyCart()
 {
     $this->markTestSkipped('Will be fixed after MAGETWO-35573');
     $this->_markTestAsRestOnly();
     $this->quote->load('test_order_1', 'reserved_order_id');
     /** @var \Magento\Integration\Api\CustomerTokenServiceInterface $customerTokenService */
     $customerTokenService = $this->objectManager->create('Magento\\Integration\\Api\\CustomerTokenServiceInterface');
     $token = $customerTokenService->createCustomerAccessToken('customer@example.com', 'password');
     /** @var \Magento\Quote\Api\ShippingMethodManagementInterface $shippingMethodManagementService */
     $shippingMethodManagementService = $this->objectManager->create('Magento\\Quote\\Api\\ShippingMethodManagementInterface');
     $shippingMethodManagementService->set($this->quote->getId(), 'flatrate', 'flatrate');
     $serviceInfo = ['rest' => ['resourcePath' => '/V1/carts/mine/shipping-methods', 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, 'token' => $token]];
     $result = $this->_webApiCall($serviceInfo, []);
     $this->assertNotEmpty($result);
     $this->assertCount(1, $result);
     $shippingMethod = $shippingMethodManagementService->get($this->quote->getId());
     $expectedData = [ShippingMethodInterface::KEY_CARRIER_CODE => $shippingMethod->getCarrierCode(), ShippingMethodInterface::KEY_METHOD_CODE => $shippingMethod->getMethodCode(), ShippingMethodInterface::KEY_CARRIER_TITLE => $shippingMethod->getCarrierTitle(), ShippingMethodInterface::KEY_METHOD_TITLE => $shippingMethod->getMethodTitle(), ShippingMethodInterface::KEY_SHIPPING_AMOUNT => $shippingMethod->getAmount(), ShippingMethodInterface::KEY_BASE_SHIPPING_AMOUNT => $shippingMethod->getBaseAmount(), ShippingMethodInterface::KEY_AVAILABLE => $shippingMethod->getAvailable(), ShippingMethodInterface::KEY_ERROR_MESSAGE => null, ShippingMethodInterface::KEY_PRICE_EXCL_TAX => $shippingMethod->getPriceExclTax(), ShippingMethodInterface::KEY_PRICE_INCL_TAX => $shippingMethod->getPriceInclTax()];
     $this->assertEquals($expectedData, $result[0]);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:23,代碼來源:ShippingMethodManagementTest.php

示例5: testSetMethodWithoutShippingAddress

 /**
  * @magentoApiDataFixture Magento/Checkout/_files/quote_with_simple_product_saved.php
  */
 public function testSetMethodWithoutShippingAddress()
 {
     $this->quote->load('test_order_with_simple_product_without_address', 'reserved_order_id');
     $serviceInfo = $this->getServiceInfo();
     $cartId = $this->quote->getId();
     /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */
     $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Quote\\Model\\QuoteIdMaskFactory')->create();
     $quoteIdMask->load($cartId, 'quote_id');
     //Use masked cart Id
     $cartId = $quoteIdMask->getMaskedId();
     $requestData = ['cartId' => $cartId, 'carrierCode' => 'flatrate', 'methodCode' => 'flatrate'];
     try {
         $this->_webApiCall($serviceInfo, $requestData);
     } catch (\SoapFault $e) {
         $message = $e->getMessage();
     } catch (\Exception $e) {
         $message = json_decode($e->getMessage())->message;
     }
     $this->assertEquals('Shipping address is not set', $message);
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:23,代碼來源:GuestShippingMethodManagementTest.php


注:本文中的Magento\Quote\Model\Quote::load方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。