Magento 2 : Currency change frontend eventChange Magento base and display currency (and auto-update the prices in backend, EUR -> RON)Product price suddenly reduces when adding product to quote via admin backend, if Magento contains multiple currenciesCurrency Symbol doesnt changeHow to change currency symbol OR add own currencyHow to get current currency symbol in multi-currencies magento 2magento 1.9 Create order programmatically in aed currency with aed rateMagento change quote currency programmaticallyMagento-2 How to convert price from current currency to base currencyMagento 2 - Product custom price not change based with current currencyMultiple currency not working with custom price quote - Magento 2
Does the 500 feet falling cap apply per fall, or per turn?
LocalDate.plus Incorrect Answer
Exception propagation: When to catch exceptions?
Is it a bad idea to replace pull-up resistors with hard pull-ups?
Is Simic Ascendancy triggered by Awakening of Vitu-Ghazi?
Can the sorting of a list be verified without comparing neighbors?
Control variables and other independent variables
What food production methods would allow a metropolis like New York to become self sufficient
Is there a faster way to calculate Abs[z]^2 numerically?
Increase height of laser cut design file for enclosure
Was there a contingency plan in place if Little Boy failed to detonate?
"Right on the tip of my tongue" meaning?
How are one-time password generators like Google Authenticator different from having two passwords?
Why use steam instead of just hot air?
What does i386 mean on macOS Mojave?
Can 'sudo apt-get remove [write]' destroy my Ubuntu?
What are the ramifications of setting ARITHABORT ON for all connections in SQL Server?
Was there ever any real use for a 6800-based Apple I?
Washer drain pipe overflow
Remove everything except csv file Bash Script
Is the schwa sound consistent?
Does Lawful Interception of 4G / the proposed 5G provide a back door for hackers as well?
Was this a power play by Daenerys?
Is it a Munchausen Number?
Magento 2 : Currency change frontend event
Change Magento base and display currency (and auto-update the prices in backend, EUR -> RON)Product price suddenly reduces when adding product to quote via admin backend, if Magento contains multiple currenciesCurrency Symbol doesnt changeHow to change currency symbol OR add own currencyHow to get current currency symbol in multi-currencies magento 2magento 1.9 Create order programmatically in aed currency with aed rateMagento change quote currency programmaticallyMagento-2 How to convert price from current currency to base currencyMagento 2 - Product custom price not change based with current currencyMultiple currency not working with custom price quote - Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to update the quote item price on switching the currency from the frontend.
Is there any event to track currency switch option and give me the previous currency and requested currency?
magento2 frontend currency multicurrency
add a comment |
I want to update the quote item price on switching the currency from the frontend.
Is there any event to track currency switch option and give me the previous currency and requested currency?
magento2 frontend currency multicurrency
create custom event reference: mageplaza.com/magento-2-module-development/…
– Nikunj Vadariya
Jun 23 '17 at 6:42
add a comment |
I want to update the quote item price on switching the currency from the frontend.
Is there any event to track currency switch option and give me the previous currency and requested currency?
magento2 frontend currency multicurrency
I want to update the quote item price on switching the currency from the frontend.
Is there any event to track currency switch option and give me the previous currency and requested currency?
magento2 frontend currency multicurrency
magento2 frontend currency multicurrency
edited Jun 23 '17 at 6:22
Nikunj Vadariya
2,9261823
2,9261823
asked Jun 23 '17 at 6:21
Ashish JagnaniAshish Jagnani
4,64721957
4,64721957
create custom event reference: mageplaza.com/magento-2-module-development/…
– Nikunj Vadariya
Jun 23 '17 at 6:42
add a comment |
create custom event reference: mageplaza.com/magento-2-module-development/…
– Nikunj Vadariya
Jun 23 '17 at 6:42
create custom event reference: mageplaza.com/magento-2-module-development/…
– Nikunj Vadariya
Jun 23 '17 at 6:42
create custom event reference: mageplaza.com/magento-2-module-development/…
– Nikunj Vadariya
Jun 23 '17 at 6:42
add a comment |
1 Answer
1
active
oldest
votes
I would recommend to write a Plugin on the following Controller Action :
MagentoDirectoryControllerCurrencySwitchAction
For example:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>
And then you could use the following code:
<?php
namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;
class Switch
protected $storeManager;
public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;
public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here
I will check your answer and let you know.
– Ashish Jagnani
Jun 23 '17 at 9:36
@AshishJagnani did you resolved the issue?
– Mr. Lewis
Jun 27 '17 at 20:36
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f180423%2fmagento-2-currency-change-frontend-event%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I would recommend to write a Plugin on the following Controller Action :
MagentoDirectoryControllerCurrencySwitchAction
For example:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>
And then you could use the following code:
<?php
namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;
class Switch
protected $storeManager;
public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;
public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here
I will check your answer and let you know.
– Ashish Jagnani
Jun 23 '17 at 9:36
@AshishJagnani did you resolved the issue?
– Mr. Lewis
Jun 27 '17 at 20:36
add a comment |
I would recommend to write a Plugin on the following Controller Action :
MagentoDirectoryControllerCurrencySwitchAction
For example:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>
And then you could use the following code:
<?php
namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;
class Switch
protected $storeManager;
public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;
public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here
I will check your answer and let you know.
– Ashish Jagnani
Jun 23 '17 at 9:36
@AshishJagnani did you resolved the issue?
– Mr. Lewis
Jun 27 '17 at 20:36
add a comment |
I would recommend to write a Plugin on the following Controller Action :
MagentoDirectoryControllerCurrencySwitchAction
For example:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>
And then you could use the following code:
<?php
namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;
class Switch
protected $storeManager;
public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;
public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here
I would recommend to write a Plugin on the following Controller Action :
MagentoDirectoryControllerCurrencySwitchAction
For example:
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoDirectoryControllerCurrencySwitch">
<plugin name="yournamespace_yourmodule_directory_currency_switch_plugin"
type="YourNamespaceYourModulePluginMagentoDirecotryControllerCurrencySwitchAction"
sortOrder="10"
disabled="false"/>
</type>
</config>
And then you could use the following code:
<?php
namespace YourNamespaceYourModulePluginMagentoDirectoryControllerCurrency;
class Switch
protected $storeManager;
public function __construct(
MagentoStoreModelStoreManagerInterface $storeManager
)
$this->storeManager= $storeManager;
public function beforeExecute(
MagentoDirectoryControllerCurrencySwitchAction $subject,
$result
)
$currentCurrency = $this->storeManager->getStore()->getCurrentCurrencyCode();
$newCurrency = (string)$this->getRequest()->getParam('currency');
// your code here
edited May 7 at 13:27
Divyesh Rana
84
84
answered Jun 23 '17 at 8:40
Mr. LewisMr. Lewis
1,310711
1,310711
I will check your answer and let you know.
– Ashish Jagnani
Jun 23 '17 at 9:36
@AshishJagnani did you resolved the issue?
– Mr. Lewis
Jun 27 '17 at 20:36
add a comment |
I will check your answer and let you know.
– Ashish Jagnani
Jun 23 '17 at 9:36
@AshishJagnani did you resolved the issue?
– Mr. Lewis
Jun 27 '17 at 20:36
I will check your answer and let you know.
– Ashish Jagnani
Jun 23 '17 at 9:36
I will check your answer and let you know.
– Ashish Jagnani
Jun 23 '17 at 9:36
@AshishJagnani did you resolved the issue?
– Mr. Lewis
Jun 27 '17 at 20:36
@AshishJagnani did you resolved the issue?
– Mr. Lewis
Jun 27 '17 at 20:36
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f180423%2fmagento-2-currency-change-frontend-event%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
create custom event reference: mageplaza.com/magento-2-module-development/…
– Nikunj Vadariya
Jun 23 '17 at 6:42