• Resolved brandsforless

    (@brandsforless)


    Hello to all,
    in my xml file in the tags <NAME/> & <TYPE/>
    <name>Panties model 102912 Róża</name>
    <type>Panties</type>
    some words it needs to be mapping in my languange. in the above tags i want to map the word Panties in Greek languange. I realise that i have to use a php function as mapping is for custom fields and taxonomy. In the document i read about wpai_util_map function.
    Any example please?

    Thank you in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WP All Import

    (@wpallimport)

    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;
    }
    Thread Starter brandsforless

    (@brandsforless)

    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;
    }

    Plugin Author WP All Import

    (@wpallimport)

    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.

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

The topic ‘Title Mapping’ is closed to new replies.