• Hi there,

    I am currently trying to sort the output of the product attributes by their labels in alphabetical order on the single product page. I slightly edited the product-attributes.php template file and inserted asort( $product_attributes ); before the the foreach output loop.

    It does sort the attributes but all my labels starting with a German Umlaut are now at the end of the table which is not correct. For example “?” should come after “A” and not after “Z”.

    Any ideas how to get the correct order including Umlauts?

    Thanks in advance!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    Hello @cleuenberg,

    It does sort the attributes but all my labels starting with a German Umlaut are now at the end of the table which is not correct. For example “?” should come after “A” and not after “Z”.

    It looks like this is how the asort() function is designed to sort an array. However, the function offers 5 different types of sorting. I recommend trying out another sort type and see which one works for you. You can pass sorttype as a parameter. Please check here for more details.

    Thanks!

    Thread Starter Christian Leuenberg

    (@cleuenberg)

    @sohanhossain Thanks, I already tried using the sorttype parameter: 3 = SORT_LOCALE_STRING seemed to be the proper one but none of those parameters is sorting the correct way. I also tried in combination with setting setlocale( LC_ALL, 'de_DE' ) within the template file in case of having issues with the correct locale. Any further ideas? ??

    Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    Hello @cleuenberg,

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Thanks!

    Plugin Support Shohan Hossain Nabil – a11n

    (@sohanhossain)

    Hey there,

    There hasn’t been much activity on this thread, so I wanted to add a few more options for you.

    if you do require more help with the actual coding, we’d recommend you hire a developer who can take a look at this, quote you for their services, and help you add this feature to your site. We’d recommend getting in touch with a web developer or one of the customization experts listed at?https://woocommerce.com/customizations/.

    Please kindly note that this requires some custom coding – which goes beyond the scope of support we are able to provide in this forum.

    I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thanks for understanding.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sort product attributes by their labels including Umlauts’ is closed to new replies.