Skip to content

Overriding shop templates

To override existing shop templates, first create a design for your shop.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ezdesign:
    design_list:
        my_design: [my_theme, eshop_base_theme, eshop_ui_base_theme, transaction_theme, checkout_base_theme]
    templates_theme_paths:
        eshop_base_theme:
            - '%kernel.project_dir%/vendor/ezsystems/ezcommerce-shop/src/Silversolutions/Bundle/EshopBundle/Resources/views'
        eshop_ui_base_theme:
            - '%kernel.project_dir%/vendor/ezsystems/ezcommerce-shop-ui/src/bundle/Resources/views/themes/standard'
        checkout_base_theme:
            - '%kernel.project_dir%/vendor/ezsystems/ezcommerce-checkout/src/bundle/Resources/views/themes/base_theme/'
        transaction_theme:
            - '%kernel.project_dir%/vendor/ezsystems/ezcommerce-transaction/src/Siso/Bundle/ShopFrontendBundle/Resources/views/themes/base_theme/'

Template theme paths

All shop bundles contain an ez_design.yml file which is used to define the templates_theme_path path to the templates. Without the template theme path, the templates are not recognized by the design engine.

Then, in ezplatform.yaml, indicate that the design should be used for the relevant scope, for example, for the site_group SiteAccess group:

1
2
        site_group:
            design: my_design

Finally, place your override templates in templates/themes/<theme_name>.

For example, to override the left menu in the product catalog view, place the template in templates/themes/my_theme/Navigation/left_menu.html.twig:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{{ fos_httpcache_tag('siso_menu') }}
<nav>
    <h2>{{ 'Our products:'|trans }}</h2>
    <hr>
    {{ ses_product() }}
    <hr>
    <ul class="side-nav js-side-nav" role="navigation">
        {{ knp_menu_render(menu, {'template': '@ezdesign/Navigation/knp_left_menu.html.twig'}) }}
    </ul>
</nav>