Home Forums WoodMart support forum The problem of translating categories through the plugin WPML

The problem of translating categories through the plugin WPML

Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #487600

    Supersheva
    Participant

    Hello
    The site uses a translation plugin WPML.
    Problem with translating Product Categories, each has its own layout.
    Translation of Product Categories layouts could not be completed due to a fatal error:

    [08-Aug-2023 12:12:47 UTC] PHP Fatal error: Uncaught Error: Call to undefined function wc_print_notices() in /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/woocommerce/includes/wc-template-functions.php:3860
    Stack trace:
    #0 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/themes/woodmart/inc/modules/layouts/elementor/woocommerce/class-notices.php(113): woocommerce_output_all_notices()
    #1 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/controls-stack.php(2243): XTS\Modules\Layouts\Notices->render()
    #2 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/widget-base.php(609): Elementor\Controls_Stack->render_by_mode()
    #3 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/widget-base.php(673): Elementor\Widget_Base->render_content()
    #4 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/db.php(202): Elementor\Widget_Base->render_plain_content()
    #5 /sata2/home/users/grandmas/www/www.steli.ua/wp-con in /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 3860

    For this reason, the translation cannot be completed.
    Plugin developers recommended to contact you.
    On the WordPress site, theme Woodmart and all plugins are updated to the latest versions.

    Please help.

    #487695

    Luke Nielsen
    Keymaster

    Hello,

    May I request you send me access to the admin dashboard so I will check that issue on your side?

    Thank you in advance.

    Kind Regards

    #487754

    Supersheva
    Participant

    Yes.
    Please check Extra information:

    #487975

    Luke Nielsen
    Keymaster

    Hello,

    Please add the below code to the functions.php file in your child theme and then clear the cache and recheck the issue.

    add_action( 'woocommerce_before_template_part', function () {
    	global $product;
    	if ( wp_is_json_request() && ! $product ) {
    		$random_product = new WP_Query(
    			array(
    				'posts_per_page' => '1',
    				'post_type'      => 'product',
    			)
    		);
    
    		while ( $random_product->have_posts() ) {
    			$random_product->the_post();
    			$product_id = get_the_ID();
    		}
    
    		wp_reset_postdata();
    
    		$product = wc_get_product( $product_id) ;
    	}
    } );

    Let me know the result.

    Kind Regards

    #488009

    Supersheva
    Participant

    The page with a translation into Russian has ceased to load constantly.
    But the translation problem remains. The banner and thumbnails of subcategories are not displayed in the translation. Screenshot is attached.
    And in the admin panel, the translation icon is constantly spinning. This means it’s not finished. Screenshot is attached.

    Attachments:
    You must be logged in to view attached files.
    #488147

    Artem Temos
    Keymaster

    We understand that the issue you are experiencing is likely related to the WPML due to an incorrect translation of a custom field. The field in question, which needs to be translated, contains an array with 3 keys (https://monosnap.com/file/Rw2fGnD68uvNOuwT3djUQta2FN3mw2), while WPML is displaying only an array with 2 keys (https://monosnap.com/file/uqqpswxPOohXVwrFWp96VtMKpVyzK6). Therefore, could you please contact the technical support of WPML to resolve this issue?

    #488695

    Supersheva
    Participant

    Please check answer from WPML developers:
    Thanks for the update.

    I checked again, the translation still can’t be loaded, as there is still an error on the site that does not allow the translation to be completed:

    [14-Aug-2023 18:57:10 UTC] PHP Fatal error: Uncaught Error: Call to undefined function wc_print_notices() in /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/woocommerce/includes/wc-template-functions.php:3878
    Stack trace:
    #0 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/themes/woodmart/inc/modules/layouts/elementor/woocommerce/class-notices.php(113): woocommerce_output_all_notices()
    #1 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/controls-stack.php(2243): XTS\Modules\Layouts\Notices->render()
    #2 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/widget-base.php(609): Elementor\Controls_Stack->render_by_mode()
    #3 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/widget-base.php(673): Elementor\Widget_Base->render_content()
    #4 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/db.php(202): Elementor\Widget_Base->render_plain_content()
    #5 /sata2/home/users/grandmas/www/www.steli.ua/wp-con in /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 3878
    [14-Aug-2023 18:57:12 UTC] PHP Fatal error: Uncaught Error: Call to undefined function wc_print_notices() in /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/woocommerce/includes/wc-template-functions.php:3878
    Stack trace:
    #0 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/themes/woodmart/inc/modules/layouts/elementor/woocommerce/class-notices.php(113): woocommerce_output_all_notices()
    #1 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/controls-stack.php(2243): XTS\Modules\Layouts\Notices->render()
    #2 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/widget-base.php(609): Elementor\Controls_Stack->render_by_mode()
    #3 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/base/widget-base.php(673): Elementor\Widget_Base->render_content()
    #4 /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/elementor/includes/db.php(202): Elementor\Widget_Base->render_plain_content()
    #5 /sata2/home/users/grandmas/www/www.steli.ua/wp-con in /sata2/home/users/grandmas/www/www.steli.ua/wp-content/plugins/woocommerce/includes/wc-template-functions.php on line 3878

    Can the theme developers remove it so we can continue with the translation issue? I understand the idea of ​​what the theme developer is writing about, but in order to check this, you need to complete the translation. As far as I can see, the Woodmart theme overwrites some templates and an error occurs somewhere at this stage.

    #488832

    Luke Nielsen
    Keymaster

    Hello,

    Could you please share the link when transitioning to which the error is displayed or how you see this error as it should not be there?

    Kind Regards

    #489053

    Supersheva
    Participant

    You need to follow these steps:

    – Activate debug.log error log

    – Open the page
    https://steli.ua/wp-admin/edit.php?post_type=woodmart_layout&wd_layout_type_tab=shop_archive

    – This fatal error will be added to the error log

    #489068

    Luke Nielsen
    Keymaster

    Hello,

    Please add the below custom code to the child theme and then recheck the issue.

    add_action('init', function () {
    	if ( ! empty( $_SERVER['REQUEST_URI'] ) && false !== strpos( $_SERVER['REQUEST_URI'], trailingslashit( rest_get_url_prefix() ) ) && function_exists( 'wc_load_cart' ) && ! function_exists( 'wc_print_notices' ) ) {
    		wc_load_cart();
    	}
    }, 1000);

    Kind Regards

    #489312

    Supersheva
    Participant

    Your code didn’t help. Problem still exists.

    #489319

    Luke Nielsen
    Keymaster

    Hello,

    This code fixed the error from this response: https://xtemos.com/forums/topic/the-problem-of-translating-categories-through-the-plugin-wpml/#post-488695

    And checking the logs on the site, we do not see that error.

    Kind Regards

    #490440

    Supersheva
    Participant

    Now category layout pages have different addresses and they don’t open. More precisely redirected to the main page.
    Category layout page example:
    https://steli.ua/woodmart_layout/steli/
    A page translation
    https://steli.ua/ru/woodmart_layout_ru/potolky/
    leads to a 404 error page

    #490461

    Luke Nielsen
    Keymaster

    Hello,

    Sorry, we have fixed that, please recheck the issue and let me know.

    In the meantime, feel free to ask me any questions you may have.

    Kind Regards

    #490559

    Supersheva
    Participant

    Problem still exists.

    #490700

    Luke Nielsen
    Keymaster

    Hello,

    At the moment there is no error about which you wrote https://xtemos.com/forums/topic/the-problem-of-translating-categories-through-the-plugin-wpml/#post-490440 could you clarify which error still remains?

    Kind Regards

    #490755

    Supersheva
    Participant

    This problem still exists:
    Now category layout pages have different addresses and they don’t open. More precisely redirected to the main page.
    Category layout page example:
    https://steli.ua/woodmart_layout/steli/
    A page translation
    https://steli.ua/ru/woodmart_layout_ru/potolky/
    leads to a 404 error page

    #491305

    Luke Nielsen
    Keymaster

    Hello,

    Category page: https://steli.ua/product-category/steli-uk/

    A page translation: https://steli.ua/ru/product-category/steli-ru/

    As you can see, the translation works.

    Kind Regards

    • This reply was modified 1 year, 3 months ago by Luke Nielsen.
Viewing 18 posts - 1 through 18 (of 18 total)