本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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]);
}
示例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);
}