Mobile navbar is an interface element, which allows your customers to navigate between the upper-level sections of your store. A mobile navbar is displayed in the lower part of the screen.
The similar interface element in mobile applications is usually called Tab Bars.
Note
Mobile navbar is displayed only in Nova theme.
Use an addon to add a new section to the mobile navbar. To add a new section, connect to the hook in the index:navbar_mobile template. For example, create the file design/themes/nova_theme/templates/addons/YOUR_ADDON/hooks/index/navbar_mobile.post.tpl with the following content:
{strip}
{$navbar_mobile_items = array_merge($navbar_mobile_items, [
my_changes => [
id => "my_changes",
insert_before_id => "account",
container_id => "account_info_navbar_mobile_my_changes",
href => "my_changes.view",
controllers => ["my_changes"],
badge => $my_changes_navbar_mobile_badge,
icon => "ty-icon-heart",
custom_icon => "html source",
text => __("my_changes.navbar_mobile.text")
]
])}
{* Example of a dynamic icon *}
{if true}
{capture name="my_changes_custom_icon" assign="my_changes_custom_icon"}
<span class="ty-navbar-mobile__item-profile-icon">
HI
</span>
{/capture}
{$navbar_mobile_items.my_changes.custom_icon = $my_changes_custom_icon}
{/if}
{* Export *}
{$navbar_mobile_items = $navbar_mobile_items scope=parent}
{/strip}
where:
id (string)—ID of the element (not used for html-attribute id);insert_before_id / insert_after_id—insert before / after the element with the specified ID. The following elements are available by default: homepage, menu, cart, account. The wish list element is available only if the Wish List addon is activated;container_id (string)—(optional) ID of the html-attribute id of the container. It is useful in Ajax requests in case badge is updated;href (string)—link to the page;controllers (string)—a list of controllers, with which the section is active;badge (string)—(optional) a number or a text of the section badge;icon (string)—an icon of the following type ty-icon-xxx. See the list of all icons in CSS styles design/themes/nova_theme/css/tygh/icons.less.custom_icon (string)—(optional) a custom html instead of icon. If specified, icon is ignored. For example, it is used to display the avatar of an authorized user.text (string)—a text of the section name; max. 9 symbols.Hint
Example: The Wish List addon, which adds a new section before the Profile section. Template: design/themes/nova_theme/templates/addons/wishlist/hooks/index/navbar_mobile.post.tpl:
{strip}
{$wishlist_count = ""|fn_wishlist_get_count scope=parent}
{$navbar_mobile_items = array_merge($navbar_mobile_items, [
wishlist => [
id => "wishlist",
insert_before_id => "account",
container_id => "account_info_navbar_mobile_wishlist",
href => "wishlist.view",
controllers => ["wishlist"],
badge => (($wishlist_count > 0) ? $wishlist_count : ""),
icon => "ty-icon-heart",
text => __("wishlist.navbar_mobile.text")
]
])}
{* Export *}
{$navbar_mobile_items = $navbar_mobile_items scope=parent}
{/strip}
A page can correspond to a mobile navbar section. While on that page, the corresponding navbar section is highlighted.
Operation of an active section on the mobile navbar is based on the controller of the current page:
menus, categories, products controllers;checkout controllers;wishlist controllers;profiles, auth, orders, product_features controllers. Addons: reward_points, vendor_communication controllers;To display the active section for your page, create the file design/themes/nova_theme/templates/addons/YOUR_ADDON/hooks/index/navbar_mobile.post.tpl with the following content:
{strip}
{$navbar_mobile_items.SECTION.controllers = $navbar_mobile_items.SECTION.controllers|array_merge:["MY_CONTROLLER"]}
{$navbar_mobile_items = $navbar_mobile_items scope=parent}
{/strip}
where:
SECTION—menu, cart, account, wishlist section;MY_CONTROLLER—your controller, which, if displayed, provides an active section.Hint
Example: The Reward Points addon, which displays an active Profile section for the reward_points controller. Template: design/themes/nova_theme/templates/addons/reward_points/hooks/index/navbar_mobile.post.tpl:
{strip}
{$navbar_mobile_items.account.controllers = $navbar_mobile_items.account.controllers|array_merge:["reward_points"]}
{$navbar_mobile_items = $navbar_mobile_items scope=parent}
{/strip}
Questions & Feedback
Have any questions that weren't answered here? Need help with solving a problem in your online store? Want to report a bug in our software? Find out how to contact us.