Copied to clipboard

Flag this post as spam?

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


  • Kerri Mallinson 113 posts 497 karma points
    Apr 08, 2016 @ 12:11
    Kerri Mallinson
    0

    Using Archetype with Merchello

    Hi All,

    Using Umbraco v7.3.4 & Merchello 1.2.12 & Archetype 1.12.3

    I was hoping someone could help with an issue i'm having with using Archetype on Merchello extended product content (i'm trying to achieve something similar to this: https://our.umbraco.org/projects/collaboration/merchello/merchello/69645-tiered-pricing

    I have created the data type and added it to the product document type and it is appearing on the tab but there are no text boxes to add data to the properties:

    img1

    I have done a test on a 'normal' Umbraco page and it works fine:

    img2

    Any ideas would be greatly appreciated.

    Thanks in advance, Kerri

  • Comment author was deleted

    Apr 08, 2016 @ 16:02

    Can you use the Chrome tools to see if a CSS class is hiding the inputs by accident?

  • Kerri Mallinson 113 posts 497 karma points
    Apr 08, 2016 @ 16:32
    Kerri Mallinson
    0

    Hi Kevin,

    The input isn't there in the html, the left hand side is how it appears on the umbraco page, the right hand side is on the Merchello page

    enter image description here

  • Comment author was deleted

    Apr 08, 2016 @ 16:33

    Wow that's wild. I'm not sure I can help then :)

  • Comment author was deleted

    Apr 08, 2016 @ 16:34

    Any JS errors?

  • Kerri Mallinson 113 posts 497 karma points
    Apr 08, 2016 @ 16:38
    Kerri Mallinson
    0
    angular.min.js?cdv=1172661818:63 TypeError: Cannot read property 'contentTypeAlias' of null
    at linker (http://localhost:50173/App_Plugins/Archetype/js/archetype.js?cdv=1172661818:837:136)
    at k (http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:44:444)
    at e (http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:40:139)
    at k (http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:44:382)
    at e (http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:40:139)
    at k (http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:44:382)
    at e (http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:40:139)
    at http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:39:205
    at http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:162:213
    at Object.fn (http://localhost:50173/umbraco/lib/angular/1.1.5/angular.min.js?cdv=1172661818:90:12) <archetype-property class="archetypeEditor ng-isolate-scope ng-scope" property="property" property-editor-alias="model.alias" fieldset-index="$parent.$index" fieldset="fieldset" archetype-config="model.config" property-config-index="$index" archetype-render-model="model.value" umbraco-form="form">
    
  • Comment author was deleted

    Apr 08, 2016 @ 16:42

    Well, I think I have bad news.

    I don't use Merchello, but if my suspicion is correct, you won't be able to use Archetype on a non-content page. I'm assuming that the page you're working on is outside of the 'content' section. Again, I don't use Merchello (not that it's bad :) ).

    The reason being could be tied to the fact that Archetype needs to know information about the current page: https://github.com/imulus/Archetype/blob/6bcf291c99c2da83630ae9ca3208dd14d6c8b4a3/app/directives/archetypeproperty.js#L18

    More can be found here: https://github.com/imulus/Archetype/search?utf8=%E2%9C%93&q=contentTypeAlias

    So for whatever reason, the information can't be retrieved on the page you're using.

  • Kerri Mallinson 113 posts 497 karma points
    Apr 08, 2016 @ 16:41
    Kerri Mallinson
    0

    enter image description here

  • Comment author was deleted

    Apr 08, 2016 @ 16:43

    If it IS a content page, is it possible that the Archetype is being wrapped by something from Merchello?

  • Supun Livera 8 posts 102 karma points
    Apr 08, 2016 @ 18:52
    Supun Livera
    102

    It seems Merchello does not pass the current editor state to the archetypeProperty directive, so editorState.current is always null.

    As a workaround, change the the signature of angular.module("umbraco.directives").directive('archetypeProperty' in \AppPlugins\Archetype\js\archetype.js from

    angular.module("umbraco.directives").directive('archetypeProperty', function ($compile, $http, archetypePropertyEditorResource, umbPropEditorHelper, $timeout, $rootScope, $q, fileManager, editorState, archetypeService, archetypeCacheService) 
    

    to

    angular.module("umbraco.directives").directive('archetypeProperty', function ($compile, $http, $routeParams, archetypePropertyEditorResource, umbPropEditorHelper, $timeout, $rootScope, $q, fileManager, editorState, archetypeService, archetypeCacheService)
    

    (add $routeParams to the signature) and then before calling archetypePropertyEditorResource.getDataType in there, add the following lines:

        var editorId = '';
        var contentTypeAlias = '';
    
        if (editorState.current != null) {
            contentTypeAlias = editorState.current.contentTypeAlias;
            editorId = editorState.current.id;
    
        } else {
            editorId = $routeParams.id;
        }
    

    Then change the signature of

    archetypePropertyEditorResource.getDataType(dataTypeGuid, scope.archetypeConfig.enableDeepDatatypeRequests, editorState.current.contentTypeAlias, scope.propertyEditorAlias, alias, editorState.current.id)
    

    to

    archetypePropertyEditorResource.getDataType(dataTypeGuid, scope.archetypeConfig.enableDeepDatatypeRequests, contentTypeAlias, scope.propertyEditorAlias, alias, editorId)
    

    And we can get the Archetype editor loaded into a Merchello product properly.

    enter image description here

  • Kerri Mallinson 113 posts 497 karma points
    Apr 09, 2016 @ 11:37
    Kerri Mallinson
    2

    Thanks Supun! working a treat :)

  • Chris Foot 61 posts 93 karma points
    Aug 19, 2016 @ 09:24
    Chris Foot
    0

    Hi Guys,

    I've managed to get this working for my project. Unfortunately though, it doesn't like nested archetypes :(. If I have one on the form the add button works correctly and lets me add data but when I go back into the form at a later date it won't load the nested form at all. There is an error in the console:

    Error: $scope.model.value is undefined init@http://localhost:55075/AppPlugins/Archetype/js/archetype.js?cdv=73841504:239:9 @http://localhost:55075/AppPlugins/Archetype/js/archetype.js?cdv=73841504:23:5 d@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:28:302 g/<.instantiate@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:28:434 Jc/this.$getdd/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:105:340 o@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:102:68 u/g<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:100:66 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/g/<.then/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:80:485 Xc/this.$getdd/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:105:340 o@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:102:68 u/g<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:100:66 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/g/<.then/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:80:485 Xc/this.$getdd/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:105:340 o@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:102:68 u/g<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:100:66 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/g/<.then/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:80:485 Xc/this.$getdd/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:105:340 o@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:102:68 u/g<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:100:66 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/g/<.then/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:80:485 Xc/this.$getdd/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:105:340 o@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:102:68 u/g<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:100:66 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/e/j.promise.then/i@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:79:432 Uc/g/<.then/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:80:485 Xc/this.$getx.event.add@http://localhost:55075/umbraco/lib/jquery/jquery.min.js?cdv=73841504:5:7260 .on/<@http://localhost:55075/umbraco/lib/jquery/jquery.min.js?cdv=73841504:5:14328 .each@http://localhost:55075/umbraco/lib/jquery/jquery.min.js?cdv=73841504:4:4573 x.prototype.each@http://localhost:55075/umbraco/lib/jquery/jquery.min.js?cdv=73841504:4:1624 .on@http://localhost:55075/umbraco/lib/jquery/jquery.min.js?cdv=73841504:5:14307 .bind@http://localhost:55075/umbraco/lib/jquery/jquery.min.js?cdv=73841504:5:31942 rd<.compile/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:143:320 k@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:44:444 e@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:40:139 k@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:44:382 e@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:40:139 y/<@http://localhost:55075/umbraco/lib/angular/1.1.5/angular.min.js?cdv=73841504:39:205 Sd

    Can anyone help?

  • Chris Foot 61 posts 93 karma points
    Aug 19, 2016 @ 12:06
    Chris Foot
    0

    It looks like the second time it runs the init function (for the nested form) it is for some reason, passing $scope.model.value as a string rather than an object. Adding the following to the init function fixes the issue:

     if (typeof $scope.model.value == "string") {
            $scope.model.value = JSON.parse($scope.model.value);
        }      
    

    This may be a bit hacky but it does seem to work!

  • Ben McKean 255 posts 499 karma points
    Sep 02, 2016 @ 18:44
    Ben McKean
    0

    I've just applied the fix by Supun which works for me

    @Kevin - is there any chance of this going into Archetype package?

Please Sign in or register to post replies

Write your reply to:

Draft