【问题标题】:How Can I add currency selector on WHMCS custom page?如何在 WHMCS 自定义页面上添加货币选择器?
【发布时间】:2020-06-30 13:27:42
【问题描述】:

我正在尝试在显示产品详细信息的自定义页面之一上添加货币选择器。 我想允许我的访问者从此自定义页面更改默认货币并相应地查看产品定价。

我已经在我的 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,

【问题讨论】:

    标签: selector currency whmcs


    【解决方案1】:

    你可以这样做。您可以将表单更新为:

    1. 执行 GET 请求,并将 currency=$id 参数添加到 URL($idtblcurrencies 中货币的 ID。

    或者

    1. 当您的表单提交时,处理表单输入,并在会话变量中设置货币:
    use WHMCS\Session;
    
    Session::set('currency', $id);
    

    同样,$idtblcurrencies.id 相关。

    请记住,现有用户无法更改货币,并且不建议在他们进行任何交易后更改其货币以避免会计/计算问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-29
      • 2021-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多