Hi Matteo,
I’m afraid I haven’t been great about making this plugin translatable. I’ll make that a high priority for the next release.
Scott
Hi Scott,
Any idea when the new version will be released with WPML support?
Thanks!
Hi Scott, WPML support would be a great thing.
When will the new release?
Thanks in advance.
Hi, I managed to enable WPML support by adding this code:
$rellength=count($related);
for($i = 0; $i<$rellength; $i++) {
$related[$i] = apply_filters( 'wpml_object_id', $related[$i], 'product', TRUE );
}
after the line
$related = isset( $_POST['related_ids'] ) ? array_filter( array_map( 'intval', explode( ',', $_POST['related_ids'] ) ) ) : array();
This will ‘translate’ the IDs of the related products when saving. It is not a perfect solution – it still shows the original language products in the product search box.
Any chance for the above code to be included in the plugin?
Would be great if I don’t have to patch it manually each time there’s an update.
Hi GeLeTo,
It didn’t work for me, I put the code where you indicate, but nothing changes
Is it ok?
// save related products selector on product edit screen
function crp_save_related_products( $post_id, $post ) {
global $woocommerce;
if ( isset( $_POST['related_ids'] ) ) {
if ( $woocommerce->version >= '2.3' ) {
$related = isset( $_POST['related_ids'] ) ? array_filter( array_map( 'intval', explode( ',', $_POST['related_ids'] ) ) ) : array();
// GD TRADUCIR WPML
$rellength=count($related);
for($i = 0; $i<$rellength; $i++) {
$related[$i] = apply_filters( 'wpml_object_id', $related[$i], 'product', TRUE );
}
Thanks!