本文整理匯總了PHP中Magento\Framework\StoreManagerInterface::getGroup方法的典型用法代碼示例。如果您正苦於以下問題:PHP StoreManagerInterface::getGroup方法的具體用法?PHP StoreManagerInterface::getGroup怎麽用?PHP StoreManagerInterface::getGroup使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\StoreManagerInterface
的用法示例。
在下文中一共展示了StoreManagerInterface::getGroup方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getDefaultCurrency
/**
* Retrieve default currency for selected store, website or website group
* @todo: Refactor to ScopeDefiner
* @param \Magento\Framework\App\RequestInterface $request
* @return string
*/
public function getDefaultCurrency(\Magento\Framework\App\RequestInterface $request)
{
if ($request->getParam('store')) {
$store = $request->getParam('store');
$currencyCode = $this->_storeManager->getStore($store)->getBaseCurrencyCode();
} else {
if ($request->getParam('website')) {
$website = $request->getParam('website');
$currencyCode = $this->_storeManager->getWebsite($website)->getBaseCurrencyCode();
} else {
if ($request->getParam('group')) {
$group = $request->getParam('group');
$currencyCode = $this->_storeManager->getGroup($group)->getWebsite()->getBaseCurrencyCode();
} else {
$currencyCode = $this->_configuration->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default');
}
}
}
return $currencyCode;
}