Hallo Leute,
Wie fügt man ein neues Tab bei der Produktbearbeitung im Backend wie hier https://developers.shopware.com/developers-guide/backend-extension/?_ga=1.259441865.2100811978.1489157753#example-#2:-custom-components hinzu?
app.js
//{block name="backend/article/application"}
//{$smarty.block.parent}
//{include file="backend/sd_product_tab/view/detail/my_own_tab.js"}
//{/block}
window.js
//{block name="backend/article/view/detail/window"}
//{$smarty.block.parent}
Ext.define('Shopware.apps.SdProductTab.view.detail.Window', {
override: 'Shopware.apps.Article.view.detail.Window',
getTabs: function() {
var me = this,
result = me.callParent();
result.push(Ext.create('Shopware.apps.SdProductTab.view.detail.MyOwnTab'));
return result;
}
});
//{/block}
my_own_tab.js
Ext.define('Shopware.apps.SdProductTab.view.detail.MyOwnTab', {
extend: 'Shopware.apps.Article.view.detail.Base',
padding: 10,
title: 'MyOwnTab',
initComponent: function() {
var me = this;
me.items = [{
xtype: 'label',
html: 'Hello world'
}];
me.callParent(arguments);
}
});
SdProductTab.php
'onArticlePostDispatch'
];
}
/**
* @param Enlight_Controller_ActionEventArgs $args
*/
public function onArticlePostDispatch( Enlight_Controller_ActionEventArgs $args ) {
$controller = $args->getSubject();
/** @var \Enlight_Controller_Action $controller */
$view = $controller->View();
$request = $controller->Request();
$view->addTemplateDir( __DIR__. '/Views' );
if ( $request->getActionName() == 'index' ) {
$view->extendsTemplate( 'backend/sd_product_tab/app.js' );
}
if ( $request->getActionName() == 'load' ) {
$view->extendsTemplate( 'backend/sd_product_tab/view/detail/window.js' );
}
}
}
Struktur:
Hoffe jemand kann helfen. wir benutzen 5.12.20.
LG