product categories disappear in secondary languages (wpml)
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from conradude on October 16, 2024, 14:49Hello,
When displaying the shop page in another language than the original, the products categories filter disappear (I tried force displaying it but it's empty).
Most categories are translated (in the wpml setting, product_cat is set to "translatable, use default as fallback"). Products aren't translatable.
If I go on translated product categories URL directly ( ex: site.com/fr/product-cat/accessoires/ ) it displays the products correctly, meaning translated categories exist and work. Only the filter doesn't show them.
Should I do something in the plugin's settings or in wpml ?
Thanks
Hello,
When displaying the shop page in another language than the original, the products categories filter disappear (I tried force displaying it but it's empty).
Most categories are translated (in the wpml setting, product_cat is set to"translatable, use default as fallback"). Products aren't translatable.
If I go on translated product categories URL directly ( ex: site.com/fr/product-cat/accessoires/ ) it displays the products correctly, meaning translated categories exist and work. Only the filter doesn't show them.
Should I do something in the plugin's settings or in wpml ?
Thanks
Quote from Pablo Borysenco on October 17, 2024, 10:12Hello
Yes, this can happen if you have not translated the categories correctly. Or if there are no translations in the database.
What plugin version number are you using?
Hello
Yes, this can happen if you have not translated the categories correctly. Or if there are no translations in the database.
What plugin version number are you using?
Quote from conradude on October 17, 2024, 10:53Hello,
so, that's not the issue since I translated the categories (they are linked together and all) and there are translations in the database. As you can see here for example :
[spoiler]
an example of category :
- original : https://www.amigosskateshop.com/product-cat/accessories/
- translated : https://www.amigosskateshop.com/fr/product-cat/accessoires/[/spoiler]
Plugins are up to date (husky : 1.3.6.3 and wpml with auto update)
Hello,
so, that's not the issue since I translated the categories (they are linked together and all) and there are translations in the database. As you can see here for example :
an example of category :
- original : https://www.amigosskateshop.com/product-cat/accessories/
- translated : https://www.amigosskateshop.com/fr/product-cat/accessoires/
Plugins are up to date (husky : 1.3.6.3 and wpml with auto update)
Quote from Pablo Borysenco on October 17, 2024, 12:08Hello
Your link - https://share.pluginus.net/image/i20241017130817.png
Hello
Your link - https://share.pluginus.net/image/i20241017130817.png
Quote from conradude on October 17, 2024, 12:12Hello,
sorry, connected to the same bug on the other thread. It's now fixed. You can go on the same link
Hello,
sorry, connected to the same bug on the other thread. It's now fixed. You can go on the same link
Quote from Pablo Borysenco on October 18, 2024, 10:18Hello
Yes I checked it. As you noticed, the second filter also does not work
And I assume that the translations of the products are not done correctly.
Try consulting WPML support for the correct translation of products for filters
Hello
Yes I checked it. As you noticed, the second filter also does not work
And I assume that the translations of the products are not done correctly.
Try consulting WPML support for the correct translation of products for filters
Quote from conradude on October 18, 2024, 10:33Alright, thanks
Alright, thanks
Quote from conradude on October 22, 2024, 12:23Hello again,
I've discussed it with wpml and the result is this : we have translated our categories, but not the products (because we don't need to). So, these translated categories are "empty" in a way. If we create the translation of a product, its categories appear (as you can see now on the same link). The workaround they found would be to duplicate all of our products. It's time consuming and risky.
My question is this : is there way for your plugin to "accept" these translated categories as "not empty" without having us to duplicate all these products. I know there are ways with wpml api to read infos from original categories instead of the category itself. Do you think you could do this ? It seems to me, it would be a great addition to the plugin as I'm sure we're not the only one who don't need to translate our products but only their categories. I thought about this snippet :
add_filter('woof_get_request_data', 'my_woof_get_request_data');
function my_woof_get_request_data($data){
$data['stock']='instock';
return $data;
}But the idea would be to do the opposite and run it only for the translated categories, not the rest of it. Or maybe you have a better workaround to offer.
Thank you
Hello again,
I've discussed it with wpml and the result is this : we have translated our categories, but not the products (because we don't need to). So, these translated categories are"empty" in a way. If we create the translation of a product, its categories appear (as you can see now on the same link). The workaround they found would be to duplicate all of our products. It's time consuming and risky.
My question is this : is there way for your plugin to"accept" these translated categories as"not empty" without having us to duplicate all these products. I know there are ways with wpml api to read infos from original categories instead of the category itself. Do you think you could do this ? It seems to me, it would be a great addition to the plugin as I'm sure we're not the only one who don't need to translate our products but only their categories. I thought about this snippet :
add_filter('woof_get_request_data', 'my_woof_get_request_data');
function my_woof_get_request_data($data){
$data['stock']='instock';
return $data;
}
But the idea would be to do the opposite and run it only for the translated categories, not the rest of it. Or maybe you have a better workaround to offer.
Thank you
Quote from Pablo Borysenco on October 23, 2024, 10:38Hello
Ok! You can try to in file - wp-content\plugins\woocommerce-products-filter\index.php - comment this code - https://share.pluginus.net/image/i20241023113755.png - and do a test
Hello
Ok! You can try to in file - wp-content\plugins\woocommerce-products-filter\index.php - comment this code - https://share.pluginus.net/image/i20241023113755.png - and do a test
Quote from conradude on October 23, 2024, 11:38Hello and thank you for this. Unfortunately, that doesn't seem to be working.
IMO, the idea would be to query the original categories products count instead of the wpml categories (I get what you were trying with the line I had to comment, but I think it has to go deeper).
This ( https://stackoverflow.com/questions/50584343/get-term-count-of-product-categories-in-default-language-using-wpml ) but this is old and you don't wuery the same way I think.
But the idea would be this one. And i the original category product count is over 0, then it would show the translated category name.
Any idea how I could modify your code to do this ?
Thank you
Hello and thank you for this. Unfortunately, that doesn't seem to be working.
IMO, the idea would be to query the original categories products count instead of the wpml categories (I get what you were trying with the line I had to comment, but I think it has to go deeper).
This ( https://stackoverflow.com/questions/50584343/get-term-count-of-product-categories-in-default-language-using-wpml ) but this is old and you don't wuery the same way I think.
But the idea would be this one. And i the original category product count is over 0, then it would show the translated category name.
Any idea how I could modify your code to do this ?
Thank you
Quote from Pablo Borysenco on October 23, 2024, 12:56ok! I'll pass your suggestion on to the developers
ok! I'll pass your suggestion on to the developers
Quote from conradude on October 23, 2024, 14:45Alright thanks !
Alright thanks !
Quote from conradude on October 30, 2024, 17:54Hello,
Using the link I gave you, I found out how to do it.
in classes/helper.php, line 159 I've added 'suppress_filter'=>trueSo now it's :
$args = array(
'style' => 'list',
'show_count' => 0,
'hide_empty' => $hide_empty,
'use_desc_for_title' => 1,
'child_of' => 0,
'hierarchical' => true,
'title_li' => '',
'show_option_none' => '',
'number' => '',
'echo' => 0,
'depth' => 0,
'current_category' => $selected,
'pad_counts' => 0,
'taxonomy' => $taxonomy,
'walker' => 'Walker_Category',
'suppress_filter'=>true);Doesn't work with hide_empty set to true though. I think there should be a conditional where you verify if the language is not the original, then hide_empty = false even though it's been set to true. But only for secondary languages.
Hello,
Using the link I gave you, I found out how to do it.
in classes/helper.php, line 159 I've added 'suppress_filter'=>true
So now it's :
$args = array(
'style' => 'list',
'show_count' => 0,
'hide_empty' => $hide_empty,
'use_desc_for_title' => 1,
'child_of' => 0,
'hierarchical' => true,
'title_li' => '',
'show_option_none' => '',
'number' => '',
'echo' => 0,
'depth' => 0,
'current_category' => $selected,
'pad_counts' => 0,
'taxonomy' => $taxonomy,
'walker' => 'Walker_Category',
'suppress_filter'=>true);
Doesn't work with hide_empty set to true though. I think there should be a conditional where you verify if the language is not the original, then hide_empty = false even though it's been set to true. But only for secondary languages.
Quote from Pablo Borysenco on October 31, 2024, 11:06Hello
hide_empty = false - I doubt this will solve the problem. Empty terms won't be hidden but the counter will still be 0.
Hello
hide_empty = false - I doubt this will solve the problem. Empty terms won't be hidden but the counter will still be 0.
Quote from conradude on October 31, 2024, 11:28Hello !
I meant the hide_empty from the snippet you can find on your FAQ.
Other than that, the code kind of works (you can see the link in the private field).
All the french translated categories are appearing with the good number of products. Only issue is that if I filter by a translated category, products don't appear. Can you tell me where I can find the function that modify the query so I can try and work on it ?
Thanks
Hello !
I meant the hide_empty from the snippet you can find on your FAQ.
Other than that, the code kind of works (you can see the link in the private field).
All the french translated categories are appearing with the good number of products. Only issue is that if I filter by a translated category, products don't appear. Can you tell me where I can find the function that modify the query so I can try and work on it ?
Thanks
Quote from Pablo Borysenco on October 31, 2024, 13:05You can use hook - woocommerce_product_query
For ajax mode - woof_products_query
You can use hook - woocommerce_product_query
For ajax mode - woof_products_query