diff --git a/erpnext/website/templates/html/outer.html b/erpnext/website/templates/html/outer.html
index 47184fa28c..25525af7f4 100644
--- a/erpnext/website/templates/html/outer.html
+++ b/erpnext/website/templates/html/outer.html
@@ -14,18 +14,33 @@
diff --git a/erpnext/website/web_cache.py b/erpnext/website/web_cache.py
index 7b3de0aaef..9892dac78c 100644
--- a/erpnext/website/web_cache.py
+++ b/erpnext/website/web_cache.py
@@ -139,11 +139,26 @@ def get_outer_env():
env dict for outer template
"""
import webnotes
+
+ all_top_items = webnotes.conn.sql("""\
+ select * from `tabTop Bar Item`
+ where parent='Website Settings' and parentfield='top_bar_items'
+ order by idx asc""", as_dict=1)
+
+ top_items = [d for d in all_top_items if not d['parent_label']]
+
+ # attach child items to top bar
+ for d in all_top_items:
+ if d['parent_label']:
+ for t in top_items:
+ if t['label']==d['parent_label']:
+ if not 'child_items' in t:
+ t['child_items'] = []
+ t['child_items'].append(d)
+ break
+
return {
- 'top_bar_items': webnotes.conn.sql("""\
- select * from `tabTop Bar Item`
- where parent='Website Settings' and parentfield='top_bar_items'
- order by idx asc""", as_dict=1),
+ 'top_bar_items': top_items,
'footer_items': webnotes.conn.sql("""\
select * from `tabTop Bar Item`