Reputation: 1431
I have two plugins:
How can I do this in Shopware 6?
XYZ plugin code in tabs.html.twig
file:
{% sw_extends '@Storefront/storefront/page/product-detail/tabs.html.twig' %}
{% block page_product_detail_tabs_inner %}
<div class="detail-accordion" id="accordion">
{% block page_product_detail_accordion_description %}
<div class="card card-accordion card-accordion-description">
{% block page_product_detail_accordion_description_header %}
{# My custom logic #}
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}
ABC plugin code in tabs.html.twig
file:
{% sw_extends '../../../../../../../XYZ/src/Resources/views/storefront/page/product-detail/tabs.html.twig' %}
{% block page_product_detail_tabs_inner %}
{{ parent() }}
<div class="detail-accordion" id="accordion">
{% block page_product_detail_accordion_description %}
<div class="card card-accordion card-accordion-description">
{% block page_product_detail_accordion_description_header %}
{# My new custom logic to append #}
{% endblock %}
</div>
{% endblock %}
</div>
{% endblock %}
Unfortunately, this code is not working.
Upvotes: 3
Views: 2657
Reputation: 2549
{% sw_extends '../../../../../../../XYZ/src/Resources/views/storefront/page/product-detail/tabs.html.twig' %}
this is wrong.
You have to extend @Storefront
in both cases and make sure that you your plugins are loaded in the right sequence.
So if you first load your plugin ABC
then XYZ
is automatically able to extend the template of ABC
.
Updated answer Plugins are getting loaded in the order of the installation date (currently v6.4).
Upvotes: 4