Skip to main content

Translate Custom field Checkbox value

More
9 years 8 months ago - 9 years 8 months ago #260996 by dyvel
-- HikaShop version -- : 3.0.0

Hi

I have a custom field of type checkbox with label: COLOR
I have a value and title within called BLACK

My translation works fine in backend, but in frontend where I output the content, it's not getting through.

Here's my code:
Code:
<ul class="list"> <?php $color = explode(",",$this->element->color); foreach ($color as $key => $value) { echo '<li>'; $myField = $fieldclass->get('17'); echo $myField->field_value[$value]->value; echo '</li>'; } ?> </ul>

EDIT: if I use this echo in my foreach, it works:
Code:
echo JText::_($myField->field_value[$value]->value);

Perhaps there are better ways?

EDIT: Sorry about wrong category for topic...

Thanks
Last edit: 9 years 8 months ago by dyvel.

Please Log in or Create an account to join the conversation.

More
9 years 8 months ago #261008 by Jerome
Hi,

When you want to display a custom field ; the best is to use the function provided by the custom field class ; like it is done in current HikaShop view :
Code:
echo $fieldsClass->show($field, $value);
It will support every kind of custom field and perform the translation for you.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum