本文整理汇总了PHP中Magento\Checkout\Model\Session::setQuoteId方法的典型用法代码示例。如果您正苦于以下问题:PHP Session::setQuoteId方法的具体用法?PHP Session::setQuoteId怎么用?PHP Session::setQuoteId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Checkout\Model\Session
的用法示例。
在下文中一共展示了Session::setQuoteId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testCancelAction
/**
* @magentoDataFixture Magento/Paypal/_files/quote_payment_standard.php
* @magentoConfigFixture current_store payment/paypal_standard/active 1
* @magentoConfigFixture current_store paypal/general/business_account merchant_2012050718_biz@example.com
*/
public function testCancelAction()
{
$quote = $this->_objectManager->create('Magento\\Sales\\Model\\Quote');
$quote->load('test01', 'reserved_order_id');
$this->_session->setQuoteId($quote->getId());
$this->_session->setPaypalStandardQuoteId($quote->getId())->setLastRealOrderId('100000002');
$this->dispatch('paypal/standard/cancel');
$this->_order->load('100000002', 'increment_id');
$this->assertEquals('canceled', $this->_order->getState());
$this->assertEquals($this->_session->getQuote()->getGrandTotal(), $quote->getGrandTotal());
$this->assertEquals($this->_session->getQuote()->getItemsCount(), $quote->getItemsCount());
}
示例3: save
/**
* Save cart
*
* @return $this
*/
public function save()
{
$this->_eventManager->dispatch('checkout_cart_save_before', array('cart' => $this));
$this->getQuote()->getBillingAddress();
$this->getQuote()->getShippingAddress()->setCollectShippingRates(true);
$this->getQuote()->collectTotals();
$this->getQuote()->save();
$this->_checkoutSession->setQuoteId($this->getQuote()->getId());
/**
* Cart save usually called after changes with cart items.
*/
$this->_eventManager->dispatch('checkout_cart_save_after', array('cart' => $this));
return $this;
}