Jump to content

List Services in Client Home with translations


andremcarrano

Recommended Posts

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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";

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated