Hi zusammen,
ich versuche seit gestern eine SW Core Backend Component anzupassen. Es handelt sich dabei um die Länder Componente unter Grundeinstellungen/Shopeinstellungen. Leider wird meine country.js nicht geladen und ich bin mittlerweile am verzweifeln. Ich habe dazu ein neues Plugin erstellt.
In meiner Plugin Class habe ich folgendes:
<?php
namespace MaCoBackendExtended;
use Shopware\Components\Plugin;
class MaCoBackendExtended extends Plugin{
/**
* @return array|string[]
*/
public static function getSubscribedEvents()
{
return [
'Enlight_Controller_Action_PostDispatchSecure_Backend_Config' => 'extendConfigCountry'
];
}
/**
* @param \Enlight_Controller_ActionEventArgs $args
*/
public function extendConfigCountry(\Enlight_Controller_ActionEventArgs $args){
$request = $args->getSubject()->Request();
$view = $args->getSubject()->View();
$view->addTemplateDir($this->getPath() . '/Resources/views');
if($request->getActionName() === 'load'){
$view->extendsTemplate('backend/config/view/form/country.js');
}
}
}
Das scheint hier auch alles zu funktionieren - wenn ich zb ein dd(„test“); direkt über $view->extendsTemplate setze, erhalte ich einen Fehler im Backend, sobald ich die Länder aufrufen will.
Meine country.js
//{namespace name=backend/config/view/form}
//{block name="backend/config/view/form/country"}
Ext.define('Shopware.apps.MaCoBackendExtended.view.form.Country', {
override: 'Shopware.apps.Config.view.form.Country',
getFormItems: function() {
const me = this;
me.callParent(arguments);
return [{
name: 'name',
fieldLabel: '{s name=country/detail/name_label}Name{/s}',
translatable: true,
allowBlank: false
},{
name: 'isoName',
fieldLabel: '{s name=country/detail/iso_name_label}International name{/s}'
},{
xtype: 'config-element-boolean',
name: 'active',
translatable: true,
fieldLabel: '{s name=country/detail/active_label}Active{/s}'
},{
xtype: 'config-element-boolean',
name: 'allowShipping',
translatable: true,
translationName: 'allow_shipping',
fieldLabel: '{s name=country/detail/allow_shipping}Allow the usage as shipping country{/s}'
},{
xtype: 'config-element-select',
name: 'areaId',
fieldLabel: '{s name=country/detail/area_label}Area{/s}',
store: 'base.CountryArea'
},{
name: 'iso',
fieldLabel: '{s name=country/detail/iso_label}Short code{/s}'
},{
name: 'iso3',
fieldLabel: '{s name=country/detail/iso_three_label}Short code (three-letter){/s}'
},{
xtype: 'config-element-number',
name: 'position',
translatable: true,
fieldLabel: '{s name=country/detail/position_label}Position{/s}123',
helpText: '{s name=country/detail/position_help}Position in select fields.{/s}'
},{
xtype: 'config-element-textarea',
name: 'description',
fieldLabel: '{s name=country/detail/description_label}Description{/s}',
translatable: true,
helpText: '{s name=country/detail/description_help}Notices to display in frontend.{/s}'
},{
xtype: 'config-element-boolean',
name: 'taxFree',
fieldLabel: '{s name=country/detail/tax_free_label}Tax free{/s}',
helpText: '{s name=country/detail/tax_free_help}If true disable tax rules for this country.{/s}'
},{
xtype: 'config-element-boolean',
name: 'taxFreeUstId',
fieldLabel: '{s name=country/detail/tax_free_company_label}Tax free for companies{/s}',
helpText: '{s name=country/detail/tax_free_company_help}If user entered a vat id disable tax.{/s}'
},{
xtype: 'config-element-boolean',
name: 'displayStateInRegistration',
fieldLabel: '{s name=country/detail/display_state_label}Display state selection{/s}',
helpText: '{s name=country/detail/display_state_help}Display state selection in registration process{/s}'
},{
xtype: 'config-element-boolean',
name: 'forceStateInRegistration',
fieldLabel: '{s name=country/detail/required_state_label}Force state selection{/s}',
helpText: '{s name=country/detail/required_state_help}Force state selection in registration process{/s}'
},
me.getStateGrid()]
}
});
//{/block}
Egal was ich in der country.js anstelle, es passiert nichts und ich habe absolut keine Idee mehr, woran es liegen könnte.
Hier noch meine Ordnerstruktur:
Kann mir da jemand weiterhelfen?
Danke und viele Grüße
Jochen