rudberg Posted October 4, 2009 Share Posted October 4, 2009 In order to let the user select which currency to view prices with on the whmcs first-page (.tpl-based), I tried the following code, but it doesn't seem currencies will ever change, and they are certainly not written out. I do get a bit confused by having both a tblproducts and a tblpricing table in the db, but assume it's the tblpricing I should be using here. I picked up the "choose currency" code from the /orderform/products.tpl template, but I assume, that can't just be done like that. What would I have to do instead? Code: <!--Choose currency--> {if !$loggedin && $currencies} <form method="post" action="index-beta.php?gid={$smarty.get.gid}"> <p align="right" valign="middle">{$LANG.choosecurrency}: <select name="currency" onchange="submit()"> {foreach from=$currencies item=curr} <option value="{$curr.id}"{if $curr.id eq $currency.id} selected{/if}>{$curr.code}</option> {/foreach}</select> <input type="submit" value="{$LANG.go}" /></p> </form> {/if} <!--End choose currency--> <!--Print each product-id and pricing for the active currency only in the format: Monthly from - to, Setup from - to--> {php} $query = 'SELECT * FROM tblpricing'; $result = mysql_query ($query); while ($data = @mysql_fetch_array ($result)) { $monthly = $data['monthly']; $biennial = $data['biennial']; $msetupfee = $data['msetupfee']; $bsetupfee = $data['bsetupfee']; $package = $data['id']; if ($monthly == '0.00') {$monthly = 'FREE';} else {$monthly = $CONFIG['CurrencySymbol'].$monthly;} if ($biennial == '0.00') {$biennial = 'FREE';} else {$biennial = $CONFIG['CurrencySymbol'].$biennial;} if ($msetupfee == '0.00') {$msetupfee = 'FREE';} else {$msetupfee = $CONFIG['CurrencySymbol'].$msetupfee;} if ($bsetupfee == '0.00') {$bsetupfee = 'FREE';} else {$bsetupfee = $CONFIG['CurrencySymbol'].$bsetupfee;} if($data['hidden'] != "on" ) { echo $package; echo " Price: "; echo $currencysymbol; echo " "; echo $biennial; echo " – "; echo $monthly; echo "per month & from FREE – "; echo $currencysymbol; echo " "; echo $msetupfee; echo " in setup."; echo "<br />"; } } {/php} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.