Hallo zusammen,
ich möchte in der Kategorieansicht das Backend um eine Variable Erweitern.
Leider bekomme ich das nicht so hin wie ich das gerne hätte
Im FirePhp bekomme ich bei der URL Folgender Fehlermeldung
URL/backend/AttributeData/loadData
TypeError: form.attributes is undefined
Hier is meine Quellcode,
hat einer eine Idee was ich falsch mache.
//Bootstrap.php
class Shopware_Plugins_frontend_sisiListViewSlider_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
public function getInfo()
{
return array(
‘autor’ => ‘Sign&Sinn’,
‘version’ => $this->getVersion(),
‘label’ => $this->getLabel(),
‘link’ => ‘http://signundsinn.de’,
);
}
public function getLabel()
{
return ‘SiSi Test’;
}
public function getVersion()
{
return “1.0.0”;
}
/**
* @return \Shopware\Components\Model\ModelManager
*/
protected function getEntityManager()
{
return Shopware()->Models();
}
public function install()
{
try {
$this->subscribeEvents();
$this->createAttributes();
// $this->createMainAttributes();
} catch (Exception $e) {
return array(
‘success’ => false,
‘message’ => $e->getMessage()
);
}
return true;
}
private function subscribeEvents(){
$this->subscribeEvent(
‘Enlight_Controller_Action_PostDispatchSecure_Backend_Category’,
‘onCategoryPostDispatch’
);
}
/**
* create additional attributes in s_user_attributes and re-generate attribute models
*/
private function createAttributes()
{
$this->Application()->Models()->addAttribute(
‘s_categories_attributes’,
‘sisi’,
‘start’,
‘varchar(255)’,
true,
NULL
);
$this->getEntityManager()->generateAttributeModels(array(
‘s_categories_attributes’
));
$metaDataCache = Shopware()->Models()->getConfiguration()->getMetadataCacheImpl();
$metaDataCache->deleteAll();
}
public function uninstall()
{
return true;
}
public function onCategoryPostDispatch(Enlight_Event_EventArgs $args)
{
/**@var $view Enlight_View_Default */
$view = $args->getSubject()->View();
/** @var \Enlight_Controller_Action $controller */
$controller = $args->getSubject();
$view = $controller->View();
$request = $controller->Request();
// Add template directory
$args->getSubject()->View()->addTemplateDir(__DIR__ . ‘/Views/’);
if ($request->getActionName() == ‘load’) {
$view->extendsTemplate(‘backend/category/view/sisi_list_slider/tabs/settings.js’);
$view->extendsTemplate(‘backend/category/model/sisi_list_slider/detail.js’);
}
}
}
//Model
// {block name=“backend/base/model/category/fields” append}
{ name:‘sisi_start’, type: ‘string’, useNull:true, defaultValue: null },
//{/block}
// View
Ext.define(‘Shopware.apps.Category.view.sisiListSlider.tabs.Settings’, {
override:‘Shopware.apps.Category.view.category.tabs.Settings’,
/**
* This extjs override will call the original method first
* and then change the xtype of the 3rd field
*/
getDefaultSettingItems: function() {
var me = this,
result = me.callParent(arguments);
result[result.length+1]= {
xtype:‘textfield’,
fieldLabel:‘List Slider Aktiv hurra’,
name:‘attribute[sisi_start]’,
dataIndex:‘attribute[sisi_start]’,
};
return result;
}
});