• Resolved Draba82

    (@draba82)


    I have a property Price.
    And want, based on price, put them in category

    So I have exmpl categories:
    100 – 200
    200 – 500
    500+

    So if property is 140 it should be put in category 100 – 200

    How can I do that with WPallimport?

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

    (@wpallimport)

    Hi @draba82

    You can use a custom PHP function in the import for this: http://www.wpallimport.com/documentation/developers/execute-php/. As an example:

    1) Pass your price element to the function “soflyy_map_cats” in the categories section like so: [soflyy_map_cats({price[1]})]. Please note you should change {price[1]} to the element in your import feed that contains the price.

    2) Add the following code via All Import -> Settings -> Function Editor:

    function soflyy_map_cats( $price ) {
    	if ( $price >= 100 && $price < 200 ) {
    		return "100 - 200";
    	} elseif ( $price >= 200 && $price < 500 ) {
    		return "200 - 500";
    	} elseif ( $price >= 500 ) {
    		return "500+";
    	} else {
    		return "Default Category";
    	}
    }

    That’s it.

    Plugin Author WP All Import

    (@wpallimport)

    Marking this as resolved. @draba82 if you run into any issues regarding this solution, please post here. Anyone else, please start a new thread.

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

The topic ‘Do something with imported value’ is closed to new replies.