12345678910111213141516171819202122232425 |
- <?php
- /**
- *
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Directory\Controller\Currency;
- class SwitchAction extends \Magento\Framework\App\Action\Action
- {
- /**
- * @return void
- */
- public function execute()
- {
- /** @var \Magento\Store\Model\StoreManagerInterface $storeManager */
- $storeManager = $this->_objectManager->get(\Magento\Store\Model\StoreManagerInterface::class);
- $currency = (string)$this->getRequest()->getParam('currency');
- if ($currency) {
- $storeManager->getStore()->setCurrentCurrencyCode($currency);
- }
- $storeUrl = $storeManager->getStore()->getBaseUrl();
- $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($storeUrl));
- }
- }
|