Jump to content

Multi language products and Services


Milliment

Recommended Posts

After speaking with WHMCS and alot of hard work i finaly have it working :D

 

So im going to shair it with you today.

 

First of all go into WHMCS admin and navigate to products and sevices.

 

Once here you need to do abit of work.

 

If you already have your products setup then you have less work anyway i will explain.

 

Creat a group called Website Hosting and then creat another one in its alter language For example Hosting Sito Web and mark this group as hidden.

 

Ok so now we have 2 product groups both the same in different languages. Creat the products for these groups and save as normal.

 

Now for the fun editing part :D

 

in your prefered web editing software open the following files from your selected cart folder (For this i am using web20 but its all the same realy)

 

So open first products.tpl

 

Now find the following line

 

{foreach key=num item=productgroup from=$productgroups} {if $gid eq $productgroup.gid} {$productgroup.name} | {else} {getlang data=$productgroup.name lang=$language} | {/if} {/foreach} 

 

Now infront of this we need to add some code and here it is

{if $language eq 'Italian'}{if $gid eq '8'}  <strong>Hosting Sito web</strong>{else}<a href="http://client.milliment.com/cart.php?gid=8">Hosting Sito web</a>{/if} |{else} 

 

Now just a quick brake down of the whole thing before we do anything.

 

{if $language eq 'Italian'}

 

This is a general if statment that will alow us to do something if the language is only italian. so we need this at the begining.

 

Now this piece of code is not needed but if your a perfectionist like me then you will want to add it.

{if $gid eq '8'}

 

This is simply to mirror the origional code for the groups so if the group is selected it will become bold and not a link. just the same as the origional :D

 

So for each product group you wish to add all you need to do is repeat this code for each group

 

{if $gid eq '8'} <strong>Hosting Sito web</strong>{else}<a href="http://client.milliment.com/cart.php?gid=8">Hosting Sito web</a>{/if} |

NOTE: remember to change the GID for each group or you will have alot of dead links on your page. the GID can be found in the group link /cart.php?gid=8

 

So once you have finished your code it should look soemthing like this

 

{if $language eq 'Italian'}{if $gid eq '8'} <strong>Hosting Sito web</strong>{else}<a href="http://client.milliment.com/cart.php?gid=8">Hosting Sito web</a>{/if} |{else} {foreach key=num item=productgroup from=$productgroups}
 {if $gid eq $productgroup.gid} <strong>{$productgroup.name}</strong> | 
 {else} <a href="{$smarty.server.PHP_SELF}?gid={$productgroup.gid}">{getlang data=$productgroup.name lang=$language}</a> | 
 {/if}
 {/foreach} {/if}

 

remember to add the {/if} after {/foreach} otherwise you will get a lovely white page.

Now save that page and now we need to edit one more page.

Go to your Default portalt template and open homepage.tpl

 

Fine the following line

<strong><a href="cart.php">{$LANG.ordertitle}</a></strong>

 

and replace it with

 

<strong>{if $language eq "Italian"}<a href="cart.php?gid=8">{else}<a href="cart.php">{/if}{$LANG.ordertitle}</a></strong>

 

If the language is set to italian then this will direct the users to the product group you added earlyer.

 

So there it is a simple way to have multi language products and services.

 

I hope this helps. Mat and the team have helped me alot with this and i thought i should pass it back on.

 

If you need any help feel free to ask after all this i hope i know what im doing.

Link to comment
Share on other sites

  • 6 months later...

This is really an excellent contribution. I notice small issue with this solution and want to check if anyone (author of this contribution perhaps) can help.

 

Everything works fine if user is directed to specific gid, bit if user changes language back to for example English and from English back to alternative language when already landed on cart.php?gid=X then it will not reflect the change in products.

 

Can we somehow cause the action to change the gid with language selector action?

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