当前位置: 首页>>代码示例>>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;未经允许,请勿转载。