14 hours ago, JBW said:Looking at your code the i is not a PHP variable - they always start with a $. So either i is a type or you miss to explain how this is filled.
JBW, the "i" was filled in directly in the FrontController, it is not a variable, it is an integer from 1 - 6.
The reason why I did it was because I wanted to see which currency id belongs to which currency, after I've got what I wanted to know I switched the code back to :
$currency = Tools::setCurrency($this->context->cookie);
This is when the "cookie" error showed up when I try to load the front office with multiple currencies enabled.
It's as if the cookie was still stuck at a different currency or is empty, therefore unable to load the "ps_currencyselector.tpl" file in "themes/theme_name/modules/".
This is what's in the "ps_currencyselector.tpl" :
<div id="_desktop_currency_selector"> <div class="currency-selector dropdown js-dropdown"> <span id="currency-selector-label">{l s='Currency:' d='Shop.Theme.Global'}</span> <button data-target="#" data-toggle="dropdown" class="hidden-sm-down btn-unstyle" aria-haspopup="true" aria-expanded="false" aria-label="{l s='Currency dropdown' d='Shop.Theme.Global'}"> <span id="currency_dropdown" class="expand-more _gray-darker">{$current_currency.name}</span> <i class="fas fa-chevron-down expand-more"></i> </button> <form id="setCurrency" action="{$request_uri}" method="post"> <input id="current_id" type="hidden" value="{$current_currency.name}"> <input type="hidden" name="id_currency" id="id_currency" value=""/> <input type="hidden" name="SubmitCurrency" value="" /> <ul class="dropdown-menu hidden-sm-down" aria-labelledby="currency-selector-label"> <li {if $cookie->id_currency == 2}class="selected"{/if}> <a title="Bitcoin" rel="nofollow" href="#" class="dropdown-item" onclick="setCurrency(2)"> <img class="crypto_icons" src="{$urls.img_ps_url}/crypto_icons/BTC_icon.png"> BTC </a> </li> <li {if $cookie->id_currency == 3}class="selected"{/if}> <a title="Ethereum" rel="nofollow" href="#" class="dropdown-item" onclick="setCurrency(3)"> <img class="crypto_icons" src="{$urls.img_ps_url}/crypto_icons/ETH_icon.png"> ETH </a> </li> <li {if $cookie->id_currency == 4}class="selected"{/if}> <a title="Bitcoin Cash" rel="nofollow" href="#" class="dropdown-item" onclick="setCurrency(4)"> <img class="crypto_icons" src="{$urls.img_ps_url}/crypto_icons/BCH_icon.png"> BCH </a> </li> <li {if $cookie->id_currency == 5}class="selected"{/if}> <a title="Litecoin" rel="nofollow" href="#" class="dropdown-item" onclick="setCurrency(5)"> <img class="crypto_icons" src="{$urls.img_ps_url}/crypto_icons/LTC_icon.png"> LTC </a> </li> <li {if $cookie->id_currency == 6}class="selected"{/if}> <a title="Ripple" rel="nofollow" href="#" class="dropdown-item" onclick="setCurrency(6)"> <img class="crypto_icons" src="{$urls.img_ps_url}/crypto_icons/XRP_icon.png"> XRP </a> </li> </ul> </form> <select class="link hidden-md-up" aria-labelledby="currency-selector-label"> {foreach from=$currencies item=currency} <option value="{$currency.url}"{if $currency.current} selected="selected"{/if}>{$currency.iso_code} {$currency.sign}</option> {/foreach} </select> </div> </div>
I did everything exactly the same on localhost but this error did not happen on localhost.