Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing data into matrix field doesn't create new blocks #24

Closed
Lighty46 opened this issue Dec 23, 2015 · 7 comments
Closed

Importing data into matrix field doesn't create new blocks #24

Lighty46 opened this issue Dec 23, 2015 · 7 comments

Comments

@Lighty46
Copy link

I'm having an issue when I try to import some fields from my XML feed into a matrix field made up of 3 date fields (1 date and 2 time). Here is a simplified version:

...
<item>

  <eventDate>
    <date>22/12/2015</date>
    <startTime>12:00</startTime>
    <endTime>15:00</endTime>
  </eventDate>

  <eventDate>
    <date>22/12/2015</date>
    <startTime>12:00</startTime>
    <endTime>15:00</endTime>
  </eventDate>

</item>

<item>

  <eventDate>
    <date>22/12/2015</date>
    <startTime>12:00</startTime>
    <endTime>15:00</endTime>
  </eventDate>

</item>
....

e.g.
<date> -> matrixField.date
<startTime> -> matrixField.startTime
<endTime> -> matrixField.endTime

The problem is that it doesn't create a new block when there are multiple eventDate's ... It works if I only have one field in the matrix, but the second there are multiple it just replaces the contents of the first block with the next. I have also tried this with a table field and have had the same results.

Note: I tried to send you a support request through the dashboard but I'm on localhost so I don't think it worked.

Any suggestions? Cheers.

@Lighty46 Lighty46 changed the title Importing date into matrix field doesn't create new blocks Importing data into matrix field doesn't create new blocks Dec 23, 2015
@Lighty46
Copy link
Author

Okay, a bit more testing and I have realised that if the first item in my XML only has 1 eventDate node then all of the other items can only ever have 1 eventDate block/row. So, to test I added two eventDate nodes to my first item and it then allowed the plugin to import multiple rows (all of them, not just 2)!

But I then realised that it now refused to import the rows on items that only have 1 eventDate... Is this a problem with the way my XML is structured or the way the plugin handles blocks/rows?

@engram-design
Copy link
Contributor

Hey @Lighty46 - Sorry for the delay, but just needed some time to test this issue properly. Its indeed an issue with the plugin mapping, and is to do with irregular nested nodes, as per your example. This has now been fixed in the 1.4.4 release.

I've also ensured this works using the following data (using item as the primary node), but please let me know if you still have issues!

<?xml version="1.0" encoding="UTF-8"?>
<rss>
  <channel>
    <item>
      <title>Title1</title>

      <eventDate>
        <date>22/12/2015</date>
        <startTime>12:00</startTime>
        <endTime>15:00</endTime>
      </eventDate>

      <eventDate>
        <date>23/12/2015</date>
        <startTime>13:00</startTime>
        <endTime>16:00</endTime>
      </eventDate>
    </item>
    <item>
      <title>Title2</title>

      <eventDate>
        <date>24/12/2015</date>
        <startTime>14:00</startTime>
        <endTime>17:00</endTime>
      </eventDate>
    </item>
  </channel>
</rss>

@Lighty46
Copy link
Author

Hi Josh,

Thanks for taking a look at this. Don't worry about the delay, it was Christmas!

Just tested and I'm still having the issue - I used your example and it worked, but then I swapped the two items around and it started limiting all blocks to 1 row. In the end I decided to add a permanent "Dummy Item" to the top of my XML feed that had multiple eventDates and that's fixed it.

It looks like the update you put out did fix the issue I was having where items with 1 date weren't being imported if the first item had more than one though!

Have a good New Year and thanks again!

Dan.

On Mon, Dec 28, 2015 at 2:18 AM, Josh Crawford notifications@github.com
wrote:

Hey @Lighty46 https://github.com/Lighty46 - Sorry for the delay, but
just needed some time to test this issue properly. Its indeed an issue with
the plugin mapping, and is to do with irregular nested nodes, as per your
example. This has now been fixed in the 1.4.4
https://github.com/engram-design/FeedMe/releases/tag/1.4.4 release.

I've also ensured this works using the following data (using item as the
primary node), but please let me know if you still have issues!

<title>Title1</title>
  <eventDate>
    <date>22/12/2015</date>
    <startTime>12:00</startTime>
    <endTime>15:00</endTime>
  </eventDate>

  <eventDate>
    <date>23/12/2015</date>
    <startTime>13:00</startTime>
    <endTime>16:00</endTime>
  </eventDate>
</item>
<item>
  <title>Title2</title>

  <eventDate>
    <date>24/12/2015</date>
    <startTime>14:00</startTime>
    <endTime>17:00</endTime>
  </eventDate>
</item>


Reply to this email directly or view it on GitHub
#24 (comment)
.

@engram-design
Copy link
Contributor

For the record, this is the recommended way to fix this sort of issue. Its a little bit of a pain, but a requirement to ensure Feed Me gets consistent, structured data so it knows what to do with it.

@joepagan
Copy link

I am having a similar issue here with JSON, though for myself it only updates the first, then gives up, can my formatting looks ok. Is there an alternative way to do this?

example JSON:

[
  {
    "title": "entry title",
    "matrixData": [
      {
        "title": "mtitle1",
        "description": "mdesc1",
        "link": "mlink1"
      },
      {
        "title": "mtitle2",
        "description": "mdesc2",
        "link": "mlink2"
      },
      {
        "title": "mtitle3",
        "description": "mdesc3",
        "link": "mlink3"
      },
      {
        "title": "mtitle4",
        "description": "mdesc4",
        "link": "mlink4"
      },
      {
        "title": "mtitle5",
        "description": "mdesc5",
        "link": "mlink5"
      }
    ]
  }
]

@engram-design
Copy link
Contributor

@lexbi If you can send through a help request, I can double-check your settings to make sure its all in order.

@joepagan
Copy link

Nice one cheers, will do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants