• Resolved chemistrap

    (@chemistrap1)


    Hello there,
    Thank you for great plugin first of all.
    This time my customer request something and i guess this is totally achievable if-else statements but i dont know how to do.
    Customer wants to sentence products description with varitans. For example, iphone 6s and lets assume that has 32 GB memory,1 GB ram, 32 Megapixel camera, $300 price and 2 years warranty, and so the customers wants automatically creates product’s desciption via variables like that: “{BrandName} {ModelName} came with {OperatingSystem} and you will take the moment perfecly with {CameraCapacity} camera. You will feel the speed with {RamCapacity} ram and you can storage a lot of media on {MemoryCapacity}. Just pay {SalePrice} instead of {RegularPrice} for a limited time.” and it will be output like :“Apple Iphone 6s came with iOS 11 and you will take the moment perfectly with 32 Megapixel camera. You will feel the speed with 1 GB ram and you can storage a ot of media on 32 GB Memory. Just pay $300 instead of $450 for a limited time.”

    I can this similar products but some products does not has specific feature so it will break the sentence. How can i check if {value} !=empty print the sentence else display:none or something i dont know.

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

    (@wpallimport)

    Hi @chemistrap1

    How can i check if {value} !=empty print the sentence else display:none or something i dont know.

    Here’s an example that makes sure a single element isn’t empty:

    [IF({BrandName[1][. != ""]})]{BrandName[1]} {ModelName[1]} came with {OperatingSystem[1]} and you will take the moment perfectly with {CameraCapacity[1]} camera.[ELSE][ENDIF]

    Here’s an example that checks multiple elements:

    [IF({BrandName[1][. != "" and ../ModelName != "" and ../OperatingSystem != "" and ../CameraCapacity != ""]})]{BrandName[1]} {ModelName[1]} came with {OperatingSystem[1]} and you will take the moment perfectly with {CameraCapacity[1]} camera.[ELSE][ENDIF]

    As you can see, this can get a little complex, and it’s hard to read, so you may want to consider passing the elements to a PHP function that checks them and outputs the data: https://www.wpallimport.com/documentation/developers/custom-code/inline-php/.

    Plugin Author WP All Import

    (@wpallimport)

    Hi @chemistrap1

    I am going to mark this as resolved since we haven’t heard back. You can follow up here if you still have questions about this.

    Anyone else, please open a new ticket.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If Else Statement for Product Description’ is closed to new replies.