I would like to translate the gender options for a customer. At first I thought that I could simply use a translation file for this, but looking into the template app/design/frontend/base/default/template/customer/widget/gender.phtml
I see that the option label is not passed to the translate function.
What is the best process for updating these values for different stores?
Best Answer
The
gender
attribute is a dropdown attribute like any other one. Its labels are stored in the tableeav_attribute_option_value
.But since there is no (out of the box) way to manage from the backend the customer attributes I see 2 options here.
Option 1. Quick and dirty:
Change the options in the template.
Copy
app/design/frontend/base/default/template/customer/widget/gender.phtml
to your theme and add afterthis:
Then you can translated the values like any other string.
Option 2 - Long but clean.
Insert into the table
eav_attribute_option_value
the values for your second (and third and so on..) store view.I said that this is the 'clean' version.
The theory it's clean but the solution I have it's not that clean.
Identify the attribute id:
Let's say it's 1000.
then identify the options for the attribute
Let's say you get 100 and 101.
Then look in the
eav_attribute_option_value
to see which is which.now you will see which is the
Male
option and which is theFemale
option.Let's say
100 => Male
,101=>Female
.Now insert your values for the second store store.
Sorry but I don't have an upgrade script version for this.
I would go with the quick and dirty one. Fewer headaches.