Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing an issue where the 'Show currencies based on' setting in Woocommerce > Woocommerce Multilingual & Multicurrency under the Multicurrency tab changes from 'Client location' to 'Site language' when regenerating feeds in the CTX Feed Pro plugin, we have identified the cause.
Solution:
We found that the CTX Feed Pro plugin is designed to change the 'Show currencies based on' setting during the regeneration process and then revert it back once completed. This process should take around 30 minutes. If you encounter an error or interruption during this process:
1. Manually switch the setting back to 'Client Location' to ensure your site's configuration is correct.
2. We recommend contacting the plugin author to report the issue and suggest they consider updating the functionality to prevent potential disruptions during feed regeneration.

Please note that this solution might not apply to your case if it's outdated or not relevant. If the issue persists, we highly recommend checking related known issues, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If needed, don't hesitate to open a new support ticket with us for further assistance.

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.

Tagged: 

This topic contains 7 replies, has 2 voices.

Last updated by Bruno Kos 3 weeks, 3 days ago.

Assisted by: Bruno Kos.

Author Posts
March 26, 2024 at 10:54 am

przemyslawM-8

Hey, I'm writing again (the previous chat was closed). I'm encountering an issue with the WPML and CTX Feed Pro plugins. In Woocommerce > Woocommerce Multilingual & Multicurrency, under the Multicurrency tab, the setting changes from Client location to Site language whenever any feed regeneration is initiated in the CTX Feed plugin.

March 26, 2024 at 11:27 am
March 26, 2024 at 11:37 am #15450878

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Escalated to Compatibility team

March 29, 2024 at 6:27 am #15463048

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

It seems that the plugin is changing this setting this intentionally in the before_woo_feed_get_product_information hook at app/public/wp-content/plugins/webappick-product-feed-for-woocommerce-pro/libs/webappick-product-feed-for-woocommerce/V5/Compatibility/woocommerce_wpmlCompatibility.php.

Can you please try the following:

1. Navigate to the `app/public/wp-content/plugins/webappick-product-feed-for-woocommerce-pro/libs/webappick-product-feed-for-woocommerce/includes/` directory.
2. Open the `action-handler.php` file.
3. Locate the `woo_feed_get_product_information()` function, which is around line 120.
4. Before every `wp_send_json_error` snippet, add the following line: `do_action('ctx_feed_after_save_feed_file');`.
5. Specifically, you should replace snippets like this:

wp_send_json_error(
	array(
		'message' => esc_html__( 'No products found. Add product or change feed config before generate the feed.', 'woo-feed' ),
		'success' => false,
	)
);

With:

do_action('ctx_feed_after_save_feed_file');
wp_send_json_error(
	array(
		'message' => esc_html__( 'No products found. Add product or change feed config before generate the feed.', 'woo-feed' ),
		'success' => false,
	)
);
March 29, 2024 at 12:14 pm #15464248

przemyslawM-8

Unfortunately it does not working.
I've changed the whole function:

function woo_feed_get_product_information() {
check_ajax_referer( 'wpf_feed_nonce' );

// Check user permission
if ( ! current_user_can( 'manage_woocommerce' ) ) {
Logs::write_debug_log( 'User doesnt have enough permission.' );
do_action('ctx_feed_after_save_feed_file');
wp_send_json_error( esc_html__( 'Unauthorized Action.', 'woo-feed' ) );
wp_die();
}

if ( ! isset( $_REQUEST['feed_info'] ) ) {
Logs::write_debug_log( 'Feed name not submitted.' );
do_action('ctx_feed_after_save_feed_file');
wp_send_json_error( esc_html__( 'Invalid Request.', 'woo-feed' ) );
wp_die();
}

$feed_info = $_REQUEST['feed_info'];
$config = new Config( $feed_info );
if ( CommonHelper::wc_version_check( 3.0 ) ) {
Logs::delete_log( $config->get_feed_file_name() );
Logs::write_log( $config->get_feed_file_name(), sprintf( 'Getting Data for %s feed.', $config->get_feed_file_name() ) );
Logs::write_log( $config->get_feed_file_name(), 'Generating Feed VIA Ajax...' );
Logs::write_log( $config->get_feed_file_name(), 'Feed Config::' . PHP_EOL . print_r( $config->get_config(), true ), 'info' );

try {
// Hook Before Query Products
do_action( 'before_woo_feed_get_product_information', $config );

// Get Product Ids
$ids = FeedHelper::get_product_ids( $feed_info );

// Hook After Query Products
do_action( 'after_woo_feed_get_product_information', $config );

Logs::write_log( $config->get_feed_file_name(), sprintf( 'Total %d product found', is_array( $ids ) && ! empty( $ids ) ? count( $ids ) : 0 ) );

if ( is_array( $ids ) && ! empty( $ids ) ) {
rsort( $ids ); // sorting ids in descending order

Logs::write_log( $config->get_feed_file_name(), sprintf( 'Total %d batches', count( $ids ) ) );

wp_send_json_success(
array(
'product_ids' => $ids,
'total' => count( $ids ),
'success' => true,
'extra' => [
'should_generate_feed_by_ajax' => FeedHelper::should_generate_feed_by_ajax(),
],
)
);
} else {
do_action('ctx_feed_after_save_feed_file');
wp_send_json_error(
array(
'message' => esc_html__( 'No products found. Add product or change feed config before generate the feed.', 'woo-feed' ),
'success' => false,
)
);
}

wp_die();
} catch ( \Throwable $e ) {
$message = 'Error getting Product Ids.' . PHP_EOL . 'Caught Exception :: ' . $e->getMessage();
Logs::write_log( $config->get_feed_file_name(), $message );
Logs::write_fatal_log( $message, $e );
do_action('ctx_feed_after_save_feed_file');
wp_send_json_error(
array(
'message' => esc_html__( 'Failed to fetch products.', 'woo-feed' ),
'success' => false,
)
);
wp_die();
}
} else { // For Older version of WooCommerce
do_action( 'before_woo_feed_get_product_information', $config );
$products = wp_count_posts( 'product' );
do_action( 'after_woo_feed_get_product_information', $config );

if ( $products->publish > 0 ) {
wp_send_json_success( array( 'product' => $products->publish, 'success' => true ) );
} else {
do_action('ctx_feed_after_save_feed_file');
wp_send_json_error(
array(
'message' => esc_html__( 'No products found. Add product or change feed config before generate the feed.', 'woo-feed' ),
'success' => false,
)
);
}

wp_die();
}
}

April 2, 2024 at 6:29 am #15471101

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Can you please try the following:

1. Open your browser's developer console (usually by pressing F12 or right-clicking on the page and selecting "Inspect", then going to the "Console" tab).
2. Check if there are any JavaScript error messages displayed in the console.
3. If you find any errors, please take a screenshot and send it to us.

April 2, 2024 at 10:41 am #15472102

przemyslawM-8

Unfortunately there is no errors

April 2, 2024 at 12:43 pm #15472940

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

Escalated to Compatibility team

April 4, 2024 at 6:08 am #15480972

Bruno Kos
Supporter

Languages: English (English ) German (Deutsch ) French (Français )

Timezone: Europe/Zagreb (GMT+02:00)

We discovered that the plugin operates by changing the "Show currencies based on" setting from "Client Location" to "Site Language" upon clicking the "Regenerate" button, and then switches it back after regenerating the field. This process was observed to work as designed, taking around 30 minutes for completion and successfully restoring the setting to "Client Location". However, this approach has drawbacks, such as potential issues if an error occurs or the process is interrupted, leaving the site with incorrect settings during the regeneration time.

Can you please do the following:
1. If you experience an error or interruption during this process, manually switch the setting back to "Client Location" to avoid prolonged periods with incorrect site configuration.
2. Consider reaching out to the plugin author to report these issues with the current workflow. Tell them how the regeneration process could potentially disrupt site operations and suggest looking into an update or modification of this functionality.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.