How to catch OnSave event of ProductDetail

I have a new tab in the products detail page by followinf this guide. but now I need to catch the event onSave when the user click on that button. Any idea how to achiev that?

Thanks

Do you know how to override a vue.js component and inherit a method? In this case you could change the onSave() method of the sw-product-detail component :wink:

Hi Moorleiche. No, I don’t know how to do it, maybe that’s why I’m asking, actually vue.js does not have such thing out of the box. Now I see the component factory machanism of SW components, that is good but not the best, since I have to copy the content of the method, if something change in that method in future versions then that would be a problem, or at least I have to keep an eye there and updete the code of my override method.

 

1 „Gefällt mir“

i think its too late but i just had the same problem and found a solution:

its simple: this.$super('onSave');

so in the code it should look sth like this:

Shopware.Component.override('sw-product-detail', {
  methods: {
    onSave() {
        // your code
         this.$super('onSave');
    }
  }
}
1 „Gefällt mir“