本文整理汇总了PHP中Magento\Quote\Model\Quote::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::save方法的具体用法?PHP Quote::save怎么用?PHP Quote::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Quote\Model\Quote
的用法示例。
在下文中一共展示了Quote::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeQuote
private function initializeQuote()
{
$this->quote = $this->quoteFactory->create();
$this->quote->setCheckoutMethod($this->proxyOrder->getCheckoutMethod());
$this->quote->setStore($this->proxyOrder->getStore());
$this->quote->getStore()->setData('current_currency', $this->quote->getStore()->getBaseCurrency());
$this->quote->save();
$this->checkoutSession->replaceQuote($this->quote);
}
示例2: save
/**
* Save quote
*
* @param Quote $quote
* @return void
*/
public function save(Quote $quote)
{
$quote->save();
unset($this->quotesById[$quote->getId()]);
unset($this->quotesByCustomerId[$quote->getCustomerId()]);
}
示例3: createCurrencyRate
/**
* Create currency rates and set rate on quote
*
* @param $ratesData
* @param \Magento\Quote\Model\Quote $quote
*/
protected function createCurrencyRate($ratesData, \Magento\Quote\Model\Quote $quote)
{
$baseCurrencyCode = $ratesData['base_currency_code'];
$quoteCurrencyCode = $ratesData['quote_currency_code'];
$currencyConversionRate = $ratesData['currency_conversion_rate'];
$newRate = [$baseCurrencyCode => [$quoteCurrencyCode => $currencyConversionRate]];
/** @var \Magento\Directory\Model\Currency $currency */
$currency = $this->objectManager->get('Magento\\Directory\\Model\\Currency');
$currency->saveRates($newRate);
// Set the currency code on the store so that the \Magento\Quote\Model\Quote::beforeSave() method sets the
// quote_currency_code to the appropriate value
$quote->getStore()->getCurrentCurrency()->setData('currency_code', $quoteCurrencyCode);
// Save the quote to register the quote_currency_code
$quote->save();
}