Copied to clipboard

Flag this post as spam?

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


  • keilo 568 posts 1023 karma points
    Oct 03, 2015 @ 14:44
    keilo
    0

    What is the ideal data-type for storing subscription info

    I am working on a shopping cart implementation which contains different categories, where each category can have various subscription period.

    While storing the subscription data to Member's which data-type do you think will be the ideal, easy to work with?

    For each subscription, it needs to write;

    .SubscriptionType1, .Period1, .Start Date1

    .SubscriptionType2, .Period2, .Start Date2 ..

    I'm not sure which data type would be ideal and easy to write/read from. ArcheType might be an overkill, just not sure...

    Would be interested to hear your thoughts on this.

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Oct 03, 2015 @ 14:53
    Robert Foster
    1

    First thing to consider really is the user experience - how are you creating/updating the information? Are you allowing members to edit their information? How are you displaying it to members? Can backend users edit it?

    If I were you, I'd probably create a custom data type to display the information, (and edit if necessary); it sounds like you'll be creating the data using the shopping cart experience so you probably don't want anyone editing it after the fact?

  • keilo 568 posts 1023 karma points
    Oct 03, 2015 @ 14:58
    keilo
    0

    Hi Robert

    There is no UI (user experience) for the end-user, for them to edit or even 'present/see' this information.

    Its more to do with checking the subscription duration per the category they subscribed to, so this check will be on back-end razor while the content is being accessed;

    I really need something simple, like a list format (subscriptionCategory, Duration, StartDate), to retrieve and check this data. Easy to use with Razor sorta thing.

    What would you suggest, without going to custom data type route?

  • Robert Foster 459 posts 1820 karma points MVP 2x admin c-trib
    Oct 03, 2015 @ 15:15
    Robert Foster
    1

    If you don't want to create your own DataType and the list is relatively short - given you have only 3 fields then NestedContent is probably going to fit your requirements.

    When it comes to generating NestedContent values programmatically, take a look at this:

    https://gist.github.com/robertjf/c6d9122d90b4406b19ec

  • keilo 568 posts 1023 karma points
    Oct 03, 2015 @ 15:50
    keilo
    0

    Thanks for pointing out the NestedContent, not sure why I didnt notice this before.

    There is some serious code in the git you posted : )

    I have created a simple nested datatype, assigned to a memberType.

    Within the code how should I go about casting it properly as member.getvalue is not like a model;

    @using umbraco.cms.businesslogic.member
    @{
        var member = new Member(1129);
         var email = member.Email;
        var someProperty = member.getProperty("myCustomProperty").Value.ToString();
    }
    

    What would be the right approach to get (and also set) to the member nested-dataype in this case?

    equivalent of this for the members, more like:

     var items = Model.GetPropertyValue<>
  • keilo 568 posts 1023 karma points
    Oct 03, 2015 @ 16:47
    keilo
    0

    Sorry Robert, wasnt using the new member service...

    For anyone in the midst of jumping to the new API, I'm answering my own question above;

    One should use the new Member API to get proper IpublishedDocument

    instead of using the old member api, using new api;

    
    @inherits Umbraco.Web.Mvc.UmbracoViewPage   
    @{
        var member = Umbraco.TypedMember(1129);
        var custom = member.GetPropertyValue<>

    This will fetch the stored values from member -> nestedContent property.

    I'm not sure how to go about "simply" writing to the property though..., the linked code above is a bit over my head.

Please Sign in or register to post replies

Write your reply to:

Draft