This thread is resolved. Here is a description of the problem and solution.
Problem:
WooCommerce Multilingual - Product category base issue with children categories in an a tag.
Solution:
This issue is solved with the latest version of WPML (4.4.4).
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 25 replies, has 2 voices.
Last updated by Itamar 3 years, 6 months ago.
Assisted by: Itamar.
Author | Posts |
---|---|
December 20, 2019 at 11:37 am #5170259 | |
pierS-2 |
Hi again, the problem is not related to HTML block. We have the same problem also with attached link. Please let me know. |
December 22, 2019 at 9:16 pm #5180305 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. In this case, you need to insert the full path of the URL for the 'href' attribute. Please see the attached screenshot. Then the link supposes to work. On your site, the link is to another site and I couldn't find the product page, so I couldn't check it. Please let me know if this information is helpful to you. Regards, |
December 23, 2019 at 10:30 am #5183541 | |
pierS-2 |
HI AGAIN, It seems that you don't want to understand the problem. We already tried to add teh full url but once saved it is converted to the short url. It's the same problem as the link in top header. Please try and let me know |
December 24, 2019 at 3:40 pm #5189843 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. I'm sorry for the inconvenience that was caused to you. I have a request from you, please. Thanks, |
December 25, 2019 at 10:15 pm #5193263 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. I've progress here with this issue. It seems to be happening with child product categories that are placed in <a> tags. Tomorrow I'll be able to escalate this. Thanks, |
December 26, 2019 at 10:50 am #5195529 | |
pierS-2 |
HI, We have the same settings in permalinks live site. Please let me know what you found. regards |
December 26, 2019 at 8:22 pm #5197165 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi After a long debugging process, I've found what the issue on your site was. Can you please check that and confirm that the issue is solved? Thanks, |
December 27, 2019 at 11:08 am #5200021 | |
pierS-2 |
HI, It always worked before with the same /shop/ in different language folder. |
December 30, 2019 at 2:32 pm #5211769 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. I've escalated this issue to our second tier supporters. They will check it and once I have news from them I'll let you know here. Thank you for your patience. |
January 7, 2020 at 2:54 pm #5247811 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. Our second tier supporter was able to replicate this issue and found the source of the problem. The issue is now escalated to our developers. When I have more information on this issue, I'll let you know here. Regards, |
January 8, 2020 at 1:30 pm #5254699 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. As mentioned the issue is escalated to our developers. But meanwhile, we can share a workaround with you. Here is what you need to do. 1. Take a backup of your site. 2. Open the following file with the code editor that you are using. wp-content/plugins/sitepress-multilingual-cms/inc/absolute-links/absolute-links.class.php 3. At line 471 see this 'private function': private function get_regex_replacement( $def_url, $type, $type_id, $lang_negotiation, $lang, $dir_path, $home_url, $url_parts, $req_uri_params, $anchor_output ) { if ( $lang_negotiation == 1 && $lang ) { $langprefix = '/' . $lang; } else { $langprefix = ''; } $perm_url = '(' . rtrim( $home_url, '/' ) . ')?' . $langprefix . '/' . str_replace( '?', '\?', $dir_path ); $regk = '@href=[\'"](' . $perm_url . ')[\'"]@i'; $regv = 'href="' . '/' . ltrim( $url_parts[ 'path' ], '/' ) . '?' . $type . '=' . $type_id; if ( $req_uri_params != '' ) { $regv .= '&' . $req_uri_params; } $regv .= $anchor_output . '"'; $def_url[ $regk ] = $regv; return $def_url; } 4. Add this code to the function: //Check if have more than 1 slug on type_id. If so, explode then get only the last item: if (strpos($type_id, '/') !== false) { $type_id_strings = explode("/", $type_id); $type_id = end($type_id_strings); } 5. It will look like this after the change: private function get_regex_replacement( $def_url, $type, $type_id, $lang_negotiation, $lang, $dir_path, $home_url, $url_parts, $req_uri_params, $anchor_output ) { //Check if have more than 1 slug on type_id. If so, explode then get only the last item: if (strpos($type_id, '/') !== false) { $type_id_strings = explode("/", $type_id); $type_id = end($type_id_strings); } if ( $lang_negotiation == 1 && $lang ) { $langprefix = '/' . $lang; } else { $langprefix = ''; } $perm_url = '(' . rtrim( $home_url, '/' ) . ')?' . $langprefix . '/' . str_replace( '?', '\?', $dir_path ); $regk = '@href=[\'"](' . $perm_url . ')[\'"]@i'; $regv = 'href="' . '/' . ltrim( $url_parts[ 'path' ], '/' ) . '?' . $type . '=' . $type_id; if ( $req_uri_params != '' ) { $regv .= '&' . $req_uri_params; } $regv .= $anchor_output . '"'; $def_url[ $regk ] = $regv; return $def_url; } 6. Save the chenge and now the problem should be fixed. Note: You might need to re-save the related strings in String Translation. If you update WPML with a new version and this fix is not included yet, you will have to add it again. When the version with the fix will be released I'll let you know here. Regards, |
October 18, 2020 at 6:47 am #7251029 | |
Itamar Supporter
Languages: English (English ) Hebrew (עברית ) Timezone: Asia/Jerusalem (GMT+03:00) |
Hi. This issue is solved with the latest version of WPML (4.4.4). Regards, |