• Resolved ammaribrahim

    (@ammaribrahim)


    hi

    Please can you help with this

    the problem this code not working with MAP PRICE ONLY

    [IF({mrpprice[1][.=""]})][MATH({yourcost[1]},"*","1.08")][ELSEIF({mrpprice[1][.>01 and .<=20000]})][MATH({mrpprice[1]},"*","1")][ELSEIF({mapprice[1][.=""]})][MATH({yourcost[1]},"*","1.08")][ELSEIF({mapprice[1][.>01 and .<=20000]})][MATH({mapprice[1]},"*","1")][ENDIF]

    I appreciate any help

    I tried to create this because I Want to import

    map price (same value )
    or
    mrp price (same value )
    or
    if I dont have the both above
    I will get the cost+8%

    Again I appreciate any help

    • This topic was modified 3 years, 3 months ago by ammaribrahim.
Viewing 4 replies - 1 through 4 (of 4 total)
  • It might be easier to use a PHP function then XPath. Try to place something like this snippet in WP All Import’s Function Editor:

    function price_to_return ($mrpprice, $mapprice, $yourcost, $cost = 1.08) {
    
    	if ( !empty( $mrpprice ) ) { 
    		$yourcost = $mrpprice; 
    	}elseif ( !empty( $mapprice ) ) {
    		$yourcost = $mapprice;
    	} else {
    		$yourcost = $yourcost * $cost;    
    	}    
    	return $yourcost;
    }

    Call this function and get value: [price_to_return({mrpprice[1]},{mapprice[1]},{yourcost[1]})]

    Thread Starter ammaribrahim

    (@ammaribrahim)

    thanks man , I appreciate yours help

    Plugin Author WP All Import

    (@wpallimport)

    Hey @ammaribrahim,

    I agree with @kw56 (thank you for helping out!), a PHP function would definitely be the way to go. Were you able to get it sorted?

    Plugin Author WP All Import

    (@wpallimport)

    Hi @ammaribrahim,

    I’m marking this as resolved since it’s been inactive for a while. Please open a new topic if you have any other questions.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘map price not working with me’ is closed to new replies.