andremcarrano Posted September 13, 2014 Share Posted September 13, 2014 I'm using this code to list services in Client home. But it's not showing translated bylling cycle and correct date format as it should. The clientarea.php?action=products page default from whmcs show the correct info. You to pull the translation for {$service.billingcycle} ? {php} $userid = $this->_tpl_vars['clientsdetails']['id']; $result = mysql_query("SELECT *,tblhosting.id as serviceid FROM tblhosting,tblproducts WHERE userid =$userid AND tblhosting.packageid= tblproducts.id AND tblhosting.domainstatus='Active'"); $services = array(); while ($data = mysql_fetch_array($result)) { array_push($services, $data); } $this->_tpl_vars['services'] = $services; {/php} <div class="table_title"> <h3>Produtos/Serviços</h3> </div> <table class="table table-striped table-framed table-centered no-more-tables"> <thead> <tr> <th>{$LANG.orderproduct}</th> <th>{$LANG.orderprice}</th> <th>{$LANG.orderbillingcycle}</a></th> <th>{$LANG.clientareahostingn extduedate}</th> <th>{$LANG.clientareastatus}</th> <th> </th> </tr> </thead> <tbody> {foreach from=$services item=service} <tr> <td>{$service.name}{if $service.domain}<br /><a href="http://{$service.domain}" target="_blank">{$service.domain}</a>{/if}</td> <td>{$service.amount}</td> <td>{$service.billingcycle}</td> <td>{$service.nextduedate}</td> <td><span class="label {$service.domainstatus}">{$service.domainstatus}</span></td> <td class="textcenter"><form method="post" action="{$smarty.server.PHP_SELF}?action=productdetails"><input type="hidden" name="id" value="{$service.serviceid}" /><input type="submit" value="{$LANG.clientareaviewdetails}" class="btn info" /></form></td> </tr> {foreachelse} <tr> <td colspan="6" class="textcenter">{$LANG.norecordsfound}</td> </tr> {/foreach} </tbody> </table> 0 Quote Link to comment Share on other sites More sharing options...
andremcarrano Posted September 13, 2014 Author Share Posted September 13, 2014 Any help on this? Yes there any support from WHMCS here? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 14, 2014 Share Posted September 14, 2014 i modified the DB Query: $result = mysql_query("SELECT `tblhosting`.*,`tblproducts`.* FROM `tblhosting`,`tblproducts` WHERE `tblhosting`.`userid`='{$userid}' AND `tblhosting`.`packageid`=`tblproducts`.`id` AND `tblhosting`.`domainstatus`='Active' ORDER BY `tblhosting`.`id` ASC"); give it a try 0 Quote Link to comment Share on other sites More sharing options...
andremcarrano Posted September 17, 2014 Author Share Posted September 17, 2014 i dont see why this query will change any result. take a look..i want to change active, inactive, free account, monthly to my language loading from the lan the same as clientarea.php?action=products but in homepage thanks 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 17, 2014 Share Posted September 17, 2014 may i miss understood your question about, for language overrides read this: http://docs.whmcs.com/Language_Overrides 0 Quote Link to comment Share on other sites More sharing options...
andremcarrano Posted September 17, 2014 Author Share Posted September 17, 2014 This will not work as this is a query result I need a smart solution to load the language directly from lang/ folder not using any hack 0 Quote Link to comment Share on other sites More sharing options...
andremcarrano Posted September 17, 2014 Author Share Posted September 17, 2014 This is a hack, and i don't want to do that way. <td> {if $service.billingcycle == "Free Account"} {$LANG.orderpaymenttermfreeaccount} {elseif $service.billingcycle == "Annually"} {$LANG.orderpaymenttermannually} {else} {$service.billingcycle} {/if} </td> <td>{$service.nextduedate|date_format:"%d/%m/%Y"}</td> 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 17, 2014 Share Posted September 17, 2014 hello, in language overrides file add this line: $_LANG['testaccountterm']['Free Account'] = "Free Account"; $_LANG['testaccountterm']['Annually'] = "Annually"; and here how you can call it from smarty {$LANG.testaccountterm[$service.billingcycle]} 0 Quote Link to comment Share on other sites More sharing options...
andremcarrano Posted September 17, 2014 Author Share Posted September 17, 2014 hello, in language overrides file add this line: $_LANG['testaccountterm']['Free Account'] = "Free Account"; $_LANG['testaccountterm']['Annually'] = "Annually"; and here how you can call it from smarty {$LANG.testaccountterm[$service.billingcycle]} That's a good solution for some people. Thanks anyway! But i don't see why i have to /overrides this as its already in my lang files. $_LANG["orderpaymenttermfreeaccount"] = "Conta Grátis"; $_LANG["orderpaymenttermonetime"] = "Uma vez"; $_LANG["orderpaymenttermmonthly"] = "Mensal"; $_LANG["orderpaymenttermquarterly"] = "Trimestral"; $_LANG["orderpaymenttermsemiannually"] = "Semestral"; $_LANG["orderpaymenttermannually"] = "Anual"; $_LANG["orderpaymenttermbiennially"] = "Bianual"; 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 17, 2014 Share Posted September 17, 2014 i don't see why i have to /overrides this as its already in my lang files. try to call this $_LANG["orderpaymenttermfreeaccount"] = "Conta Grátis"; by modifying this: {$LANG.testaccountterm[$service.billingcycle]} 0 Quote Link to comment Share on other sites More sharing options...
andremcarrano Posted September 17, 2014 Author Share Posted September 17, 2014 testaccountterm ?? That will fetch from /overriders folder! I want to use the default translation, without creation of /lang/overrides/english.php as this translation is already available in /lang/english.php 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted September 17, 2014 Share Posted September 17, 2014 sorry but i am unable to find way to use the original language variables, you can check my replies for the solution offered to your request here, what you need is to create array with specific format so you can call it easy from smarty instead of "hacking", like follow: in /lang/overrides/portuguese-xx.php you need to add the following lines: $_LANG["orderpaymentterm"]["freeaccount"] = "Conta Grátis"; $_LANG["orderpaymentterm"]["onetime"] = "Uma vez"; $_LANG["orderpaymentterm"]["monthly"] = "Mensal"; $_LANG["orderpaymentterm"]["quarterly"] = "Trimestral"; $_LANG["orderpaymentterm"]["semiannually"] = "Semestral"; $_LANG["orderpaymentterm"]["annually"] = "Anual"; $_LANG["orderpaymentterm"]["biennially"] = "Bianual"; and modify your code in the main post from: $services = array(); while ($data = mysql_fetch_array($result)) { array_push($services, $data); } $this->_tpl_vars['services'] = $services; To $services = array(); while ($data = mysql_fetch_array($result)) { $data['billingcycle'] = strtolower($data['billingcycle']); $data['billingcycle'] = str_replace(" ", "", $data['billingcycle']); array_push($services, $data); } $this->_tpl_vars['services'] = $services; so in your .tpl file you can add this line: {$LANG.orderpaymentterm[$service.billingcycle]} and all will work perfectly, if you can find an easy way instead of mine above, please write it here so all can benefit from it. 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.