Jump to content

Condition in product description translation


GatoHorrível

Recommended Posts

Hi

 

I have edited the product.tpl inside the pretashop/themes/default/ and inserted a code I've located inside this forum, so the condition of the product would be displayed inside the product page.

the code is the following:

 

 

{if $product}

<div id="condition_content" class="rte align_justify">{$product->condition}</div>

{/if}

 

I am using two languages, english and portuguese.

The problem is that, when in a product page, the info will only show in english although in the back office product editing/submission page the content of condition appears in both (english and portuguese) languages, but not in the front office using that code.

 

I've searched anything in translations but everything appears to be correct

Condition: = Condição:

New = Novo

Used = Usado

Refurbished = Como Novo

 

Any help on what needs to be done so the product condition will appear in Portuguese (in front office) when the portuguese language is selected would be grateful.

 

I am using prestashop 1.5.3.1

Edited by bretthxc (see edit history)
Link to comment
Share on other sites

See how it is done in admin\themes\default\template\controllers\products\informations.tpl

 

<option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option>

<option value="used" {if $product->condition == 'used'}selected="selected"{/if} >{l s='Used'}</option>

<option value="refurbished" {if $product->condition == 'refurbished'}selected="selected"{/if}>{l s='Refurbished'}</option>

 

The value is a kind of enumeration, always the same whatever the language.

You have to do conditions and the {l} tag to display the right message.

Link to comment
Share on other sites

I've tested the code on your last post, replacing the other I had previously, but still, only english appears in the description.

 

I've also noted that in admin\themes\default\template\controllers\products\informations.tpl I've got the following

 

 

<select name="condition" id="condition">

<option value="new" {if $product->condition == 'new'}selected="selected"{/if} >{l s='New'}</option>

<option value="used" {if $product->condition == 'used'}selected="selected"{/if} >{l s='Used'}</option>

<option value="refurbished" {if $product->condition == 'refurbished'}selected="selected"{/if}>{l s='Refurbished'}</option>

</select>

 

Not sure what is needed to be done from here

Edited by GatoHorrível (see edit history)
Link to comment
Share on other sites

Actually, it works: it displays 'New' instead of 'new'...

I think it misses the translation, which might not be at the right place.

I don't know yet where it must be, I am investigating.

 

"I've also noted..."

Well, that's what I posted in a previous message...

 

Link to comment
Share on other sites

Well, I went to the Translations section, and it warned that 3 translations were missing. After I supplied them for the non-English language, the translation was fine in the front-office.

 

Hey, people criticize PrestaShop, but there are some things they did well! ;-)

Link to comment
Share on other sites

Criticizing is good, it helps communities and projects growing.

 

I have the translations already translated to the other language in the translations section.

 

My problem, from the beggining, is that (using the code I provided in the first message and the one PhiLho provided afterward) the translation is not showing in the front office in the product list. Only shows in english (using english or portuguese front office only shows the condition state in english even if they are translated in the translation section in the back office).

 

Now, I don't know if there was something I sayed wrong or did not understand from your part.

 

I think prestashop is a pretty good open source by the way.

Link to comment
Share on other sites

Ok I've found solution.

 

I've edited the products.tpl and added this:

 

 

{if $lang_iso == 'pt'}

 

{if $product->condition == 'new'}

 

{l s='Novo'}{elseif $product->condition == 'used'}{l s='Usado'}{elseif $product->condition == 'refurbished'}{l s='Como Novo'}{/if}

 

{elseif $lang_iso == 'en'}

 

 

{if $product->condition == 'new'}

 

{l s='New'}{elseif $product->condition == 'used'}{l s='Used'}{elseif $product->condition == 'refurbished'}{l s='Refurbished'}{/if}

 

{/if}

 

 

hope it helps someone, versatile code!

Link to comment
Share on other sites

What I did is to add my line in the template. I have Smarty to recompile the template when changed. So after the change, I went to the translations and it spotted the new strings to templates. There was no translation for these strings, before. I provided the French translation (no need for an English one, as it is the default) and, voilà!, there were translated in the front-office.

 

Your solution is good if it works for you, but it is brittle, as if you add another language, it would need another code change. But I suppose you have no plan for new language.

 

"Criticizing is good, it helps communities and projects growing."

Hey, sure, it puts things in perspective: no project is perfect, it is good to know the weak points (the strong ones are generally advertised by the project itself...).

Link to comment
Share on other sites

  • 1 year later...

PhiLho, you just add this line:

 

{if $product->condition == 'new'}{l s='New'}{elseif $product->condition == 'used'}{l s='Used'}{elseif $product->condition == 'refurbished'}{l s='Refurbished'}{/if}

 

in product.tpl inside the pretashop/themes/Your theme???

 

I am probably adding more languages later so I would like the option that allows for translation in BO :)

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...