list.tpl cannot be found with standard scaffold (described in SW5 Docs)

Hi,

The list.tpl cannot be found. I thought that there would be a default template for that, which uses the ExtJs model infomation to render the columns…

I’m using this “tutorial”

https://developers.shopware.com/developers-guide/backend-components/basics/

I come across an error, before starting the section “The last 25% to complete our application”.

I’m using Shopware 5.2.9, maybe I forgot something or the tutorial needs an update.

Maybe someone can help

Regards

Jakob

 

Here the full error:

Ups! Ein Fehler ist aufgetreten! Die nachfolgenden Hinweise sollten Ihnen weiterhelfen. Unable to load template snippet ‘backend/pos/list.tpl’ in engine/Library/Smarty/sysplugins/smarty_internal_templatebase.php on line 127 Stack trace:
#0 engine/Library/Enlight/View/Default.php(274): Smarty_Internal_TemplateBase->fetch()
#1 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(216): Enlight_View_Default->render(Object(Enlight_Template_Default))
#2 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(242): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->renderTemplate(Object(Enlight_Template_Default))
#3 engine/Library/Enlight/Controller/Plugins/ViewRenderer/Bootstrap.php(136): Enlight_Controller_Plugins_ViewRenderer_Bootstrap->render()
#4 [internal function]: Enlight_Controller_Plugins_ViewRenderer_Bootstrap->onPostDispatch(Object(Enlight_Controller_ActionEventArgs))
#5 engine/Library/Enlight/Event/Handler/Default.php(91): call_user_func(Array, Object(Enlight_Controller_ActionEventArgs))
#6 engine/Library/Enlight/Event/EventManager.php(214): Enlight_Event_Handler_Default->execute(Object(Enlight_Controller_ActionEventArgs))
#7 engine/Library/Enlight/Controller/Action.php(202): Enlight_Event_EventManager->notify(‘Enlight_Control…’, Object(Enlight_Controller_ActionEventArgs))
#8 engine/Library/Enlight/Controller/Dispatcher/Default.php(523): Enlight_Controller_Action->dispatch(‘listAction’)
#9 engine/Library/Enlight/Controller/Front.php(223): Enlight_Controller_Dispatcher_Default->dispatch(Object(Enlight_Controller_Request_RequestHttp), Object(Enlight_Controller_Response_ResponseHttp))
#10 engine/Shopware/Kernel.php(177): Enlight_Controller_Front->dispatch()
#11 vendor/symfony/http-kernel/HttpCache/HttpCache.php(487): Shopware\Kernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 engine/Shopware/Components/HttpCache/AppCache.php(255): Symfony\Component\HttpKernel\HttpCache\HttpCache->forward(Object(Symfony\Component\HttpFoundation\Request), true, NULL)
#13 vendor/symfony/http-kernel/HttpCache/HttpCache.php(258): Shopware\Components\HttpCache\AppCache->forward(Object(Symfony\Component\HttpFoundation\Request), true)
#14 engine/Shopware/Components/HttpCache/AppCache.php(103): Symfony\Component\HttpKernel\HttpCache\HttpCache->pass(Object(Symfony\Component\HttpFoundation\Request), true)
#15 shopware.php(113): Shopware\Components\HttpCache\AppCache->handle(Object(Symfony\Component\HttpFoundation\Request))
#16 {main}

Did you unzip the installation package directly on the server? It seems that some files went missing during the upload.

This far I used my own model etc. I didn’t want to rebuild tutorial. I will check the zip. 

I installed via git. I don’t think something went missing.

The tutorial AND the mentioned zip (SwagProductBasics.zip) from the tutorial do not include any tpl files.

Nonetheless the backend seems to look for a

backend/pos/list.tpl

where pos is the controller and model name I used in in ExtJs. Shouldn’t a standard list grid be rendered out of the box by definition of the model? Thats how I understand the tutorial. Why is it looking for a backend/customcontrollername/list.tpl ?

//EDIT: maybe important to mention I used the new Plugin structure under [sw]/custom/plugins and the PSR4 loaded controller with the naming convention like this

get('kernel')->getPlugins()['PluginName'];
        $this->get('template')->addTemplateDir($plugin->getPath() . '/Resources/views/');
    }
}

and [pluginDir]/Resources/views/ holds all the ExtJs files from the tutorial (see screenshot)

Also I couldn’t find any example of a file named list.tpl in the whole SW folder. This is weird.

Anyone? I’m just trying to accomplish basic behavior.

The backend controller should just render a json response. Therefore I don’t see why a tpl file is needed.

Alright, maybe someone faces the same problem. So here the solution.

I forgot to call the

parent::preDispatch();

in which the following code is found

        if (!in_array($this->Request()->getActionName(), array('index', 'load', 'skeleton', 'extends'))) {
            $this->Front()->Plugins()->Json()->setRenderer();
        }

This tells the controller to use the JSON renderer if a non-init action (like list ) is called.

Thanks for helping anyway…