Jump to content
aaronjpitts

XML feed importer to map to new pages and fields

Recommended Posts

Hi Guys,

I have just started to experiment with Processwire and really like what I see so far. I am hoping to try my first production site on it soon. I have long been a wordpress user, but want something new and more efficient. I am wondering if there is a module/feature similar to this for wordpress: http://www.wpallimport.com/ it's a full XML importer where you can import to create new pages (posts on wordpress) and map parts of each entry to certain fields of each page. Is this possible for Processwire? I use this with the advacned custom field plugin on wordpress to great effect. Each time the plugin is run, it will update the posts if they have already been created, and add new ones for new entries in the XML feed.

I've seen this module, but does it work with the latest version, and could it work with what I need: http://modules.processwire.com/modules/process-data-import/

If anyone can point me in the right direction I would appreciate it.

Thanks,

Aaron

Share this post


Link to post
Share on other sites

Hi @aaronjpitts and welcome!

A few tools that might help you:

CSV importer: http://modules.processwire.com/modules/import-pages-csv/

Table CSV Import/Export http://modules.processwire.com/modules/table-csv-import-export/

Wordpress Migrator https://github.com/NicoKnoll/MigratorWordpress

Migrator (json export and import) https://github.com/adrianbj/ProcessMigrator

Please let us know if you have any specific questions about any of these.

  • Like 1

Share this post


Link to post
Share on other sites

Hi Adrian,

Thanks for your suggestions, but I don't think those modules could work to import data from an XML feed, right? This is the feed I need to import from: https://services.boatwizard.com/bridge/events/1f163739-f2a4-45fe-8274-0302f30a2f7d/boats?status=on

It would be to import boats, each boat having several fields such as price, length, location etc

Many thanks

Share this post


Link to post
Share on other sites

Just to make this clear, you want a way to be able to continuously import from that source and not a one-time thing?

  • Like 2

Share this post


Link to post
Share on other sites

Yes, that's correct. Because the feed often updates with new entries (boats) being added, and old (sold) boats being removed.

Thanks

Share this post


Link to post
Share on other sites

Yes, that's correct. Because the feed often updates with new entries (boats) being added, and old (sold) boats being removed.

Thanks

Good to know!

I think it might be worth you creating a converter that can be run via a cron job. 

Sorry I don't have time for a detailed example, so this might not be much use, but you can use one of the PHP xml to array (or maybe json) functions and then use the PW API to convert that into pages. It won't be terribly difficult, but not exactly trivial. There are several bits of code that might help you if you decide to tackle this - some from the Wordpress Migrator (xml to json) and Migrator (json to PW pages).

If you're willing to have a go, I am sure we can help you get through any roadblocks that come up.

  • Like 2

Share this post


Link to post
Share on other sites

Yipieh! Looks like a task for an importer script! :)

The XML has <DocumentID>123456</DocumentID> what seems to be the boat-article-ids. So, you can go with it manually via importer script, or first have a look for getting a PHP conversion lib that converts xml to csv and then maybe use the CSV module for importing.

But it is also very easy done manually with an importer script, (bootstrapping PW, running via cron or via PWs lazyCron). If you need any further explanation, please ask here.

EDIT: @Adrian beats me a few seconds :)

Edited by horst
  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Pip
      Hi Everyone!
      I'd like to set a different label on my Title (PageTitle) field in one particular template.  Is there a way to do so? 
      Thanks. 
    • By benbyf
      Hello, and welcome to what I though was either my client being silly and changing things, or some evil doer. Turns out its reproducible and therefore something in Proceswire (I checked my templates and modules but couldnt find anything that would be doing this...). So what is it doing? Check out the video for evidence.
      A repeater field is interacting with a page template and another repeater field somehow to swap the fields in the template and repeater over...
      I have a template called team, and a repeater field called team_repeater with label Team. Some how and for some reason, when I change my fields on repeater called main_menu_links my team template gets those fields and when I try and revert the team template fields to the fields it should have, they get given to the repeater main_menu_links. Also this to say HELP!!!!!
      video: https://www.dropbox.com/s/exkdhc6n7x0xpsa/strange-repeater-PW-mega-bug.mov?dl=0
    • By DV-JF
      Hey all, hope you're feeling well these days!
      Short question: Under "Setup > Templates" it's possible to sort the templates by last modified. Is this possible for fields view to?
      Long explanation:
      Currently I am in the process of programming a reusable template and often have to copy several fields & templates from different PW installations into my "master version".
      Therefore it would be good to see already in the field list when the last modification has taken place.
      Stay healthy & don't forget to wash you hands - many greets!
    • By Mike Rockett
      Docs & Download: rockettpw/seo/markup-sitemap
      Modules Directory: MarkupSitemap
      Composer: rockett/sitemap
      MarkupSitemap is essentially an upgrade to MarkupSitemapXML by Pete. It adds multi-language support using the built-in LanguageSupportPageNames. Where multi-language pages are available, they are added to the sitemap by means of an alternate link in that page's <url>. Support for listing images in the sitemap on a page-by-page basis and using a sitemap stylesheet are also added.
      Example when using the built-in multi-language profile:
      <url> <loc>http://domain.local/about/</loc> <lastmod>2017-08-27T16:16:32+02:00</lastmod> <xhtml:link rel="alternate" hreflang="en" href="http://domain.local/en/about/"/> <xhtml:link rel="alternate" hreflang="de" href="http://domain.local/de/uber/"/> <xhtml:link rel="alternate" hreflang="fi" href="http://domain.local/fi/tietoja/"/> </url> It also uses a locally maintained fork of a sitemap package by Matthew Davies that assists in automating the process.
      The doesn't use the same sitemap_ignore field available in MarkupSitemapXML. Rather, it renders sitemap options fields in a Page's Settings tab. One of the fields is for excluding a Page from the sitemap, and another is for excluding its children. You can assign which templates get these config fields in the module's configuration (much like you would with MarkupSEO).
      Note that the two exclusion options are mutually exclusive at this point as there may be cases where you don't want to show a parent page, but only its children. Whilst unorthodox, I'm leaving the flexibility there. (The home page cannot be excluded from the sitemap, so the applicable exclusion fields won't be available there.)
      As of December 2017, you can also exclude templates from sitemap access altogether, whilst retaining their settings if previously configured.
      Sitemap also allows you to include images for each page at the template level, and you can disable image output at the page level.
      The module allows you to set the priority on a per-page basis (it's optional and will not be included if not set).
      Lastly, a stylesheet option has also been added. You can use the default one (enabled by default), or set your own.
      Note that if the module is uninstalled, any saved data on a per-page basis is removed. The same thing happens for a specific page when it is deleted after having been trashed.
          
    • By Lmwt
      Hi forum,
      I have this list of fields with labels and I want to skip the displaying of labels for fields left empty (e.g. if field "logo" is not filled with an image, but it could also be text fields). Using count() and "continue" will always output either nothing or all labels.
      Is there a way to use the "skipLabel" method in the loop?
      foreach ($page->template->fields as $field) { if(!count($page->$field->logo)) {continue;} else { $etikette = $field->getLabel(); //get label in the current user language $content .= " <br><li class='pub-field'>$etikette<br> </li>"; //display labels as li $content .= $page->get($field->name) . "<br>"; // display values as li } } Thanks for your help!
×
×
  • Create New...