我试图在显示商品详细信息的自定义页面之一上添加货币选择器。 我想允许访问者从此自定义页面更改默认货币,并相应地查看产品价格。
我已将此代码添加到我的custom.tpl
中 <input type="hidden" name="token" value="{$LANG.go}">
<select name="currency" onchange="submit()" class="form-control">
<option value="">Change Currency (A$ AUD)</option>
{foreach from=$currencies item=listcurr}
<option value="{$listcurr.id}"{if $listcurr.id == $currency.id} selected{/if}>{$listcurr.prefix} {$listcurr.code}</option>
{/foreach}
</select>
</form> ```
But it is not working, every time I select the currency from the dropdown, it refreshes the page. but nothing changes,
please guide what I am doing wrong.
Thanks in advance
Aqsa,
答案 0 :(得分:0)
您可以执行此操作。您可以将表单更新为以下任何一种形式:
currency=$id
参数添加到URL($id
是tblcurrencies
中货币的ID。或
use WHMCS\Session;
Session::set('currency', $id);
同样,$id
与tblcurrencies.id
相关。
请记住,现有用户无法更改币种,并且不建议在他们进行任何交易后更改其币种,以避免会计/计算问题。