Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter wm44

    (@wm44)

    Yes that’s what i mentionned above it has been done, i already sent in my first message the changes i did, here it’s again: my-text-domain

    
    if ( is_user_logged_in() ) {
     $items .= '<li><a href="' . pll_get_post('25026') . '">' . pll__( 'Spin Dashboard','thegem' ) . '</a></li>';
     $items .= '<li><a href="' . pll_get_post('37') . '">' . pll__( 'My Account','thegem' ) . '</a></li>';
     $items .= '<li><a href="' . pll_get_post('24842') . '">' . pll__( 'Sign Out','thegem' ) . '</a></li>';
     } else {
     $items .= '<li><a href="' .  pll_get_post('37').'">' . pll__( 'Sign In','thegem' ) . '</a></li>';
       }  
    

    Sign In, Sign Out, Spin Dashboard don’t appear in the PO file even after sync and not in Loco Translate

    Thank you anyway
    and have a good day

    Thread Starter wm44

    (@wm44)

    Hello,
    Thank for your message,
    My theme is already translated, all PO/MO files are there and all links and pages are working fine.

    My issue is only what i mentioned above this part that has been added to the primary menu from the functions.php file “Sign In and Sign Out plus one extra page”

    Thread Starter wm44

    (@wm44)

    
    $items .= '<li><a href="' . get_page_link('25026') . '">' . __( 'Spin Dashboard','thegem' ) . '</a></li>';
     $items .= '<li><a href="' . get_page_link('37') . '">' . __( 'My Account','thegem' ) . '</a></li>';
     $items .= '<li><a href="' . get_page_link('24842') . '">' . __( 'Sign Out','thegem' ) . '</a></li>';
    
    Thread Starter wm44

    (@wm44)

    Hello Jon,

    Yes the text domain is defined in the style.css

    
    License URI: license.txt
    Text Domain: thegem
    */
    

    Is because the in functions code it’s a link of page ID get_page_link ?
    Maybe it should be something else, because this id is for the english version.
    `
    $items .= ‘

    Thread Starter wm44

    (@wm44)

    Sorry i think the code wasn’t copied in a proper way in my message:

    function add_login_logout_register_menu( $items, $args ) {
     if ( $args->theme_location != 'primary' ) {
     return $items;
     }
     
     if ( is_user_logged_in() ) {
     $items .= '<li><a href="' . get_page_link('25026') . '">' . __( 'Spin Dashboard' ) . '</a></li>';
     $items .= '<li><a href="' . get_page_link('37') . '">' . __( 'My Account' ) . '</a></li>';
     $items .= '<li><a href="' . get_page_link('24842') . '">' . __( 'Sign Out' ) . '</a></li>';
     } else {
     $items .= '<li><a href="' .  get_page_link('37').'">' . __( 'Sign In' ) . '</a></li>';
      // $items .= '<li><a href="' . wp_registration_url() . '">' . __( 'Sign Up' ) . '</a></li>';
       }
     
     return $items;
    }
     
    add_filter( 'wp_nav_menu_items', 'add_login_logout_register_menu', 199, 2 );
    
    function iconic_register_redirect( $redirect ) {
        //return wc_get_page_permalink( 'home' );
        return home_url( '/#plan_pricing' );
    
    }
     
    add_filter( 'woocommerce_registration_redirect', 'iconic_register_redirect' );
    
    add_filter( 'woocommerce_add_cart_item_data', 'woo_custom_add_to_cart' );
    
    function woo_custom_add_to_cart( $cart_item_data ) {
    
        global $woocommerce;
        $woocommerce->cart->empty_cart();
    
        // Do nothing with the data and return
        return $cart_item_data;
    }
    
    add_action( 'woocommerce_thankyou', 'autocomplete_all_orders' );
    function autocomplete_all_orders( $order_id ) { 
    
        if ( ! $order_id ) {
            return;
        }
    
        $order = wc_get_order( $order_id );
        $order->update_status( 'completed' );
    }   
    
    Thread Starter wm44

    (@wm44)

    function add_login_logout_register_menu( $items, $args ) {
    if ( $args->theme_location != ‘primary’ ) {
    return $items;
    }

    if ( is_user_logged_in() ) {
    $items .= ‘

    • ‘ . __( ‘Spin Dashboard’ ) . ‘
    • ‘;
      $items .= ‘

    • ‘ . __( ‘My Account’ ) . ‘
    • ‘;
      $items .= ‘

    • ‘ . __( ‘Sign Out’ ) . ‘
    • ‘;
      } else {
      $items .= ‘

    • ‘ . __( ‘Sign In’ ) . ‘
    • ‘;
      // $items .= ‘

    • ‘ . __( ‘Sign Up’ ) . ‘
    • ‘;
      }

      return $items;
      }

      add_filter( ‘wp_nav_menu_items’, ‘add_login_logout_register_menu’, 199, 2 );

      function iconic_register_redirect( $redirect ) {
      //return wc_get_page_permalink( ‘home’ );
      return home_url( ‘/#plan_pricing’ );

      }

      add_filter( ‘woocommerce_registration_redirect’, ‘iconic_register_redirect’ );

      add_filter( ‘woocommerce_add_cart_item_data’, ‘woo_custom_add_to_cart’ );

      function woo_custom_add_to_cart( $cart_item_data ) {

      global $woocommerce;
      $woocommerce->cart->empty_cart();

      // Do nothing with the data and return
      return $cart_item_data;
      }

      add_action( ‘woocommerce_thankyou’, ‘autocomplete_all_orders’ );
      function autocomplete_all_orders( $order_id ) {

      if ( ! $order_id ) {
      return;
      }

      $order = wc_get_order( $order_id );
      $order->update_status( ‘completed’ );
      }

    Thread Starter wm44

    (@wm44)

    Thank you Jon,
    I just renamed the file terms.php and i think that everything is working fine

    I have a last question about menu translation
    Shall I open another topic for it?

    My primary menu works fine and switch betwwen English and French without any problem.

    But i have a SIGN IN AND SIGN OUT and another page link IN MY MENU, THESE HAS BEEN ADDED BY THE functions.php file and ofcourse i can’t see it in the wp-admin menus
    So i can’t translate it

    Is there any way to translate it from the fonctions.php file to switch between the 2 languages?

    Here below the code in the functions file:

    function add_login_logout_register_menu( $items, $args ) {
    if ( $args->theme_location != ‘primary’ ) {
    return $items;
    }

    if ( is_user_logged_in() ) {
    $items .= ‘

    • ‘ . __( ‘Spin Dashboard’ ) . ‘
    • ‘;
      $items .= ‘

    • ‘ . __( ‘My Account’ ) . ‘
    • ‘;
      $items .= ‘

    • ‘ . __( ‘Sign Out’ ) . ‘
    • ‘;
      } else {
      $items .= ‘

    • ‘ . __( ‘Sign In’ ) . ‘
    • ‘;
      // $items .= ‘

    • ‘ . __( ‘Sign Up’ ) . ‘
    • ‘;
      }

      return $items;
      }

      add_filter( ‘wp_nav_menu_items’, ‘add_login_logout_register_menu’, 199, 2 );

      function iconic_register_redirect( $redirect ) {
      //return wc_get_page_permalink( ‘home’ );
      return home_url( ‘/#plan_pricing’ );

      }

      add_filter( ‘woocommerce_registration_redirect’, ‘iconic_register_redirect’ );

      add_filter( ‘woocommerce_add_cart_item_data’, ‘woo_custom_add_to_cart’ );

      function woo_custom_add_to_cart( $cart_item_data ) {

      global $woocommerce;
      $woocommerce->cart->empty_cart();

      // Do nothing with the data and return
      return $cart_item_data;
      }

      add_action( ‘woocommerce_thankyou’, ‘autocomplete_all_orders’ );
      function autocomplete_all_orders( $order_id ) {

      if ( ! $order_id ) {
      return;
      }

      $order = wc_get_order( $order_id );
      $order->update_status( ‘completed’ );
      }

    Thread Starter wm44

    (@wm44)

    Hi,
    I compared both, can’t see important difference between the 2 files:
    Woocommerce one:

    <p class=”form-row terms wc-terms-and-conditions”>
    <label class=”woocommerce-form__label woocommerce-form__label-for-checkbox checkbox”>
    <input type=”checkbox” class=”woocommerce-form__input woocommerce-form__input-checkbox input-checkbox” name=”terms” <?php checked( apply_filters( ‘woocommerce_terms_is_checked_default’, isset( $_POST[‘terms’] ) ), true ); ?> id=”terms” /> <span><?php printf( __( ‘I’ve read and accept the terms & conditions‘, ‘woocommerce’ ), esc_url( wc_get_page_permalink( ‘terms’ ) ) ); ?></span> <span class=”required”>*</span>
    </label>
    <input type=”hidden” name=”terms-field” value=”1″ />
    </p>

    And the theme one:

    <p class=”form-row terms wc-terms-and-conditions”>

    <input type=”checkbox” class=”woocommerce-form__input woocommerce-form__input-checkbox input-checkbox gem-checkbox” name=”terms” <?php checked( apply_filters( ‘woocommerce_terms_is_checked_default’, isset( $_POST[‘terms’] ) ), true ); ?> id=”terms” />
    <label for=”terms” class=”woocommerce-form__label woocommerce-form__label-for-checkbox checkbox”><?php printf( __( ‘I’ve read and accept the terms & conditions‘, ‘woocommerce’ ), esc_url( wc_get_page_permalink( ‘terms’ ) ) ); ?> <span class=”required”>*</span></label>
    <input type=”hidden” name=”terms-field” value=”1″ />
    </p>

    THE ONLY DIFFERENCE SEEMS TO BE HERE/
    class=”woocommerce-form__input woocommerce-form__input-checkbox input-checkbox gem-checkbox”

    Do you think I can replace the terms file with the original woocommerce one?

    Many thanks for your time and advices

    Thread Starter wm44

    (@wm44)

    Hello Jon,
    You are genius

    I changed the terms.php file name and IT WORKS FINE NOW

    But can i keep it like that? it doesn’t affect the website functions?

    THANK YOU VERY MUCH and have a great weekend

    Thread Starter wm44

    (@wm44)

    I would like too, Ofcourse I’m ok to try
    but i don’t know what to do exactly with the terms.php file

    Thread Starter wm44

    (@wm44)

    Hi Jon,
    Many thanks for your help,
    I couldn’t make it, all ok ok even with Loco transalte.
    Anyway i’m not progrmaer so i should be missing something.
    I thought solution might be changing a code line, it seams to be more difficult for me.

    Thanks again for trying to help

    Thread Starter wm44

    (@wm44)

    Hello,
    Thank you once again for your support.

    I’m running woocommerce 3.2.6
    wordpress 4.9.4
    and theme is Thegem

    Yes it’s only that label “I’ve read and accept the terms & conditions” that stays in English

    1- I changed the Ajax.php file with the one mentionned obove: https://github.com/marian-kadanka/woo-poly-integration/blob/888df716c43c0191c32e2b8bfc11d7ea0a9ed055/src/Hyyan/WPI/Ajax.php

    2- Translation is ok in the po files

    So I believe it’s as you mentionned that my theme is overriding this part of the screen

    Here is my terms.php file:
    <?php
    /**
    * Checkout terms and conditions checkbox
    *
    * @author WooThemes
    * @package WooCommerce/Templates
    * @version 3.1.1
    */
    if ( ! defined( ‘ABSPATH’ ) ) {
    exit;
    }

    $terms_page_id = wc_get_page_id( ‘terms’ );

    if ( $terms_page_id > 0 && apply_filters( ‘woocommerce_checkout_show_terms’, true ) ) :
    $terms = get_post( $terms_page_id );
    $terms_content = has_shortcode( $terms->post_content, ‘woocommerce_checkout’ ) ? ” : wc_format_content( $terms->post_content );

    if ( $terms_content ) {
    do_action( ‘woocommerce_checkout_before_terms_and_conditions’ );
    echo ‘<div class=”woocommerce-terms-and-conditions” style=”display: none; max-height: 200px; overflow: auto;”>’ . $terms_content . ‘</div>’;
    }
    ?>
    <p class=”form-row terms wc-terms-and-conditions”>
    <input type=”checkbox” class=”woocommerce-form__input woocommerce-form__input-checkbox input-checkbox gem-checkbox” name=”terms” <?php checked( apply_filters( ‘woocommerce_terms_is_checked_default’, isset( $_POST[‘terms’] ) ), true ); ?> id=”terms” />
    <label for=”terms” class=”woocommerce-form__label woocommerce-form__label-for-checkbox checkbox”><?php printf( __( ‘I’ve read and accept the terms & conditions‘, ‘woocommerce’ ), esc_url( wc_get_page_permalink( ‘terms’ ) ) ); ?> <span class=”required”>*</span></label>
    <input type=”hidden” name=”terms-field” value=”1″ />
    </p>
    <?php do_action( ‘woocommerce_checkout_after_terms_and_conditions’ ); ?>
    <?php endif; ?>

    Can you please advice for what to do with it

    Have a great day

    Thread Starter wm44

    (@wm44)

    Thank you for your message,

    I didn’t understand where the solution is.

    All my checkout page is well translated to French
    it’s only the check box valdation with “I’ve read and accept the terms & conditions” that stays in English

    Thanks again

Viewing 13 replies - 1 through 13 (of 13 total)