• Resolved Konstatninos

    (@skredlemon)


    Hi, I am trying to test a setup for importing posts, based on an XML feed template, which I am then to apply in a real life project. In real life the XML is going to be fetched by an FTP (PRO is required as far as I know, right?) every N minutes, which is going to be taken care of by a CRONjob. Before getting into that, however, I am having an issue with categorization. The architecture of the XML I am going to eventually deal with, contains a tag with the following format, which I want to use to declare the category it should map to:

    <Property FormalName="CategoryKey" Value="CategoryValue">

    However, underneath that, there are more Property tags, serving other uses, such as tags etc.

    <Property FormalName="KeywordKey" Value="KeywordValue">

    By simply dragging and dropping the correct tag from the template on the right hand side of the import job page to the appropriate field, i.e. “Enable Mapping for Categories > In your File” the mapping does not actually work as desired. Of course I expected that to be the case to be honest, because the <Property> tag is not unique to the parent item. The value of said field gets set as:

    {Component[1]/Metadata[1]/Property[1]/@Value}

    I tried to tweak that to multiple variation like the following, but none actually worked.

    {Component[1]/Metadata[1]/Property[1]/@Key=CatKey/@Value}

    Is there actually a way to define which of the various tags with the <Property> name I want to target, to then map to the appropriate categories?

    For the time being, all runs of the job have returned posts which remain uncategorized.

    • This topic was modified 1 year, 2 months ago by Konstatninos.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @skredlemon,

    In real life the XML is going to be fetched by an FTP (PRO is required as far as I know, right?)

    The free version doesn’t support FTP imports, and we’d be happy to answer any questions about our pro plugins here: https://www.wpallimport.com/support/.

    Is there actually a way to define which of the various tags with the <Property> name I want to target, to then map to the appropriate categories?

    Yes, you can use an XPath query like so:

    {Component/Metadata/Property[./@FormalName="CategoryKey"]/@Value}

    This would be used in the category value field, e.g.: https://d.pr/i/KBBU1H.

    Thread Starter Konstatninos

    (@skredlemon)

    Alright, that’s a different syntax than whatever I’d tried. Can you also elaborate on how to map specific values to specific categories? I tried to work on what you shared, but it does not work as anticipated. It always returns “Uncategorized” posts. I tried both:

    {Component[1]/Metadata[1]/Property[./@FormalName="CategoryKey"]/Property[./@Value="WORLD NEWS"]}

    and

    {Component[1]/Metadata[1]/Property[./@FormalName="CategoryKey"]/@Value="WORLD NEWS"]}

    For the second field of the mapping I’ve tried both the category name, and its slug.

    • This reply was modified 1 year, 2 months ago by Konstatninos.
    Plugin Author WP All Import

    (@wpallimport)

    Hi @skredlemon,

    In the mapping section, you need to type static values rather than using XPaths. The first field (“In Your File”) should contain the static value that you’re wanting to map from the category XPath, and the second one (“Translated To”) should contain the name/slug of the category you want it mapped to.

    If this doesn’t help, can you send me a screenshot showing what you’ve tried?

    Note: I posted a reply to this already but I don’t see it, so my apologies if this is a double reply.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Mapping categories returns Uncategorized items’ is closed to new replies.