本文整理汇总了PHP中Magento\Quote\Model\QuoteRepository::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP QuoteRepository::delete方法的具体用法?PHP QuoteRepository::delete怎么用?PHP QuoteRepository::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Quote\Model\QuoteRepository
的用法示例。
在下文中一共展示了QuoteRepository::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDelete
public function testDelete()
{
$this->quoteMock->expects($this->once())->method('delete');
$this->quoteMock->expects($this->exactly(1))->method('getId')->willReturn(1);
$this->quoteMock->expects($this->exactly(1))->method('getCustomerId')->willReturn(2);
$this->model->delete($this->quoteMock);
}
示例2: loadCustomerQuote
/**
* Load data for customer quote and merge with current quote
*
* @return $this
*/
public function loadCustomerQuote()
{
if (!$this->_customerSession->getCustomerId()) {
return $this;
}
$this->_eventManager->dispatch('load_customer_quote_before', ['checkout_session' => $this]);
try {
$customerQuote = $this->quoteRepository->getForCustomer($this->_customerSession->getCustomerId());
} catch (\Magento\Framework\Exception\NoSuchEntityException $e) {
$customerQuote = $this->quoteRepository->create();
}
$customerQuote->setStoreId($this->_storeManager->getStore()->getId());
if ($customerQuote->getId() && $this->getQuoteId() != $customerQuote->getId()) {
if ($this->getQuoteId()) {
$this->quoteRepository->save($customerQuote->merge($this->getQuote())->collectTotals());
}
$this->setQuoteId($customerQuote->getId());
if ($this->_quote) {
$this->quoteRepository->delete($this->_quote);
}
$this->_quote = $customerQuote;
} else {
$this->getQuote()->getBillingAddress();
$this->getQuote()->getShippingAddress();
$this->getQuote()->setCustomer($this->_customerSession->getCustomerDataObject())->setTotalsCollectedFlag(false)->collectTotals();
$this->quoteRepository->save($this->getQuote());
}
return $this;
}
示例3: delete
/**
* {@inheritdoc}
*/
public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'delete');
if (!$pluginInfo) {
return parent::delete($quote);
} else {
return $this->___callPlugins('delete', func_get_args(), $pluginInfo);
}
}