Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom attribute name only works in main language #41

Open
chiarahandmade opened this issue May 17, 2017 · 3 comments
Open

Custom attribute name only works in main language #41

chiarahandmade opened this issue May 17, 2017 · 3 comments

Comments

@chiarahandmade
Copy link

Hello,
this may be related to this issue

I have an custom product attribute called "Größe" and my main website language is German.

When my website is in German, the select menu gets populated normally
<select id="groesse" class="" name="attribute_groesse" data-attribute_name="attribute_groesse" data-show_option_none="yes"><option value="">Wähle eine Ausführung</option><option value="Flach 300 mm" class="attached enabled">Flach 300 mm</option><option value="Hoch 400 mm" class="attached enabled">Hoch 400 mm</option></select>

When I switch to English, the custom product attribute is encoded in another way
<select id="grose" class="" name="attribute_grose" data-attribute_name="attribute_grose" data-show_option_none="yes"><option value="">Choose an option</option></select>

This seems to be related to the different encoding of special characters äöü and ß from the function sanitize_title( $attribute_name ) that is to be found in woocommerce/templates/single-product/add-to-cart/variable.php line 38 and 41

I haven't found a solution yet to output the German version of the sanitized name, if anyone knows how to do that, would be great. Thanks in advance for any hints!

@chiarahandmade
Copy link
Author

Update: sanitize_title calls remove_accents, that uses locale to do their replaces.
A filter for get_locale() in remove_accents() is in the making.

@ginsterbusch
Copy link

ginsterbusch commented May 17, 2017

@chiarahandmade so (for now) a possible workaround would be copying and adapting sanitize_title to your own needs.

"the same procedure as every year, miss sophie?" ;)

cu, w0lf.

@chiarahandmade
Copy link
Author

@ginsterbusch thanks! it worked.
Cheers, C

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants