0
votes

I am using a custom theme in Shopware, the parent theme is "Bare" theme, when I need to use some data or alter existing data, still I do not understand how I can do this using controllr, plugin or widgets.

Example:- I need to display "sub categories" on my home page main menu. When I use "{debug}" on my index.tpl I can see all the main categories but the sub categories are not available even though I have created and activated sub categories on my back end.

I checked the configurations settings to make sure if anything is blocking it from showing on front end. What kind of approach I should use to get this thing done. What is the solution? Update index controller? Any CMS option to enable /disable? install a plugin? create a widget?

FYI: This is what I can see on my debug screen on home page (index.tpl)

$sCategory
 flag => false
 subcategories => Array (0)
 childrenCount => 2
 7 => Array (23)
 id => 7
 name => "IVORY & WHITE"
 metaKeywords => null 
1

1 Answers

4
votes

There is a plugin called AdvancedMenu which has to be activated via the Plugin Manager. In the plugin's config you are able to define the nesting level of how deep the category should be shown. This setting set to 2 by default, I guess. After activating the plugin there should be a new variable $sAdvancedMenu available in the Smarty template.

Please have a look: http://en.community.shopware.com/_detail_1602.html?_ga=1.192119343.464766896.1445350898

Another way (without the AdvancedMenu plugin) would be as follows:

There is a Shopware Core class available via Shopware()->Modules()->Categories() that contains a method called sGetWholeCategoryTree($current). This method returns the whole category subtree for any given root category. But in that case you need to create a plugin that is listening to the Enlight_Controller_Front_PostDispatch event or any similar. After assigning the tree to the view you will have access to a hierarchical multidimensional array of categories with their related children.