Important

You are browsing documentation for version 6.0 of OroCommerce, supported until 2028. Read the documentation for the latest LTS version to get up-to-date information.

See our Release Process documentation for more information on the currently supported and upcoming releases.

Client Side Navigation 

Client Side Navigation enables pages to be loaded in different formats (HTML or JSON) depending on the request. The first request from the browser loads the complete HTML page, while all subsequent requests are handled by JavaScript and load page blocks in JSON format.

To prepare a page for client-side navigation, follow these steps:

  • Add an additional check in the main layout template:

{% if not oro_is_hash_navigation() %}
<!DOCTYPE html>
<html>
...
[content]
...
</html>
{% else %}
{# Template for hash navigation #}
{% include '@OroNavigation/HashNav/hashNavAjax.html.twig'
    with {'script': block('head_script'), 'messages': block('messages'), 'content': block('page_container')}
%}
{% endif %}

Where:

  • block('head_script') – contains page-related JavaScript

  • block('messages') – contains system messages

  • block('page_container') – content area block (without header/footer) that is reloaded during navigation

  • To exclude links from client-side navigation (for example, window-open buttons or delete links), add the CSS class no-hash to the link tag:

<a href="page-url" class="no-hash">...</a>

Forms are also submitted via AJAX as part of the client-side navigation process.