• Resolved 18TommyBoy

    (@18tommyboy)


    Good day,
    I want to import to posts only where is price larger than “380 CZK”. In feed are like this:

    <g_sale_price>
    2599.00 CZK
    </g_sale_price>
    <g_price>
    2599.00 CZK
    </g_price>
    ...
    
    I try everything:
    /item[g_price[1] >=  380]
    /item[g_price[1] >=  380 CZK]
    /item[g_price[1] >=  380.00 CZK]
    /item[g_price[1] >=  380.00]
    
    But nonstop: 
    

    There are no elements to import based on your XPath.
    If you are in Step 2, you probably specified filtering options that don’t match any elements present in your file.
    If you are seeing this error elsewhere, it means that while the XPath expression for your initial import matched some elements in your file previously, there are now zero elements in the file that match this expression.
    You can edit the XPath for your import by going to the Manage Imports -> Import Settings page.`

    How to add filter then?

Viewing 7 replies - 1 through 7 (of 7 total)
  • I think your operators aren’t working because the fields contain the text CZK along with the number.

    You’ll need to separate the the CZK into its own field in your source XML file, that way it’s just the number in the field, and then the >= operator should work.

    Thread Starter 18TommyBoy

    (@18tommyboy)

    So, no change to delete the CZK before and then >= ?

    I’m saying that you’ll need to somehow programmatically edit your import file to be formatted differently. Something like this, so that only the number is in the field:

    <?xml version="1.0"?>
    <Products>
    	<Product>
    		<Name>First</Name>
    		<Price>110.00</Price>
    		<Currency>CZK</Currency>
    	</Product>
    	<Product>
    		<Name>Second</Name>
    		<Price>100.00</LastName>
    		<Currency>CZK</Currency>
    	</Product>
    </Products>

    Then your filter should work properly.

    Thread Starter 18TommyBoy

    (@18tommyboy)

    Yes yes, with other feeds this work. Only with currency symbol problems. Thank you for answer.

    Plugin Author WP All Import

    (@wpallimport)

    Hey @18tommyboy,

    @aakash8 is correct that the filter is failing because of the “CZK”, but you should be able to fix it with XPath’s translate function: https://developer.mozilla.org/en-US/docs/Web/XPath/Functions/translate. For example:

    /item[translate(g_price[1],"CZK","") >= 380]

    Thread Starter 18TommyBoy

    (@18tommyboy)

    Yes this work! Can you add this to the code?

    Plugin Author WP All Import

    (@wpallimport)

    Hey @18tommyboy,

    Can you add this to the code?

    If we get a lot of requests for an option to remove data from certain nodes when building a filter, it’s certainly something we’d consider implementing.

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

The topic ‘How add minimum price’ is closed to new replies.