本文整理汇总了PHP中Magento\Quote\Model\Quote::getStore方法的典型用法代码示例。如果您正苦于以下问题:PHP Quote::getStore方法的具体用法?PHP Quote::getStore怎么用?PHP Quote::getStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Quote\Model\Quote
的用法示例。
在下文中一共展示了Quote::getStore方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductTaxRate
private function getProductTaxRate()
{
/** @var $taxCalculator \Magento\Tax\Model\Calculation */
$taxCalculator = $this->calculation;
$request = $taxCalculator->getRateRequest($this->quote->getShippingAddress(), $this->quote->getBillingAddress(), $this->quote->getCustomerTaxClassId(), $this->quote->getStore());
$request->setProductClassId($this->getProduct()->getTaxClassId());
return $taxCalculator->getRate($request);
}
示例2: testGetStore
public function testGetStore()
{
$storeId = 1;
$storeMock = $this->getMockBuilder('Magento\\Store\\Model\\Store')->disableOriginalConstructor()->getMock();
$this->storeManagerMock->expects($this->once())->method('getStore')->with($storeId)->will($this->returnValue($storeMock));
$this->quote->setStoreId($storeId);
$result = $this->quote->getStore();
$this->assertInstanceOf('Magento\\Store\\Model\\Store', $result);
}
示例3: initializeCurrency
private function initializeCurrency()
{
/** @var $currencyHelper \Ess\M2ePro\Model\Currency */
$currencyHelper = $this->currency;
if ($currencyHelper->isConvertible($this->proxyOrder->getCurrency(), $this->quote->getStore())) {
$currentCurrency = $this->magentoCurrencyFactory->create()->load($this->proxyOrder->getCurrency());
} else {
$currentCurrency = $this->quote->getStore()->getBaseCurrency();
}
$this->quote->getStore()->setData('current_currency', $currentCurrency);
}
示例4: init
/**
* @param \Magento\Quote\Model\Quote $quote
* @param \Magento\Catalog\Model\Product $product
* @param \Magento\Framework\DataObject $config
* @return \Magento\Quote\Model\Quote\Item|string
*/
public function init(\Magento\Quote\Model\Quote $quote, \Magento\Catalog\Model\Product $product, \Magento\Framework\DataObject $config)
{
$stockItem = $this->stockRegistry->getStockItem($product->getId(), $quote->getStore()->getWebsiteId());
if ($stockItem->getIsQtyDecimal()) {
$product->setIsQtyDecimal(1);
} else {
$config->setQty((int) $config->getQty());
}
$product->setCartQty($config->getQty());
$item = $quote->addProduct($product, $config, \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL);
return $item;
}
示例5: collect
/**
* Calculate tax on product items. The result will be used to determine shipping
* and discount later.
*
* @param \Magento\Quote\Model\Quote $quote
* @param ShippingAssignmentInterface $shippingAssignment
* @param Address\Total $total
* @return $this
*/
public function collect(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment, \Magento\Quote\Model\Quote\Address\Total $total)
{
$items = $shippingAssignment->getItems();
if (!$items) {
return $this;
}
$store = $quote->getStore();
$priceIncludesTax = $this->_config->priceIncludesTax($store);
//Setup taxable items
$itemDataObjects = $this->mapItems($shippingAssignment, $priceIncludesTax, false);
$quoteDetails = $this->prepareQuoteDetails($shippingAssignment, $itemDataObjects);
$taxDetails = $this->taxCalculationService->calculateTax($quoteDetails, $store->getStoreId());
$itemDataObjects = $this->mapItems($shippingAssignment, $priceIncludesTax, true);
$baseQuoteDetails = $this->prepareQuoteDetails($shippingAssignment, $itemDataObjects);
$baseTaxDetails = $this->taxCalculationService->calculateTax($baseQuoteDetails, $store->getStoreId());
$itemsByType = $this->organizeItemTaxDetailsByType($taxDetails, $baseTaxDetails);
if (isset($itemsByType[self::ITEM_TYPE_PRODUCT])) {
$this->processProductItems($shippingAssignment, $itemsByType[self::ITEM_TYPE_PRODUCT], $total);
}
return $this;
}
示例6: getReservedOrderId
/**
* Get reserved order id
*
* @param \Magento\Quote\Model\Quote $quote
* @return string
*/
public function getReservedOrderId($quote)
{
return $this->sequenceManager->getSequence(\Magento\Sales\Model\Order::ENTITY, $quote->getStore()->getGroup()->getDefaultStoreId())->getNextValue();
}
示例7: isApplicable
/**
* Check whether payment method is applicable to quote
* Purposed to allow use in controllers some logic that was implemented in blocks only before
*
* @param PaymentMethodChecksInterface $paymentMethod
* @param \Magento\Quote\Model\Quote $quote
* @return bool
*/
public function isApplicable(PaymentMethodChecksInterface $paymentMethod, Quote $quote)
{
return $paymentMethod->canUseForCurrency($quote->getStore()->getBaseCurrencyCode());
}
示例8: _formatPrice
/**
* Format price base on store convert price method
*
* @param float $price
* @return string
*/
protected function _formatPrice($price)
{
return $this->priceCurrency->convertAndFormat($price, true, PriceCurrencyInterface::DEFAULT_PRECISION, $this->_quote->getStore());
}
示例9: currencyFromOQ
/**
* 2016-09-07
* @param O|Q $oq [optional]
* @return Currency
*/
private function currencyFromOQ($oq)
{
return $this->currency($oq->getStore(), dfp_currency($oq));
}
示例10: fetch
/**
* Add tax totals information to address object
*
* @param \Magento\Quote\Model\Quote $quote
* @param Address\Total $total
* @return array|null
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
{
$totals = [];
$store = $quote->getStore();
$applied = $total->getAppliedTaxes();
if (is_string($applied)) {
$applied = unserialize($applied);
}
$amount = $total->getTaxAmount();
if ($amount == null) {
$this->enhanceTotalData($quote, $total);
$amount = $total->getTaxAmount();
}
$taxAmount = $amount + $total->getTotalAmount('discount_tax_compensation');
$area = null;
if ($this->_config->displayCartTaxWithGrandTotal($store) && $total->getGrandTotal()) {
$area = 'taxes';
}
$totals[] = ['code' => $this->getCode(), 'title' => __('Tax'), 'full_info' => $applied ? $applied : [], 'value' => $amount, 'area' => $area];
/**
* Modify subtotal
*/
if ($this->_config->displayCartSubtotalBoth($store) || $this->_config->displayCartSubtotalInclTax($store)) {
if ($total->getSubtotalInclTax() > 0) {
$subtotalInclTax = $total->getSubtotalInclTax();
} else {
$subtotalInclTax = $total->getSubtotal() + $taxAmount - $total->getShippingTaxAmount();
}
$totals[] = ['code' => 'subtotal', 'title' => __('Subtotal'), 'value' => $subtotalInclTax, 'value_incl_tax' => $subtotalInclTax, 'value_excl_tax' => $total->getSubtotal()];
}
if (empty($totals)) {
return null;
}
return $totals;
}
示例11: fetch
/**
* Fetch the Weee total amount for display in totals block when building the initial quote
*
* @param \Magento\Quote\Model\Quote $quote
* @param \Magento\Quote\Model\Quote\Address\Total $total
* @return array
*/
public function fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)
{
/** @var $items \Magento\Sales\Model\Order\Item[] */
$items = isset($total['address_quote_items']) ? $total['address_quote_items'] : [];
$weeeTotal = $this->weeeData->getTotalAmounts($items, $quote->getStore());
if ($weeeTotal) {
return ['code' => $this->getCode(), 'title' => __('FPT'), 'value' => $weeeTotal, 'area' => null];
}
return null;
}
示例12: 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();
}