This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 4 replies, has 2 voices.

Last updated by Raja Mohammed 3 weeks, 2 days ago.

Assigned support staff: Raja Mohammed.

Author Posts
September 16, 2019 at 10:08 am #4578533

severinP

Hello, my previous support ticket ( https://wpml.org/forums/topic/wcml-featured-product-on-non-original-language-is-not-working/ ) was closed by mistake and I was not able to answer,

Here is the original message:

There is an issue with WCML, when clicking on the featured icon (the star) on the products listing an ajax request is supposed to be made to update the featured status

While this works without issue on the default language, this feature has been disabled on other languages by WCML, without any message or information, making it very confusing

Please have this feature enabled on all languages, it should be fairly easy to intercept the request and translate the id of the product rather than preventing the action altogether in javascript.

Clarification:
As you can see on the uploaded image, when you go on products other than the default language (All languages or Hungarian in that case)
The star on the second product does not work

This is caused by this piece of code in woocommerce-multilingual/inc/admin-menus/class-wcml-admin-menus.php (line 170)

                //lock feature for translations
                jQuery( document ).on( 'click', '.featured a', function() {
					if ( jQuery( this ).closest( 'tr' ).find( '.quick_hide' ).size() > 0 ) {
						return false;
					}

				} );

By deleting this script and adding this filter

add_filter( 'admin_url', function ( $url, $path ) {
			if ( strpos( $path, 'admin-ajax.php?action=woocommerce_feature_product&product_id=' ) === 0 ) {
				global $sitepress;
				parse_str( $path, $query_array );
				$product_id = $query_array['product_id'];
				$product_id = apply_filters( 'wpml_object_id', $product_id, 'product', true, $sitepress->get_default_language() );
				$url = add_query_arg( 'product_id', $product_id, $url );
			}
			return $url;
		}, 10, 2 );

I was able to get the feature to work as expected

Please implement the fix

September 18, 2019 at 12:58 pm #4596915

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thanks for reporting,

The fix seems to work fine in a clean installation, I have asked the second tier to have deeper look and suggest the feasibility to be added in the plugin code. I will keep you posted with any updates.

Kind regards
Raja

September 19, 2019 at 10:52 am #4603829

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

This is categorized as feature request, I would request you to send this through our dedicated feature request portal https://wpml.org/suggest-a-new-feature-for-wpml/ . This way it reaches the right person.

Kind regards
Raja

September 23, 2019 at 10:51 am #4622503

severinP

Yet the fact that there is absolutely no information that this feature is disabled makes it a bug

September 24, 2019 at 5:23 am #4628073

Raja Mohammed
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I can understand your concerns.

However, the feature is deliberately disabled to avoid confusion over marking the translation as featured and certainly some of them expect it to be applied only for the translation and doesn't want to be synched with original content and hence we follow the same pattern of synchronization from the default language to other translations.

I hope that explains the reason.