This guide offers comprehensive instructions for seamlessly integrating multiple currencies into the Doofinder search functionality within your custom CMS platform. You can skip this step if you're using one of our plugins, as the script injection is handled within the plugin.
Managing multiple currencies
In cases where your store supports multiple currencies for the same language, it's essential to configure the Doofinder script appropriately. This involves adding the currency attribute to the script to ensure seamless integration with Doofinder's search functionality based on the user's selected currency.
Configuration steps
- Create separate Search Engines: For each language/currency combination, create a separate Search Engine within your Store Settings. For instance, if your English Store supports Euros (€), US Dollars ($), and British Pounds (£), you would create three distinct Search Engines:
- Script Configuration: Adjust the Doofinder script to include the currency attribute. This informs Doofinder which Search Engine to use based on the user's selected currency.
– EN - EUR
– EN - USD
– EN - GBP
Take a look at this documentation for easy-to-follow instructions.
Ensure that the currency attribute is set to the currency visible to the end-user. For example, if the user is viewing the page with Euros, the script should be configured as follows:
<script>
const dfLayerOptions = {
installationId: 'XXXX-XXXX-XXXX-XXXX',
zone: 'XX',
currency: 'EUR' // Set to the appropriate currency code ('EUR', 'USD', 'GBP', etc.)
};
(function (l, a, y, e, r, s) {
r = l.createElement(a); r.onload = e; r.async = 1; r.src = y;
s = l.getElementsByTagName(a)[0]; s.parentNode.insertBefore(r, s);
})(document, 'script', 'https://cdn.doofinder.com/livelayer/1/js/loader.min.js', function () {
doofinderLoader.load(dfLayerOptions);
});
</script>
You should dinamically change the currency value, depending on the one selected by the end-user. For example, in your HTML code, you should index the following variable:
let selectedCurrency = 'EUR';
In the Doofinder script, use:
<script>
const dfLayerOptions = {
installationId: 'XXXX-XXXX-XXXX-XXXX',
zone: 'XX',
currency: selectedCurrency
};
(function (l, a, y, e, r, s) {
r = l.createElement(a); r.onload = e; r.async = 1; r.src = y;
s = l.getElementsByTagName(a)[0]; s.parentNode.insertBefore(r, s);
})(document, 'script', 'https://cdn.doofinder.com/livelayer/1/js/loader.min.js', function () {
doofinderLoader.load(dfLayerOptions);
});
</script>
By following these steps and adjusting the Doofinder script accordingly, you ensure that your store integrates with Doofinder's search functionality, catering to users across different currencies within the same language setting.