Hi,
I’m trying to extend the custom products plugin to add new tabs and extra functions, I’m following some resources but without luck so far
https://developers.shopware.com/developers-guide/backend-extension/
Extend an existing plugin via another plugin
And this is what I have at the moment
public static function getSubscribedEvents()
{
return [
'Enlight_Controller_Action_PostDispatch_Backend_SwagCustomProducts' => 'extendBackendModule',
];
}
/**
* @param \Enlight_Event_EventArgs $arguments
*/
public function extendBackendModule(\Enlight_Event_EventArgs $arguments)
{
$subject = $arguments->get('subject');
$view = $subject->View();
$view->addTemplateDir($this->path . '/Resources/Views/');
if ($arguments->get('request')->getActionName() === 'index') {
$view->extendsTemplate('backend/swag_custom_products/app.js');
}
if ($arguments->get('request')->getActionName() === 'detail') {
$view->extendsTemplate('backend/swag_custom_products/view/detail/window.js');
}
}
app.js
//{block name="backend/swag_custom_products/application"}
// {$smarty.block.parent}
// {include file="backend/swag_custom_products/view/detail/my_own_tab.js"}
//{/block}
window.js
//{block name="backend/customer/view/detail/window"}
// {$smarty.block.parent}
Ext.define('Shopware.apps.SwagExtendCustomer.view.detail.Window', {
override: 'Shopware.apps.SwagCustomProducts.detail.Window',
getTabs: function() {
var me = this,
result = me.callParent();
result.push(Ext.create('Shopware.apps.SwagExtendCustomer.view.detail.MyOwnTab'));
return result;
}
});
//{/block}
my_own_tab.js
// This tab will be shown in the customer module
Ext.define('Shopware.apps.swag_custom_products.view.detail.MyOwnTab', {
extend: 'Shopware.apps.SwagCustomProducts',
padding: 10,
title: 'MyOwnTab',
initComponent: function() {
var me = this;
me.items = [{
xtype: 'label',
html: 'Hello world'
}];
me.callParent(arguments);
}
});
As I said the idea is have an extra tab with extra actions inside the actual custom products