Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt 8 posts 78 karma points
    Aug 04, 2016 @ 06:09
    Matt
    0

    Merging/querying external data to display with Umbraco content

    I'm new to Umbraco. I need to query for and get some external data (from a database) and have it available alongside the values coming from the Umbraco properties.

    For example, I have a Product document type. A product has data setup within Umbraco, but I need to query an external data source which is updated daily with some other values and also have it available along with the data coming from Umbraco. I can associate them based on the Product ID, which is available as a property on the Product from Umbraco (@CurrentPage.productId = "234655").

    How would I go about doing this? Also, is it best to have the other data in the same database as Umbraco or in a separate database?

  • Steve Morgan 1349 posts 4459 karma points c-trib
    Aug 04, 2016 @ 08:06
    Steve Morgan
    0

    There are a few different ways of doing this - if you're mixing a lot of content from an external system (say a product DB) with Umbraco content then I'd suggest a Custom Controller.

    https://our.umbraco.org/documentation/reference/routing/custom-controllers

    In your controller call / query an external data source (via a "helper" class, be it an external DB, API or just some custom tables stored to the Umbraco DB) and return a model with your Umbraco content and product data mixed in.

    Hope that helps

    Steve

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Aug 04, 2016 @ 08:28
    Ismail Mayat
    0

    Matt,

    Take a look at hybrid framework package (https://our.umbraco.org/projects/developer-tools/hybrid-framework/) and route hijacking so see how to create new model and enrich with umbraco and custom data. Also with regards to external datatables i would recommend separate db that way when you upgrade you do not have to worry about that table.

    We have in the past had data in same db and then had to content freeze on those tables when doing upgrade. This way separate db you do not have to worry about it.

Please Sign in or register to post replies

Write your reply to:

Draft