Hey everyone, this How-To shows you how to display all main categories and it’s subcategories using the plugin “AdvancedMenu” and a simple template modification. 1. Create a custom template Before you start, please create a new template in the “/templates”-folder which is located in the root of each Shopware installation. The folder should start with the prefix “emotion_” to extend the new default template which is shipped with Shopware 4. 2. Do the template modification After you’ve created the template (or if you decided to use your own custom template), please create the following folder structure in the template folder: frontend/index
Now head over to the newly created folder named “index”, create a new file named “categories_left.tpl” in the folder and paste the following code snippet in it: [code] {* Maincategories left *} {function name=categories level=0}
{block name=“frontend_index_categories_left_ul”}{/block} {foreach from=$categories item=category} - {$category.description} {if $category.sub} {call name=categories categories=$category.sub level=$level+1} {/if}
{/foreach}{/function} {if $sCategories} {call name=categories categories=$sAdvancedMenu} {elseif $sMainCategories} {call name=categories categories=$sMainCategories} {/if}
[/code] Alright, now the template modification is done and we could switch over to the backend and install the “AdvancedMenu” plugin and activate the new template. 3. Install the necessary plugin To do so, open the main menu entry “Configuration” and select the menu entry “Plugin manager”. In the top right corner of the newly opened window you see a search field which can be used to find the plugin. Please type in “advanced menu” and press the green plus in the plugin list to install the plugin. If the installation was successfully, the plugin configuration window shows up. In the configuration window you can set the maximum menu level you want to output. If you’re done, please press the “save” button to save your settings. 4. Activate your custom template Now go back to the main menu entry “Configuration” and select the menu entry “Basic settings”. In the top left corner of the newly opened window you find a search field. Please use the field to search for the term “templates”. After the search result appears, please click on the entry “template” to activate it. After the entry was activated, please select your subshop in the combo box which is located at the top of the window. Now you can select your template using a single click on it. The template will be set as active after you click the button labeled “Select template”. Best regards, Stephan Pohl :shopware: