Jump to content

Ultimate multilingual products. [HOWTO]


Recommended Posts

Been playing with the language system in WHMCS trying to create a system that would allow me to display multilingual product information without big hacks.

 

Since the admin is clearly not suitable for this job even using the workaround mod I created here I decided to focus on using the language files to pull in the data for each product.

 

Turned out it was simpler than I had imagined.

 

In your Language files place the following entries for each product

 


$_LANG["products"]["1"] = array("desc"=>"the description","feat1"=>"Feature 1");

 

where 1 is the product id that this data is to be associated too, e.g $_LANG["products"]["1"] or $_LANG["products"]["22"] or $_LANG["products"]["35"] etc

 

This creates a language variable array with items for "desc" and "feat1", obviously you can add more values to the array like more features or other values you want to be accessible to this products listing.

 

Now to pull in the correct data for each product. In your products.tpl file use the following lines between your product foreach tags

 


{if $LANG.products[$product.pid].desc}{$LANG.products[$product.pid].desc}<br />{/if}
{if $LANG.products[$product.pid].feat1}{$LANG.products[$product.pid].feat1}<br />{/if}

 

This will now show any language specific data for that product held in the current language file.

 

All in all it is a really nice way to implement multilingual data for products.

Link to comment
Share on other sites

I really prefer use the getlang modifier that you create!

 

http://forum.whmcs.com/showthread.php?t=20219

 

It IS a great idea (if I say so myself) but unfortunately because of the way it has to be implemented (Not internally) it does not work so well IMO. This solution however has a number of advantages for product data and is more flexible for displaying lots of product data, features lists, large pop-up content per product, links etc etc.

 

I implement this as a custom add-on language system in WHMCS, it uses individual language files per page instead of one BIG language file for the whole site, leaving the main language file as just a global language file for content that is shown globally on the site saving on page response times by only loading the content that is really needed.

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 months later...
  • 4 weeks later...

Hi Sam,

 

it seems pretty easy to setup but I just don't know where to put the code in the products.tpl file. Could you show an example of exactly where the code should go. Anyway thanks for this great plugin. Also, is it possible to have the group name bilingual using the same system. I have a group named Hosting in english but in French it stays the same. Any idea how to fix that

 

Thanks

Link to comment
Share on other sites

  • 1 year later...
Been playing with the language system in WHMCS trying to create a system that would allow me to display multilingual product information without big hacks.

 

Since the admin is clearly not suitable for this job even using the workaround mod I created here I decided to focus on using the language files to pull in the data for each product.

 

Turned out it was simpler than I had imagined.

 

In your Language files place the following entries for each product

 


$_LANG["products"]["1"] = array("desc"=>"the description","feat1"=>"Feature 1");

 

where 1 is the product id that this data is to be associated too, e.g $_LANG["products"]["1"] or $_LANG["products"]["22"] or $_LANG["products"]["35"] etc

 

This creates a language variable array with items for "desc" and "feat1", obviously you can add more values to the array like more features or other values you want to be accessible to this products listing.

 

Now to pull in the correct data for each product. In your products.tpl file use the following lines between your product foreach tags

 


{if $LANG.products[$product.pid].desc}{$LANG.products[$product.pid].desc}<br />{/if}
{if $LANG.products[$product.pid].feat1}{$LANG.products[$product.pid].feat1}<br />{/if}

 

This will now show any language specific data for that product held in the current language file.

 

All in all it is a really nice way to implement multilingual data for products.

 

Hello Sam,

 

Thank you for your work.

Unfortunately I am not familiar to whmcs, could you do a tutorial or give a more detailed description of the how to do for a newbie?

 

I would even appreciate it more if you can make the modification for me, again a donation of course!

 

Regards,

Pascal

Link to comment
Share on other sites

  • 4 weeks later...

Hi ServWise.com,

 

I was wondering if you new workaround includes product categories or if we should copy and adapt your new code for them.

 

I was trying to display products in English and in French but the product dropdown show in both languages, which doesn't make sense for clients. Since then, I've been trying to find a solution to display language-specific product types, products and product descriptions.

 

Thanks for helping to make WHMCS a multilingual software :-)

 

 

Josée Marianne

Link to comment
Share on other sites

Hi ServWise.com,

 

I was wondering if you new workaround includes product categories or if we should copy and adapt your new code for them.

 

I was trying to display products in English and in French but the product dropdown show in both languages, which doesn't make sense for clients. Since then, I've been trying to find a solution to display language-specific product types, products and product descriptions.

 

Thanks for helping to make WHMCS a multilingual software :-)

 

 

Josée Marianne

 

If you can parse an ID for the product category then you can make it pull in a specific language value from a language file and display it instead of the one in WHMCS admin. (Assuming the layout has not been hard coded by WHMCS)

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