Hey,
I would like to add a Custom button in order details next to Edit button.
I’m struggling to find what module and twig block to override, I’ve been trying to override sw-order-detail module but it doesn’t seem to work. I did not find any other module with Edit button that I could overwrite.
Could anyone point me into the right direction?
the sw-order-detail
is the right way.
How did you override the module? Can you show some code?
Have you imported your module into main.js
?
Hey,
yes module was imported in main.js then in index.js I’m overwriting module:
import template from './sw-order-detail.html.twig';
const { Component } = Shopware;
Component.override('sw-order-detail', {
template
});
then in sw-order-detail.html.twig some basic code:
{% block sw_order_detail_actions_slot_smart_bar_actions %}
{% parent() %}
<sw-button
variant="primary"
>
Print
</sw-button>
{%endblock%}
Twig blocks I tried:
sw_order_detail_actions
sw_order_detail_actions_slot_smart_bar_actions
sw_order_detail_actions_edit
When I overwrite sw-order-detail-base (and then choose some twig block from base), instead of sw-order-detail, button appears just fine, but I cannot get button to show.
I am installing assets and clearing cache every time i make change and elements in other places appear, so it should here too. I added buttons in many other subpages, just this one does not seem to work, no matter what I do.
use {% parent %}
without the brackets.
otherwise it looks ok to me.