Copied to clipboard

Flag this post as spam?

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


  • Fabian 68 posts 172 karma points
    Sep 09, 2016 @ 16:18
    Fabian
    0

    Vorto and Archetype are not working in the Extended Content of Merchello

    Both of these packages are not working correctly in the Extended Content of Merchello, while they work just fine in the normal umbraco content.

    The following error is being thrown - "Cannot read property 'contentTypeAlias' of null" on line 305 in the vorto.js file, which is located in the App_Plugins folder.

    I have debugged the problem and basically the issue is that "editorState.current" is being null. This is due that - "editorState" is expected to be injected in and filled but instead it is just being null.

    After some research, for the archetype package I have found this workaround: https://our.umbraco.org/projects/collaboration/merchello/merchello/76463-using-archetype-with-merchello, which works but it is kind of hacky. On vorto I have found nothing, thus I tried to make this solution also work for it, but I wasn't successful since vorto works a little bit different.

    Now I ran out of ideas how to fix this, thus I came here for your help. I think I have supplied enough detail on the issue, but if something is not clear please let me know.

    Can someone help me out in fixing such issue please?

    Thanks

  • Fabian 68 posts 172 karma points
    Sep 12, 2016 @ 10:51
    Fabian
    0

    I have now updated the description to be more detailed. Can anyone give me a hand on this please? Thanks

  • Fabian 68 posts 172 karma points
    Sep 14, 2016 @ 07:39
    Fabian
    0

    Anyone has any input on this please?

  • Fabian 68 posts 172 karma points
    Sep 15, 2016 @ 12:14
    Fabian
    0

    To anyone in the future who has this same issue I have fixed it by doing the following:

    Added the following block of code in line 13 of the vorto.js file, which can be found in the App_Plugins folder:

    if (currentSection == "merchello") 
    {   
                    currentSection = "content";
                    // 2871 is the id of any umbraco content node
                    editorState.current.id = 2871;
                    // 1129 is the id of the home page umbraco content node
                   editorState.current.parentId = 1129;
    

    }

    Also I have added the following line of code on line 6957 of the merchello.controllers.js file, which can also be found in the App_Plugins folder

    editorState.set(scaffold);
    

    Its a little bit of hacking but its a workaround that works.

  • Chris 47 posts 127 karma points
    Dec 01, 2016 @ 02:35
    Chris
    0

    Hi Fabian,

    The line number you're referencing might change as new Merchello versions are released. Can you specify where you're actually adding the line of JS relative to a method or at least provide a snippet with some of the surrounding code?

    Thank you!

  • Fabian 68 posts 172 karma points
    Dec 01, 2016 @ 11:07
    Fabian
    2

    Hi Chris,

    Here you go:

    angular.module("umbraco").controller("Our.Umbraco.PropertyEditors.Vorto.vortoEditor", [
        '$scope',
        '$rootScope',
        'appState',
        'editorState',
        'formHelper',
        'umbPropEditorHelper',
        'Our.Umbraco.Resources.Vorto.vortoResources',
        'Our.Umbraco.Services.Vorto.vortoLocalStorageService',
        function ($scope, $rootScope, appState, editorState, formHelper, umbPropEditorHelper, vortoResources, localStorageService) {
    
            var currentSection = appState.getSectionState("currentSection");
              if (currentSection == "merchello") 
             {  
                    currentSection = "content";
                    // 2871 is the id of the packages umbraco content node
                    editorState.current.id = 2871;
                    // 1129 is the id of the home page umbraco content node
                   editorState.current.parentId = 1129;
             }
    

    And

    // The content type scaffold
                function loadScaffold() {
    
                    // every detached content associated with a variant MUST share the same content type,
                    var detachedContentType = $scope.productVariant.detachedContentType();
    
                    if (!editor.ready(detachedContentType)) {
    
                        contentResource.getScaffold(-20, detachedContentType.umbContentType.alias).then(function(scaffold) {
    
                            editor.detachedContentType = detachedContentType;
                            editor.scaffold = scaffold;
                            //currentScaffold.filterTabs($scope.contentTabs, $scope.tabs);
                            //currentScaffold.fillValues($scope.tabs, $scope.detachedContent);
                            filterTabs(scaffold);
                            editorState.set(scaffold);
                            fillValues();
    
    
    
                            stickTab();
    
                            $scope.preValuesLoaded = true;
                        });
                    } else {
                        filterTabs(editor.scaffold);
                        fillValues();
                        stickTab();
                        $scope.preValuesLoaded = true;
                    }
                }
    
Please Sign in or register to post replies

Write your reply to:

Draft