Hi @brandsforless
Here’s an example mapping function that will allow you to easily define multiple rules:
function my_translate_data( $data ) {
$map = array(
'Translate this' => 'To this',
'Add as many mapping rules' => 'As needed',
'In this' => 'Array'
);
return ( array_key_exists( $data, $map ) ) ? $map[ $data ] : $data;
}
I write the function, save it to import at php function area and re-run the import again.
Nothing change at all.
I am sure that something i do wrong.
My php function is this
function my_translate_data( $data ) {
$map = array(
‘Shorts model’ => ‘Σορτσάκι’,
‘~Spodnie piżamowe’ => ‘Παντελόνι φόρμας’,
‘Blouse model’ => ‘Μπλούζα’,
‘Short skirt model’ => ‘Φούστα mini’,
‘Skirt model’ => ‘Φούστα’,
‘Singlet model’ => ‘Μπλουζάκι’,
‘Short dress model’ => ‘Φόρεμα mini’,
‘Evening dress model’ => ‘Φόρεμα βραδυνό’,
‘Top model’ => ‘Μπλουζάκι’,
‘Leggins model’ => ‘Κολάν’,
‘Daydress model’ => ‘Φόρεμα καθημερινό’,
‘Long sleeve shirtmodel ‘ => ‘Πουκάμισο’,
‘Short sleeve shirt model’=> ‘Πουκάμισο’,
‘Cocktail dress model’ => ‘Φόρεμα cocktail’,
‘Trousers model’ => ‘Παντελόνι’,
‘Long leggings model’ => ‘Κολάν’,
‘Long dress model’ => ‘Φόρεμα maxi’,
‘Suit model’ => ‘Φόρμα ολόσωμη’,
‘Jacket model’ => ‘Ζακέτα’
);
return ( array_key_exists( $data, $map ) ) ? $map[ $data ] : $data;
}
Hi @brandsforless
This code is correct:
function my_translate_data( $data ) {
$map = array(
'Shorts model' => 'Σορτσάκι',
'~Spodnie piżamowe' => 'Παντελόνι φόρμας',
'Blouse model' => 'Μπλούζα',
'Short skirt model' => 'Φούστα mini',
'Skirt model' => 'Φούστα',
'Singlet model' => 'Μπλουζάκι',
'Short dress model' => 'Φόρεμα mini',
'Evening dress model' => 'Φόρεμα βραδυνό',
'Top model' => 'Μπλουζάκι',
'Leggins model' => 'Κολάν',
'Daydress model' => 'Φόρεμα καθημερινό',
'Long sleeve shirtmodel' => 'Πουκάμισο',
'Short sleeve shirt model' => 'Πουκάμισο',
'Cocktail dress model' => 'Φόρεμα cocktail',
'Trousers model' => 'Παντελόνι',
'Long leggings model' => 'Κολάν',
'Long dress model' => 'Φόρεμα maxi',
'Suit model' => 'Φόρμα ολόσωμη',
'Jacket model' => 'Ζακέτα'
);
return ( array_key_exists( $data, $map ) ) ? $map[ $data ] : $data;
}
But, keep in mind that you still have to call the function from within the import template: http://www.wpallimport.com/documentation/developers/execute-php/.
If this doesn’t help, please open a ticket at http://www.wpallimport.com/support/ so we can check what’s going wrong.