Copied to clipboard

Flag this post as spam?

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


  • shinsuke nakayama 93 posts 233 karma points
    Jul 11, 2017 @ 06:29
    shinsuke nakayama
    0

    Archetype on Umbraco 7.6

    Hi guys,

    I'm just building a new Umbraco project and just realised that the Archetype Project compatibility for Umbraco 7.6 is 33%.

    Is it safer to use last stable version of 7.5?

    Thank you

    Shinsuke

  • Paul Seal from codeshare.co.uk 240 posts 1073 karma points c-trib
    Jul 11, 2017 @ 11:52
    Paul Seal from codeshare.co.uk
    100

    I use it in my projects. It works great. I had some issues to start with, but then I found that it was to do with the new Related Links datatype and not to do with Archetype.

  • Srdjan 17 posts 47 karma points
    Jul 17, 2017 @ 12:15
    Srdjan
    0

    Hi Paul,

    as I need to have 2 Related Links in one item have you managed to make it work or you just skipped Related Links?

    Thanks,

    Srdjan

  • paulthorpe 10 posts 193 karma points
    Jul 17, 2017 @ 12:22
    paulthorpe
    0

    I have recently upgrade a 7.5.3 to 7.6.4 and initially I had issues with ArcheType. The solution I followed was to disable the new Property Value converters.

    In the umbracoSettings.config file try setting EnablePropertyValueConverters to false

    <EnablePropertyValueConverters>false</EnablePropertyValueConverters>
    

    With this setting applied ArcheType seems to work OK I have yet to see any issues but there may be some so its worth testing.

    At some point the setting will need to be changed back but this could be done when ArcheType fully support 7.6

  • Srdjan 17 posts 47 karma points
    Jul 17, 2017 @ 12:29
    Srdjan
    0

    Thanks paulthorpe,

    but will

    Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("propertyAlias")
    

    work that way?

    Thanks,

    Srdjan

  • shinsuke nakayama 93 posts 233 karma points
    Jul 18, 2017 @ 01:09
    shinsuke nakayama
    0

    Hi guys,

    I thought I'll give you my update and finding. I am almost finished with the backend and I had no problem using ArcheType with Umbraco 7.6.

    The issue I had wasn't related to ArcheType, but in 7.6, Content Picker and Image Picker was returning Udi, instead of ID.

    Here are some of my code for reference.

    var headerSample = Model.Content.Header.FirstOrDefault();  //header is generated by the Model Builder
    var storeListString = headerSample.Properties.FirstOrDefault(x => x.Alias == "stores").Value.ToString(); //get ArcheType data in string
    var archeObj = JsonConvert.DeserializeObject<ArchetypeModel>(storeListString); //Convert it into Object
    foreach (var item in archeObj)
    {
        if (item.Properties.Count() != 0)
        {
            var imageUdi = item.GetValue("image");  //Now in Umbraco 7.6, it returns Udi instead of ID
            MyHelper.getUrlFromUdi(imageUdi); //Converting from Udi to Url
        }
    }
    
    //and my helper class
    using Umbraco.Core;
    public class MyHelper()
    {
        public static string getUrlFromUdi(string imageUdi)
        {
            var imageUrl = "";
            if (!String.IsNullOrEmpty(imageUdi))
            {
                var udiContent = Udi.Parse(imageUdi).ToPublishedContent();
                imageUrl = udiContent.Url();
            }
            return imageUrl;
        }
    }
    
  • Paul Seal from codeshare.co.uk 240 posts 1073 karma points c-trib
    Jul 18, 2017 @ 17:02
    Paul Seal from codeshare.co.uk
    0

    Check out this post it explains how to get media, content and members using the new udi. You don't need the helper you created. It's so simple.

    http://www.codeshare.co.uk/blog/how-to-get-the-file-path-of-a-media-item-in-umbraco/

    I'm on my phone here so bear with me.

    Instead of the 2 lines which start var imageUdi = ...

    Just use this

    ImageUrl = item.GetValue("Image").Url;

  • Paul Seal from codeshare.co.uk 240 posts 1073 karma points c-trib
    Jul 18, 2017 @ 17:04
    Paul Seal from codeshare.co.uk
    0

    The editor remove what I put in anglebrackets after GetValue

    It was GetValue left angle bracket IPublishedContent right angle bracket ("image")

  • Nicholas Westby 1643 posts 5390 karma points c-trib
    Jul 18, 2017 @ 17:52
    Nicholas Westby
    0

    FYI, Paul, you can use the code snippet syntax to avoid the angle bracket issue in the forum:

    ImageUrl = item.GetValue<IPublishedContent>("Image").Url;
    

    For those who mentioned Related Links, I would avoid that entirely (you can use Archetype for similar functionality): https://code101.net/links-in-umbraco-are-broken-but-alternatives-exist-1fe89aae2093

Please Sign in or register to post replies

Write your reply to:

Draft