Forum Replies Created

Viewing 2 replies - 46 through 47 (of 47 total)
  • I had to switch the setting “The language code is added to all urls” to “The language is set from content” because I started getting 404 errors all over the place and could only get to the Home page without getting 404s.

    Switching this option removes the language code, but “solves” my 404 problem. I guess that since I didn’t flush the cache (I’m using WP Super Cache), I worked for a while with a previous setting I had (language set from content).

    Regarding wpml-config.xml, miguelcortereal is right. The wpml-config.xml file is not being included at the Strings translation tab, until you copy it to another plugin folder.

    Hi Chouby.

    I really appreciate the work you’ve done with this plugin. For now, I’ve been looking for a solution to a situation partially similar to the one indicated here. This is my information:

    1. My Polylang version is 1.1.4 (current).
    2. I deleted, reinstalled WordPress with all the plugins I’m currently using, then deleted and reinstalled Polylang, and I still have the same issue.
    3. My permalink settings are https://www.mywebsite.com/blog/%category%/%postname%/
    4. I’m not using a static front page
    5. My Polylang settings are:
    a) Language set according to browser preference
    b) The language code is added to all urls
    c) Remove /language/ in pretty permalinks
    d) Activate languages and translations for all types.
    6. My child theme is Twenty Twelve Dark, which is referenced to the Twenty Twelve WordPress standard theme.

    The plugins that create conflicts are both the Yoast SEO and the WP e-Commerce plugins.
    My website is bilingual (English/Spanish), using English as standard.
    In my case, define(‘lang’,’ ‘), as the WordPress standard installation sets.

    Even though the wpml-config.xml file exists at the Yoast SEO folder, I don’t see their strings at the Polylang’s Strings translation tab.
    So, based on miguelcortereal comments, I created a wpml-config.xml file and then I placed it into my child theme folder, and later into the WP e-commerce folder, just to test further.

    In both cases, the Polylang’s Strings translation tab were populated with both the Yoast SEO and the WP e-Commerce strings, and in both cases, the Group column either showed the child theme name or the WP e-Commerce plugin name.

    Here are the contents of my xml file:

    <wpml-config>
        <admin-texts>
            <key name="product_list_url" />
            <key name="shopping_cart_url" />
            <key name="checkout_url" />
            <key name="transact_url" />
            <key name="user_account_url" />
            <key name="wpseo_titles">
                <key name="title-home" />
                <key name="metadesc-home" />
                <key name="metakey-home" />
                <key name="title-post" />
                <key name="metadesc-post" />
                <key name="metakey-post" />
                <key name="title-page" />
                <key name="metadesc-page" />
                <key name="metakey-page" />
                <key name="title-attachment" />
                <key name="metadesc-attachment" />
                <key name="metakey-attachment" />
                <key name="title-category" />
                <key name="metadesc-category" />
                <key name="metakey-category" />
                <key name="title-post_tag" />
                <key name="metadesc-post_tag" />
                <key name="metakey-post_tag" />
                <key name="title-author" />
                <key name="metadesc-author" />
                <key name="metakey-author" />
                <key name="title-archive" />
                <key name="metadesc-archive" />
                <key name="title-search" />
                <key name="title-404" />
            </key>
        </admin-texts>

    In my case, my problem is that the WP e-Commerce theme works centered around the Products Page. The wp_options table shows the product_list_url value as https://www.mysite.com/en/products-page/.

    So, if I put the xml file into either of the 2 locations indicated before, and then I change the Polylang Spanish product_list_url string translation to https://www.mysite.com/es/pagina-de-productos/ as the permalink for the page in Spanish indicates, and then I try to navigate there, no problem happens.

    But, if I click on “more details” at the grid view for the product currently displayed, then I get the 404 error, which is now titled in Spanish Página no encontrada, instead of Page not Found, because I translated the title-404 Yoast SEO entry at the Strings translation tab, with the xml file located at either the child them or the WP e-Commerce folders.

    If I do all these operations selecting the English language, I don’t have any 404 problems. It seems to me that this happens because the product_list_url at the wp_options table is already in English and it’s not being translated.

    If I erase the new xml file and I try to click the “more details” link while on grid view for the product being displayed, my website navigates towards https://www.mysite.com/es/products-page/<category in Spanish>/<post title in Spanish>/, without giving me the 404 error.

    The odd thing is that the Products Page part of the permalink never translates. It stays in English.

    I checked the wpsc-functions.php for the WP e-Commerce plugin and found these functions related to the Products Page

    function wpsc_get_page_post_names() {
    	$wpsc_page['products']            = basename( get_option( 'product_list_url' ) );
    	$wpsc_page['checkout']            = basename( get_option( 'checkout_url' ) );
    	$wpsc_page['transaction_results'] = basename( get_option( 'transact_url' ) );
    	$wpsc_page['userlog']             = basename( get_option( 'user_account_url' ) );
    
    	return $wpsc_page;
    }
    
    function wpsc_add_https_to_page_url_options( $url ) {
    	return str_replace( 'https://', 'https://', $url );
    }
    if ( is_ssl() ) {
    	add_filter( 'option_product_list_url',  'wpsc_add_https_to_page_url_options' );
    	add_filter( 'option_shopping_cart_url', 'wpsc_add_https_to_page_url_options' );
    	add_filter( 'option_transact_url',      'wpsc_add_https_to_page_url_options' );
    	add_filter( 'option_user_account_url',  'wpsc_add_https_to_page_url_options' );
    }
    
    function wpsc_update_permalink_slugs() {
    	global $wpdb;
    
    	$wpsc_pageurl_option = array(
    		'product_list_url'  => '[productspage]',
    		'shopping_cart_url' => '[shoppingcart]',
    		'checkout_url'      => '[shoppingcart]',
    		'transact_url'      => '[transactionresults]',
    		'user_account_url'  => '[userlog]'
    	);
    
    	$ids = array();
    
    	foreach ( $wpsc_pageurl_option as $option_key => $page_string ) {
    		$id = $wpdb->get_var( "SELECT <code>ID</code> FROM <code>{$wpdb->posts}</code> WHERE <code>post_type</code> = 'page' AND <code>post_content</code> LIKE '%$page_string%' LIMIT 1" );
    
    		if ( ! $id )
    			continue;
    
    		$ids[$page_string] = $id;
    
    		$the_new_link = get_page_link( $id );
    
    		if ( stristr( get_option( $option_key ), "https://" ) )
    			$the_new_link = str_replace( 'https://', "https://", $the_new_link );
    
    		if ( $option_key == 'shopping_cart_url' )
    			update_option( 'checkout_url', $the_new_link );
    
    		update_option( $option_key, $the_new_link );
    	}
    
    	update_option( 'wpsc_shortcode_page_ids', $ids );
    }

    these other 2 files of the WP e-Commerce plugin include the product_list_url too. The shopping cart, transaction results and user account pages create the same problem, but I’m not using them for now.

    wpsc-cart_widget.php
    wpsc-shopping_cart_page.php

    What I’m looking for is to present the Product Page permalink part in Spanish when Spanish is selected or in English if English is selected and avoid the 404 error. On the other hand, it seems odd to me that the wpml-config.xml file located at the Yoast SEO folder is not included at the Strings translation tab until I copy it into my child theme folder or the WP e-Commerce folder, and even then, the WP e-Commerce plugin tries to load the English permalink for the Products page, as it is in the wp_options table and generates 404 errors if it tries to load the translated permalink.

    What do you recommend me to do?

    My website is https://www.reactorshop.com, if you have a chance to navigate and see the Products Page permalink part always in English, when you select Spanish and right after you click at the Pagina de Productos Menu. Just hover your mouse over the “Mas Detalles” link and you’ll see.

    I only listed one product, in case I have to redo the website installation and configuration again.

    If you require any additional information, please don’t hesitate to ask. Thank you in advance.

Viewing 2 replies - 46 through 47 (of 47 total)