From dea20c9202a21c268717dc30c4c20c30ba9d9ff3 Mon Sep 17 00:00:00 2001 From: Robert Saternus Date: Mon, 10 Feb 2025 14:54:26 +0100 Subject: [PATCH] FFWEB-3313: Remove unnecessary star (*) search requests on dev env mode For dev env fields roles are not cached because cache is cleared with each request. So for dev env it sent a lot of star(*) search requests to update fields roles. Now for dev env fields roles are fetched from services.xml --- CHANGELOG.md | 1 + README.md | 2 ++ src/Config/CachedFieldRoles.php | 25 ++++++++++++++++--- src/Resources/config/services.xml | 1 + .../administration/js/omikron-fact-finder.js | 2 +- src/Utilites/Ssr/PriceFormatter.php | 8 +++--- 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f65b28a..dc63e6ec 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Fix - Remove CategoryPath filter in URL and ASN on category page - Fix add to cart tracking issue for shopware listing products +- Remove unnecessary star (*) search requests on dev env mode ## [v6.1.0] - 2025.01.28 ### Change diff --git a/README.md b/README.md index 49d2388d..2c0b4331 100755 --- a/README.md +++ b/README.md @@ -130,6 +130,8 @@ Without SSR enabled, web crawlers could not have a chance to scan the element re **Note:** More information about SSR concept you can find in the article [Server Side Rendering](https://web-components.fact-finder.de/documentation/4.x/server-side-rendering) from Web Components documentation. +**Note:** If you have a problem with displaying product images or prices correctly, you probably have Field Roles set incorrectly. You can easily fix this by setting [custom fields roles](#set-custom-field-roles) + ## Advanced Settings ![Advanced Settings](docs/assets/advanced-settings.png "Advanced Settings") diff --git a/src/Config/CachedFieldRoles.php b/src/Config/CachedFieldRoles.php index 8be81445..59cd2888 100644 --- a/src/Config/CachedFieldRoles.php +++ b/src/Config/CachedFieldRoles.php @@ -10,15 +10,27 @@ class CachedFieldRoles implements FieldRolesInterface { private FieldRolesInterface $decorated; private AdapterInterface $cache; + private string $kernelEnv; + private array $defaultFieldRoles; - public function __construct(FieldRolesInterface $decorated, AdapterInterface $cache) - { - $this->decorated = $decorated; - $this->cache = $cache; + public function __construct( + FieldRolesInterface $decorated, + AdapterInterface $cache, + string $kernelEnv, + array $fieldRoles, + ) { + $this->decorated = $decorated; + $this->cache = $cache; + $this->kernelEnv = $kernelEnv; + $this->defaultFieldRoles = $fieldRoles; } public function getRoles(?string $salesChannelId): array { + if ($this->isDevEnv()) { + return $this->defaultFieldRoles; + } + $salesChannelId = $salesChannelId ?? ''; $cacheKey = $this->getCacheKey($salesChannelId); $item = $this->cache->getItem($cacheKey); @@ -49,4 +61,9 @@ private function getCacheKey(string $salesChannelId): string { return sprintf('factfinder-field-roles-%s', $salesChannelId); } + + private function isDevEnv(): bool + { + return $this->kernelEnv === 'dev'; + } } diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 2641ac58..c007c5f3 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -79,6 +79,7 @@ %factfinder.export.products.columns.base% %kernel.project_dir% + %kernel.environment% diff --git a/src/Resources/public/administration/js/omikron-fact-finder.js b/src/Resources/public/administration/js/omikron-fact-finder.js index 2b918fe0..4cf75c9e 100755 --- a/src/Resources/public/administration/js/omikron-fact-finder.js +++ b/src/Resources/public/administration/js/omikron-fact-finder.js @@ -1 +1 @@ -(function(){var e={228:function(){},494:function(){},782:function(){},787:function(){},132:function(){},259:function(e,n,t){var i=t(228);i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals),t(346).Z("6c33f4d4",i,!0,{})},262:function(e,n,t){var i=t(494);i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals),t(346).Z("1e877f1c",i,!0,{})},288:function(e,n,t){var i=t(782);i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals),t(346).Z("2bad29ae",i,!0,{})},577:function(e,n,t){var i=t(787);i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals),t(346).Z("004f6500",i,!0,{})},700:function(e,n,t){var i=t(132);i.__esModule&&(i=i.default),"string"==typeof i&&(i=[[e.id,i,""]]),i.locals&&(e.exports=i.locals),t(346).Z("1afa291d",i,!0,{})},346:function(e,n,t){"use strict";function i(e,n){for(var t=[],i={},s=0;st.parts.length&&(i.parts.length=t.parts.length)}else{for(var o=[],s=0;s\n \n
\n \n \n
\n \n \n{% endblock %}\n'});let{Component:n}=Shopware;n.register("sw-cms-block-listing-preview",{template:'{% block cms_block_commerce_factfinder_listing_preview %}\n
\n FACT-Finder Search Result\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsBlock({name:"listing",label:"sw-cms.blocks.commerce.factfinderWebComponentsListing.label",category:"commerce",component:"sw-cms-block-listing",previewComponent:"sw-cms-block-listing-preview",slots:{toolbarFilters:"asn",toolbarPaging:"paging",toolbarSorting:"sortbox",records:"record-list"}});let{Component:i}=Shopware;i.register("sw-cms-block-campaigns",{template:'{% block cms_block_commerce_factfinder_campaigns %}\n
\n \n
\n{% endblock %}\n'});let{Component:s}=Shopware;s.register("sw-cms-block-campaigns-preview",{template:'{% block cms_block_commerce_factfinder_campaigns_preview %}\n
\n FACT-Finder Campaigns\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsBlock({name:"campaigns",label:"sw-cms.blocks.commerce.factfinderWebComponentsCampaigns.label",category:"commerce",component:"sw-cms-block-campaigns",previewComponent:"sw-cms-block-campaigns-preview",slots:{campaigns:"campaigns"}});let{Component:a}=Shopware;a.register("sw-cms-block-filters",{template:'{% block cms_block_commerce_factfinder_filters %}\n
\n \n
\n{% endblock %}\n'});let{Component:o}=Shopware;o.register("sw-cms-block-filters-preview",{template:'{% block cms_block_commerce_factfinder_filters_preview %}\n
\n FACT-Finder Filters\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsBlock({name:"filters",label:"sw-cms.blocks.commerce.factfinderWebComponentsFilters.label",category:"commerce",component:"sw-cms-block-filters",previewComponent:"sw-cms-block-filters-preview",defaultConfig:{cssClass:"cms-block-sidebar-filter"},slots:{filters:"asn"}}),Shopware.Component.register("sw-cms-el-record-list",{template:'{% block sw_cms_element_record_list %}\n
\n
FF-RECORD-LIST
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("record-list")}}}),Shopware.Component.register("sw-cms-el-config-record-list",{template:'{% block sw_cms_element_record_list_config %}\n
\n \n\n \n\n \n \n\n \n \n\n \n \n\n \n \n\n \n \n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("record-list")}}}),Shopware.Component.register("sw-cms-el-preview-record-list",{template:'{% block sw_cms_element_record_list_preview %}\n
\n FF-RECORD-LIST\n
\n{% endblock %}\n'}),Shopware.Service("cmsService").registerCmsElement({name:"record-list",label:"sw-cms.elements.recordList.label",component:"sw-cms-el-record-list",configComponent:"sw-cms-el-config-record-list",previewComponent:"sw-cms-el-preview-record-list",defaultConfig:{subscribe:{value:!0,source:"static"},infiniteScrolling:{value:!1,source:"static"},restoreScrollPosition:{value:!1,source:"static"},infiniteDebounceDelay:{value:"32",source:"static"},infiniteScrollMargin:{value:0,source:"static"},callbackArg:{value:"records",source:"static"},callback:{value:"",source:"static"},id:{value:"",source:"static"},domUpdated:{value:"",source:"static"}}}),Shopware.Component.register("sw-cms-el-asn",{template:'{% block sw_cms_element_asn %}\n
\n
FF-ASN
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("asn")}}}),t(577),Shopware.Component.register("sw-cms-el-config-asn",{template:'{% block sw_cms_element_asn_config %}\n
\n \n\n \n \n\n \n \n\n \n \n\n \n \n \n \n \n \n\n \n

Filter Cloud

\n \n\n \n \n \n\n \n \n\n \n \n \n \n \n \n
\n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("asn")}}}),Shopware.Component.register("sw-cms-el-preview-asn",{template:'{% block sw_cms_preview_element_asn %}\n
\n FF-ASN\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsElement({name:"asn",label:"sw-cms.elements.asn.label",component:"sw-cms-el-asn",configComponent:"sw-cms-el-config-asn",previewComponent:"sw-cms-el-preview-asn",defaultConfig:{subscribe:{value:!0,source:"static"},vertical:{value:!1,source:"static"},topic:{value:"asn",source:"static"},callbackArg:{value:"groups",source:"static"},callback:{value:"",source:"static"},id:{value:"",source:"static"},domUpdated:{value:"",source:"static"},filterCloud:{value:!0,source:"static"},filterCloudBlacklist:{value:"",source:"static"},filterCloudWhitelist:{value:"",source:"static"},filterCloudOrder:{value:"fact-finder",source:"static"}}}),Shopware.Component.register("sw-cms-el-sortbox",{template:'{% block sw_cms_element_sortbox %}\n
\n
FF-SORTBOX
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("sortbox")}}}),Shopware.Component.register("sw-cms-el-config-sortbox",{template:'{% block sw_cms_element_sortbox_config %}\n
\n \n \n \n \n \n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("sortbox")}}}),Shopware.Component.register("sw-cms-el-preview-sortbox",{template:'{% block sw_cms_element_sortbox_preview %}\n
\n FF-SORTBOX\n
\n{% endblock %}\n'}),Shopware.Service("cmsService").registerCmsElement({name:"sortbox",label:"sw-cms.elements.sortbox.label",component:"sw-cms-el-sortbox",configComponent:"sw-cms-el-config-sortbox",previewComponent:"sw-cms-el-preview-sortbox",defaultConfig:{subscribe:{value:!0,source:"static"},opened:{value:!0,source:"static"},showSelected:{value:!1,source:"static"},showSelectedFirst:{value:!1,source:"static"},collapseOnblur:{value:!1,source:"static"}}}),Shopware.Component.register("sw-cms-el-paging",{template:'{% block sw_cms_element_paging %}\n
\n
FF-PAGING
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("paging")}}}),Shopware.Component.register("sw-cms-el-config-paging",{template:'{% block sw_cms_element_paging_config %}\n
\n \n \n \n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("paging")}}}),Shopware.Component.register("sw-cms-el-preview-paging",{template:'{% block sw_cms_element_paging_preview %}\n
\n FF-PAGING\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsElement({name:"paging",label:"sw-cms.elements.paging.label",component:"sw-cms-el-paging",configComponent:"sw-cms-el-config-paging",previewComponent:"sw-cms-el-preview-paging",defaultConfig:{subscribe:{value:!0,source:"static"},showOnly:{value:!1,source:"static"}}}),Shopware.Component.register("sw-cms-el-campaigns",{template:'{% block sw_cms_element_campaigns %}\n
\n
CAMPAIGNS
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("campaigns")}}}),Shopware.Component.register("sw-cms-el-config-campaigns",{template:'{% block sw_cms_element_campaigns_config %}\n
\n\n \n \n\n \n \n \n \n\n \n \n\n \n \n \n\n \n \n \n \n\n \n \n\n\n \n \n \n \n \n \n \n \n \n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},data(){return{campaignFlags:["None","is-product-campaign","is-landing-page-campaign"]}},methods:{createdComponent(){this.initElementConfig("campaigns")}}}),Shopware.Component.register("sw-cms-el-preview-campaigns",{template:'{% block sw_cms_element_campaigns_preview %}\n
\n CAMPAIGNS\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsElement({name:"campaigns",label:"sw-cms.elements.campaigns.label",component:"sw-cms-el-campaigns",configComponent:"sw-cms-el-config-campaigns",previewComponent:"sw-cms-el-preview-campaigns",defaultConfig:{advisorCampaignName:{value:"",source:"static"},feedbackCampaignLabel:{value:"",source:"static"},feedbackCampaignFlag:{value:"",source:"static"},enableFeedbackCampaign:{value:!1,source:"static"},enableAdvisorCampaign:{value:!1,source:"static"},enableRedirectCampaign:{value:!1,source:"static"},enablePushedProducts:{value:!1,source:"static"},pushedProductsFlag:{value:"",source:"static"},pushedProductsName:{value:"",source:"static"}}}),t(700),t(288);let{Component:l,Mixin:c}=Shopware;l.register("ui-feed-export-form",{template:'{% block factfinder_module_ui_feed_export %}\n \n\n \n \n \n \n\n \n \n\n \n \n \n\n \n \n\n {{ $tc(\'ui-feed-export.component.export_form.button.title\') }}\n \n \n \n{% endblock %}\n',inject:["systemConfigApiService"],data(){return{salesChannelValue:null,salesChannelLanguageValue:null,exportTypeValue:null,typeSelectOptions:[],isCacheDisable:!1,isLoadingCache:!1,isLoadingExport:!1}},mixins:[c.getByName("notification")],mounted(){this.getPluginConfig(),this.getExportTypeValues()},filters:{capitalize:function(e){return e?(e=e.toString()).charAt(0).toUpperCase()+e.slice(1):""}},methods:{async getPluginConfig(){let e=await this.systemConfigApiService.getValues("OmikronFactFinder.config");this.isCacheDisable=e["OmikronFactFinder.config.enableExportCache"]},getExportTypeValues(){let e=Shopware.Service("syncService").httpClient,n={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};e.get("_action/fact-finder/get-export-type-options",{headers:n}).then(e=>{200===e.status&&(this.typeSelectOptions=e.data)})},successFeedGenerationWindow(){this.createNotificationSuccess({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.alert_success.text")})},errorFeedGenerationWindow(){this.createNotificationError({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.alert_error.text")})},errorNotValidParams(){this.createNotificationError({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.alert_not_valid_params.text")})},successRefreshCacheWindow(){this.createNotificationSuccess({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.refresh_cache_success.text")})},errorRefreshCacheWindow(){this.createNotificationError({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.refresh_cache_error.text")})},validateParams(e){return null!==e.salesChannelValue&&null!==e.salesChannelLanguageValue&&null!==e.exportTypeValue},getFeedExportFile(e){let n={salesChannelValue:this.salesChannelValue,salesChannelLanguageValue:this.salesChannelLanguageValue,exportTypeValue:this.exportTypeValue};if(!this.validateParams(n)){this.errorNotValidParams();return}this.isLoadingExport=!0;let t=Shopware.Service("syncService").httpClient,i={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};t.get(e,{headers:i,params:n}).then(e=>{200===e.status?this.successFeedGenerationWindow():this.errorFeedGenerationWindow(),this.isLoadingExport=!1})},refreshExportCache(e){this.isLoadingCache=!0;let n=Shopware.Service("syncService").httpClient,t={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"},i={salesChannelValue:this.salesChannelValue,salesChannelLanguageValue:this.salesChannelLanguageValue};n.get(e,{headers:t,params:i}).then(e=>{200===e.status?this.successRefreshCacheWindow():this.errorRefreshCacheWindow(),this.isLoadingCache=!1})}}});let{Component:r}=Shopware;r.register("ui-feed-export-index",{template:'{% block factfinder_ui_feed_export_index %}\n \n \n \n{% endblock %}\n',metaInfo(){return{title:this.$createTitle()}}});var d=JSON.parse('{"ui-feed-export":{"title":"FACT-Finder\xae Feed-Export","component":{"export_form":{"sales_channel":{"label":"Verkaufskanal"},"sales_channel_language":{"label":"Sprache"},"button":{"title":"Export erstellen"},"cache_button":{"title":"Cache-Export aktualisieren"},"alert_success":{"text":"Der Export wurde generiert"},"alert_error":{"text":"W\xe4hrend des Integrationsprozesses ist ein Fehler aufgetreten"},"export_type":{"label":"W\xe4hlen Sie den Exporttyp aus"},"alert_not_valid_params":{"text":"Bitte w\xe4hlen Sie Exportparameter aus"},"refresh_cache_success":{"text":"Der Export-Cache wurde aktualisiert"},"refresh_cache_error":{"text":"Beim Aktualisieren des Exportcaches ist ein Fehler aufgetreten"}}}}}'),p=JSON.parse('{"ui-feed-export":{"title":"FACT-Finder\xae Feed Export","component":{"export_form":{"sales_channel":{"label":"Sales Channel"},"sales_channel_language":{"label":"Language"},"button":{"title":"Create Export"},"cache_button":{"title":"Refresh cache Export"},"alert_success":{"text":"Export has been generated"},"alert_error":{"text":"An error occurred during integration process"},"export_type":{"label":"Select export type"},"alert_not_valid_params":{"text":"Please choose export parameters"},"refresh_cache_success":{"text":"Export cache has been refreshed"},"refresh_cache_error":{"text":"An error occurred during refresh export cache"}}}}}');let{Module:m}=Shopware;m.register("ui-feed-export",{color:"#ff3d58",icon:"default-shopping-paper-bag-product",title:"ui-feed-export.title",description:"",snippets:{"de-DE":d,"en-GB":p},routes:{index:{component:"ui-feed-export-index",path:"index"}},navigation:[{label:"ui-feed-export.title",path:"ui.feed.export.index",position:100,parent:"sw-extension"}]});let{Component:u,Mixin:f}=Shopware;u.register("update-field-roles",{template:'\n {{ $tc(\'configuration.updateFieldRoles.update\') }}\n\n',inject:["fieldRolesService"],mixins:[f.getByName("notification"),f.getByName("sw-inline-snippet")],data(){return{isLoading:!1,isSaveSuccessful:!1}},methods:{async onClick(){this.isLoading=!0,await this.fieldRolesService.sendUpdateFieldRoles(),this.isSaveSuccessful=!0,this.isLoading=!1,this.createNotificationSuccess({message:Shopware.Snippet.tc("configuration.updateFieldRoles.update")})}}}),t(259);let{Component:g,Mixin:h}=Shopware;g.register("test-api-connection",{template:'\n {{ $tc(\'configuration.testApiConnection.testConnection\') }}\n\n',mixins:[h.getByName("notification"),h.getByName("sw-inline-snippet")],data(){return{isLoading:!1,isSaveSuccessful:!1}},methods:{async onClick(){this.isLoading=!0;let e=Shopware.Service("syncService").httpClient,n={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};e.get("_action/test-connection/api",{headers:n}).then(e=>{200===e.status?this.createNotificationSuccess({message:Shopware.Snippet.tc("configuration.testConnection.success")}):this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).catch(()=>{this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).finally(()=>{this.isSaveSuccessful=!0,this.isLoading=!1})}}}),t(262);let{Component:v,Mixin:w}=Shopware;v.register("test-ftp-connection",{template:'\n {{ $tc(\'configuration.testFtpConnection.testConnection\') }}\n\n',mixins:[w.getByName("notification"),w.getByName("sw-inline-snippet")],data(){return{isLoading:!1,isSaveSuccessful:!1}},methods:{async onClick(){this.isLoading=!0;let e=Shopware.Service("syncService").httpClient,n={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};e.get("_action/test-connection/ftp",{headers:n}).then(e=>{200===e.status?this.createNotificationSuccess({message:Shopware.Snippet.tc("configuration.testConnection.success")}):this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).catch(()=>{this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).finally(()=>{this.isSaveSuccessful=!0,this.isLoading=!1})}}});let{Component:b,Mixin:C}=Shopware;b.register("test-push-import-connection",{template:'\n {{ $tc(\'configuration.testApiConnection.testConnection\') }}\n\n',mixins:[C.getByName("notification"),C.getByName("sw-inline-snippet")],data(){return{isLoading:!1,isSaveSuccessful:!1}},methods:{async onClick(){this.isLoading=!0;let e=Shopware.Service("syncService").httpClient,n={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};e.get("_action/test-connection/push-import",{headers:n}).then(e=>{200===e.status?this.createNotificationSuccess({message:Shopware.Snippet.tc("configuration.testConnection.success")}):this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).catch(()=>{this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).finally(()=>{this.isSaveSuccessful=!0,this.isLoading=!1})}}});let S=Shopware.Classes.ApiService;var x=class extends S{constructor(e,n){super(e,n,null,"application/json"),this.name="fieldRolesServiceApi"}sendUpdateFieldRoles(){let e=this.getBasicHeaders();return this.httpClient.get("_action/field-roles/update",{headers:e}).then(e=>S.handleResponse(e))}};Shopware.Service().register("fieldRolesService",()=>new x(Shopware.Application.getContainer("init").httpClient,Shopware.Service("loginService")));var _=JSON.parse('{"sw-cms":{"blocks":{"commerce":{"factfinderWebComponentsListing":{"label":"Typische Sammlung von Webkomponenten, die eine Suchergebnisseite implementiert"},"factfinderWebComponentsCampaigns":{"label":"FACT-Finder\xae Web Components Kampagnen"},"factfinderWebComponentsFilters":{"label":"FACT-Finder\xae Web Components Filter"},"factfinderWebComponentsRecordList":{"label":"FACT-Finder\xae Web Components Rekordliste"}}},"elements":{"recordList":{"label":"FACT-Finder\xae Web Components ff-record-list element","config":{"callbackArg":"Name des Arguments, das im Callback-Bereich verf\xfcgbar sein wird","callback":"R\xfcckruf zum abonnierten Thema. Es wird empfohlen, nur einen R\xfcckruf pro Thema und Seite durchzuf\xfchren.","domUpdated":"Listener f\xfcr das dom-update-Ereignis dieses Elements","id":"Der Wert wird als „id“-Attribut an das Element \xfcbergeben. Wenn nicht angegeben, wird die Standard-CMS-Element-ID verwendet"}},"asn":{"asn":{"label":"FACT-Finder\xae Web Components ff-asn element","config":{"callbackArg":"Name des Arguments, das im Callback-Bereich verf\xfcgbar sein wird","callback":"R\xfcckruf zum abonnierten Thema. Es wird empfohlen, nur einen R\xfcckruf pro Thema und Seite durchzuf\xfchren.","domUpdated":"Listener f\xfcr das dom-update-Ereignis dieses Elements.","id":"Der Wert wird als „id“-Attribut an das Element \xfcbergeben. Wenn nicht angegeben, wird die Standard-CMS-Element-ID verwendet","topic":"Wenn Sie dieses Feld leer lassen, abonniert das Element sein Standardthema (ASN).","vertical":"Durch die Einstellung „true“ wird die zus\xe4tzliche CSS-Klasse „btn-block“ zu „ff-asn-group“ und „
t.parts.length&&(i.parts.length=t.parts.length)}else{for(var o=[],s=0;s\n \n
\n \n \n
\n \n
\n{% endblock %}\n'});let{Component:n}=Shopware;n.register("sw-cms-block-listing-preview",{template:'{% block cms_block_commerce_factfinder_listing_preview %}\n
\n FACT-Finder Search Result\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsBlock({name:"listing",label:"sw-cms.blocks.commerce.factfinderWebComponentsListing.label",category:"commerce",component:"sw-cms-block-listing",previewComponent:"sw-cms-block-listing-preview",slots:{toolbarFilters:"asn",toolbarPaging:"paging",toolbarSorting:"sortbox",records:"record-list"}});let{Component:i}=Shopware;i.register("sw-cms-block-campaigns",{template:'{% block cms_block_commerce_factfinder_campaigns %}\n
\n \n
\n{% endblock %}\n'});let{Component:s}=Shopware;s.register("sw-cms-block-campaigns-preview",{template:'{% block cms_block_commerce_factfinder_campaigns_preview %}\n
\n FACT-Finder Campaigns\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsBlock({name:"campaigns",label:"sw-cms.blocks.commerce.factfinderWebComponentsCampaigns.label",category:"commerce",component:"sw-cms-block-campaigns",previewComponent:"sw-cms-block-campaigns-preview",slots:{campaigns:"campaigns"}});let{Component:a}=Shopware;a.register("sw-cms-block-filters",{template:'{% block cms_block_commerce_factfinder_filters %}\n
\n \n
\n{% endblock %}\n'});let{Component:o}=Shopware;o.register("sw-cms-block-filters-preview",{template:'{% block cms_block_commerce_factfinder_filters_preview %}\n
\n FACT-Finder Filters\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsBlock({name:"filters",label:"sw-cms.blocks.commerce.factfinderWebComponentsFilters.label",category:"commerce",component:"sw-cms-block-filters",previewComponent:"sw-cms-block-filters-preview",defaultConfig:{cssClass:"cms-block-sidebar-filter"},slots:{filters:"asn"}}),Shopware.Component.register("sw-cms-el-record-list",{template:'{% block sw_cms_element_record_list %}\n
\n
FF-RECORD-LIST
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("record-list")}}}),Shopware.Component.register("sw-cms-el-config-record-list",{template:'{% block sw_cms_element_record_list_config %}\n
\n \n\n \n\n \n \n\n \n \n\n \n \n\n \n \n\n \n \n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("record-list")}}}),Shopware.Component.register("sw-cms-el-preview-record-list",{template:'{% block sw_cms_element_record_list_preview %}\n
\n FF-RECORD-LIST\n
\n{% endblock %}\n'}),Shopware.Service("cmsService").registerCmsElement({name:"record-list",label:"sw-cms.elements.recordList.label",component:"sw-cms-el-record-list",configComponent:"sw-cms-el-config-record-list",previewComponent:"sw-cms-el-preview-record-list",defaultConfig:{subscribe:{value:!0,source:"static"},infiniteScrolling:{value:!1,source:"static"},restoreScrollPosition:{value:!1,source:"static"},infiniteDebounceDelay:{value:"32",source:"static"},infiniteScrollMargin:{value:0,source:"static"},callbackArg:{value:"records",source:"static"},callback:{value:"",source:"static"},id:{value:"",source:"static"},domUpdated:{value:"",source:"static"}}}),Shopware.Component.register("sw-cms-el-asn",{template:'{% block sw_cms_element_asn %}\n
\n
FF-ASN
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("asn")}}}),t(914),Shopware.Component.register("sw-cms-el-config-asn",{template:'{% block sw_cms_element_asn_config %}\n
\n \n\n \n \n\n \n \n\n \n \n\n \n \n \n \n \n \n\n \n

Filter Cloud

\n \n\n \n \n \n\n \n \n\n \n \n \n \n \n \n
\n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("asn")}}}),Shopware.Component.register("sw-cms-el-preview-asn",{template:'{% block sw_cms_preview_element_asn %}\n
\n FF-ASN\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsElement({name:"asn",label:"sw-cms.elements.asn.label",component:"sw-cms-el-asn",configComponent:"sw-cms-el-config-asn",previewComponent:"sw-cms-el-preview-asn",defaultConfig:{subscribe:{value:!0,source:"static"},vertical:{value:!1,source:"static"},topic:{value:"asn",source:"static"},callbackArg:{value:"groups",source:"static"},callback:{value:"",source:"static"},id:{value:"",source:"static"},domUpdated:{value:"",source:"static"},filterCloud:{value:!0,source:"static"},filterCloudBlacklist:{value:"",source:"static"},filterCloudWhitelist:{value:"",source:"static"},filterCloudOrder:{value:"fact-finder",source:"static"}}}),Shopware.Component.register("sw-cms-el-sortbox",{template:'{% block sw_cms_element_sortbox %}\n
\n
FF-SORTBOX
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("sortbox")}}}),Shopware.Component.register("sw-cms-el-config-sortbox",{template:'{% block sw_cms_element_sortbox_config %}\n
\n \n \n \n \n \n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("sortbox")}}}),Shopware.Component.register("sw-cms-el-preview-sortbox",{template:'{% block sw_cms_element_sortbox_preview %}\n
\n FF-SORTBOX\n
\n{% endblock %}\n'}),Shopware.Service("cmsService").registerCmsElement({name:"sortbox",label:"sw-cms.elements.sortbox.label",component:"sw-cms-el-sortbox",configComponent:"sw-cms-el-config-sortbox",previewComponent:"sw-cms-el-preview-sortbox",defaultConfig:{subscribe:{value:!0,source:"static"},opened:{value:!0,source:"static"},showSelected:{value:!1,source:"static"},showSelectedFirst:{value:!1,source:"static"},collapseOnblur:{value:!1,source:"static"}}}),Shopware.Component.register("sw-cms-el-paging",{template:'{% block sw_cms_element_paging %}\n
\n
FF-PAGING
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("paging")}}}),Shopware.Component.register("sw-cms-el-config-paging",{template:'{% block sw_cms_element_paging_config %}\n
\n \n \n \n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("paging")}}}),Shopware.Component.register("sw-cms-el-preview-paging",{template:'{% block sw_cms_element_paging_preview %}\n
\n FF-PAGING\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsElement({name:"paging",label:"sw-cms.elements.paging.label",component:"sw-cms-el-paging",configComponent:"sw-cms-el-config-paging",previewComponent:"sw-cms-el-preview-paging",defaultConfig:{subscribe:{value:!0,source:"static"},showOnly:{value:!1,source:"static"}}}),Shopware.Component.register("sw-cms-el-campaigns",{template:'{% block sw_cms_element_campaigns %}\n
\n
CAMPAIGNS
\n
\n{% endblock %}\n\n',mixins:["cms-element"],created(){this.createdComponent()},methods:{createdComponent(){this.initElementConfig("campaigns")}}}),Shopware.Component.register("sw-cms-el-config-campaigns",{template:'{% block sw_cms_element_campaigns_config %}\n
\n\n \n \n\n \n \n \n \n\n \n \n\n \n \n \n\n \n \n \n \n\n \n \n\n\n \n \n \n \n \n \n \n \n \n
\n{% endblock %}\n',mixins:["cms-element"],created(){this.createdComponent()},data(){return{campaignFlags:["None","is-product-campaign","is-landing-page-campaign"]}},methods:{createdComponent(){this.initElementConfig("campaigns")}}}),Shopware.Component.register("sw-cms-el-preview-campaigns",{template:'{% block sw_cms_element_campaigns_preview %}\n
\n CAMPAIGNS\n
\n{% endblock %}\n\n'}),Shopware.Service("cmsService").registerCmsElement({name:"campaigns",label:"sw-cms.elements.campaigns.label",component:"sw-cms-el-campaigns",configComponent:"sw-cms-el-config-campaigns",previewComponent:"sw-cms-el-preview-campaigns",defaultConfig:{advisorCampaignName:{value:"",source:"static"},feedbackCampaignLabel:{value:"",source:"static"},feedbackCampaignFlag:{value:"",source:"static"},enableFeedbackCampaign:{value:!1,source:"static"},enableAdvisorCampaign:{value:!1,source:"static"},enableRedirectCampaign:{value:!1,source:"static"},enablePushedProducts:{value:!1,source:"static"},pushedProductsFlag:{value:"",source:"static"},pushedProductsName:{value:"",source:"static"}}}),t(796),t(635);let{Component:l,Mixin:c}=Shopware;l.register("ui-feed-export-form",{template:'{% block factfinder_module_ui_feed_export %}\n \n\n \n \n \n \n\n \n \n\n \n \n \n\n \n \n\n {{ $tc(\'ui-feed-export.component.export_form.button.title\') }}\n \n \n \n{% endblock %}\n',inject:["systemConfigApiService"],data(){return{salesChannelValue:null,salesChannelLanguageValue:null,exportTypeValue:null,typeSelectOptions:[],isCacheDisable:!1,isLoadingCache:!1,isLoadingExport:!1}},mixins:[c.getByName("notification")],mounted(){this.getPluginConfig(),this.getExportTypeValues()},filters:{capitalize:function(e){return e?(e=e.toString()).charAt(0).toUpperCase()+e.slice(1):""}},methods:{async getPluginConfig(){let e=await this.systemConfigApiService.getValues("OmikronFactFinder.config");this.isCacheDisable=e["OmikronFactFinder.config.enableExportCache"]},getExportTypeValues(){let e=Shopware.Service("syncService").httpClient,n={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};e.get("_action/fact-finder/get-export-type-options",{headers:n}).then(e=>{200===e.status&&(this.typeSelectOptions=e.data)})},successFeedGenerationWindow(){this.createNotificationSuccess({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.alert_success.text")})},errorFeedGenerationWindow(){this.createNotificationError({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.alert_error.text")})},errorNotValidParams(){this.createNotificationError({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.alert_not_valid_params.text")})},successRefreshCacheWindow(){this.createNotificationSuccess({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.refresh_cache_success.text")})},errorRefreshCacheWindow(){this.createNotificationError({message:Shopware.Snippet.tc("ui-feed-export.component.export_form.refresh_cache_error.text")})},validateParams(e){return null!==e.salesChannelValue&&null!==e.salesChannelLanguageValue&&null!==e.exportTypeValue},getFeedExportFile(e){let n={salesChannelValue:this.salesChannelValue,salesChannelLanguageValue:this.salesChannelLanguageValue,exportTypeValue:this.exportTypeValue};if(!this.validateParams(n)){this.errorNotValidParams();return}this.isLoadingExport=!0;let t=Shopware.Service("syncService").httpClient,i={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};t.get(e,{headers:i,params:n}).then(e=>{200===e.status?this.successFeedGenerationWindow():this.errorFeedGenerationWindow(),this.isLoadingExport=!1})},refreshExportCache(e){this.isLoadingCache=!0;let n=Shopware.Service("syncService").httpClient,t={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"},i={salesChannelValue:this.salesChannelValue,salesChannelLanguageValue:this.salesChannelLanguageValue};n.get(e,{headers:t,params:i}).then(e=>{200===e.status?this.successRefreshCacheWindow():this.errorRefreshCacheWindow(),this.isLoadingCache=!1})}}});let{Component:r}=Shopware;r.register("ui-feed-export-index",{template:'{% block factfinder_ui_feed_export_index %}\n \n \n \n{% endblock %}\n',metaInfo(){return{title:this.$createTitle()}}});var d=JSON.parse('{"ui-feed-export":{"title":"FACT-Finder\xae Feed-Export","component":{"export_form":{"sales_channel":{"label":"Verkaufskanal"},"sales_channel_language":{"label":"Sprache"},"button":{"title":"Export erstellen"},"cache_button":{"title":"Cache-Export aktualisieren"},"alert_success":{"text":"Der Export wurde generiert"},"alert_error":{"text":"W\xe4hrend des Integrationsprozesses ist ein Fehler aufgetreten"},"export_type":{"label":"W\xe4hlen Sie den Exporttyp aus"},"alert_not_valid_params":{"text":"Bitte w\xe4hlen Sie Exportparameter aus"},"refresh_cache_success":{"text":"Der Export-Cache wurde aktualisiert"},"refresh_cache_error":{"text":"Beim Aktualisieren des Exportcaches ist ein Fehler aufgetreten"}}}}}'),p=JSON.parse('{"ui-feed-export":{"title":"FACT-Finder\xae Feed Export","component":{"export_form":{"sales_channel":{"label":"Sales Channel"},"sales_channel_language":{"label":"Language"},"button":{"title":"Create Export"},"cache_button":{"title":"Refresh cache Export"},"alert_success":{"text":"Export has been generated"},"alert_error":{"text":"An error occurred during integration process"},"export_type":{"label":"Select export type"},"alert_not_valid_params":{"text":"Please choose export parameters"},"refresh_cache_success":{"text":"Export cache has been refreshed"},"refresh_cache_error":{"text":"An error occurred during refresh export cache"}}}}}');let{Module:m}=Shopware;m.register("ui-feed-export",{color:"#ff3d58",icon:"default-shopping-paper-bag-product",title:"ui-feed-export.title",description:"",snippets:{"de-DE":d,"en-GB":p},routes:{index:{component:"ui-feed-export-index",path:"index"}},navigation:[{label:"ui-feed-export.title",path:"ui.feed.export.index",position:100,parent:"sw-extension"}]});let{Component:u,Mixin:f}=Shopware;u.register("update-field-roles",{template:'\n {{ $tc(\'configuration.updateFieldRoles.update\') }}\n\n',inject:["fieldRolesService"],mixins:[f.getByName("notification"),f.getByName("sw-inline-snippet")],data(){return{isLoading:!1,isSaveSuccessful:!1}},methods:{async onClick(){this.isLoading=!0,await this.fieldRolesService.sendUpdateFieldRoles(),this.isSaveSuccessful=!0,this.isLoading=!1,this.createNotificationSuccess({message:Shopware.Snippet.tc("configuration.updateFieldRoles.update")})}}}),t(673);let{Component:g,Mixin:h}=Shopware;g.register("test-api-connection",{template:'\n {{ $tc(\'configuration.testApiConnection.testConnection\') }}\n\n',mixins:[h.getByName("notification"),h.getByName("sw-inline-snippet")],data(){return{isLoading:!1,isSaveSuccessful:!1}},methods:{async onClick(){this.isLoading=!0;let e=Shopware.Service("syncService").httpClient,n={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};e.get("_action/test-connection/api",{headers:n}).then(e=>{200===e.status?this.createNotificationSuccess({message:Shopware.Snippet.tc("configuration.testConnection.success")}):this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).catch(()=>{this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).finally(()=>{this.isSaveSuccessful=!0,this.isLoading=!1})}}}),t(802);let{Component:v,Mixin:w}=Shopware;v.register("test-ftp-connection",{template:'\n {{ $tc(\'configuration.testFtpConnection.testConnection\') }}\n\n',mixins:[w.getByName("notification"),w.getByName("sw-inline-snippet")],data(){return{isLoading:!1,isSaveSuccessful:!1}},methods:{async onClick(){this.isLoading=!0;let e=Shopware.Service("syncService").httpClient,n={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};e.get("_action/test-connection/ftp",{headers:n}).then(e=>{200===e.status?this.createNotificationSuccess({message:Shopware.Snippet.tc("configuration.testConnection.success")}):this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).catch(()=>{this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).finally(()=>{this.isSaveSuccessful=!0,this.isLoading=!1})}}});let{Component:b,Mixin:C}=Shopware;b.register("test-push-import-connection",{template:'\n {{ $tc(\'configuration.testApiConnection.testConnection\') }}\n\n',mixins:[C.getByName("notification"),C.getByName("sw-inline-snippet")],data(){return{isLoading:!1,isSaveSuccessful:!1}},methods:{async onClick(){this.isLoading=!0;let e=Shopware.Service("syncService").httpClient,n={Authorization:`Bearer ${Shopware.Context.api.authToken.access}`,"Content-Type":"application/json"};e.get("_action/test-connection/push-import",{headers:n}).then(e=>{200===e.status?this.createNotificationSuccess({message:Shopware.Snippet.tc("configuration.testConnection.success")}):this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).catch(()=>{this.createNotificationError({title:Shopware.Snippet.tc("configuration.testConnection.fail"),message:Shopware.Snippet.tc("configuration.testConnection.helpText")})}).finally(()=>{this.isSaveSuccessful=!0,this.isLoading=!1})}}});let S=Shopware.Classes.ApiService;var x=class extends S{constructor(e,n){super(e,n,null,"application/json"),this.name="fieldRolesServiceApi"}sendUpdateFieldRoles(){let e=this.getBasicHeaders();return this.httpClient.get("_action/field-roles/update",{headers:e}).then(e=>S.handleResponse(e))}};Shopware.Service().register("fieldRolesService",()=>new x(Shopware.Application.getContainer("init").httpClient,Shopware.Service("loginService")));var _=JSON.parse('{"sw-cms":{"blocks":{"commerce":{"factfinderWebComponentsListing":{"label":"Typische Sammlung von Webkomponenten, die eine Suchergebnisseite implementiert"},"factfinderWebComponentsCampaigns":{"label":"FACT-Finder\xae Web Components Kampagnen"},"factfinderWebComponentsFilters":{"label":"FACT-Finder\xae Web Components Filter"},"factfinderWebComponentsRecordList":{"label":"FACT-Finder\xae Web Components Rekordliste"}}},"elements":{"recordList":{"label":"FACT-Finder\xae Web Components ff-record-list element","config":{"callbackArg":"Name des Arguments, das im Callback-Bereich verf\xfcgbar sein wird","callback":"R\xfcckruf zum abonnierten Thema. Es wird empfohlen, nur einen R\xfcckruf pro Thema und Seite durchzuf\xfchren.","domUpdated":"Listener f\xfcr das dom-update-Ereignis dieses Elements","id":"Der Wert wird als „id“-Attribut an das Element \xfcbergeben. Wenn nicht angegeben, wird die Standard-CMS-Element-ID verwendet"}},"asn":{"asn":{"label":"FACT-Finder\xae Web Components ff-asn element","config":{"callbackArg":"Name des Arguments, das im Callback-Bereich verf\xfcgbar sein wird","callback":"R\xfcckruf zum abonnierten Thema. Es wird empfohlen, nur einen R\xfcckruf pro Thema und Seite durchzuf\xfchren.","domUpdated":"Listener f\xfcr das dom-update-Ereignis dieses Elements.","id":"Der Wert wird als „id“-Attribut an das Element \xfcbergeben. Wenn nicht angegeben, wird die Standard-CMS-Element-ID verwendet","topic":"Wenn Sie dieses Feld leer lassen, abonniert das Element sein Standardthema (ASN).","vertical":"Durch die Einstellung „true“ wird die zus\xe4tzliche CSS-Klasse „btn-block“ zu „ff-asn-group“ und „
channelService = $channelService; $this->currencyFormatter = $currencyFormatter; $this->context = $this->channelService->getSalesChannelContext(); - $this->fieldRoles = $fieldRolesService->getRoles($this->context->getSalesChannelId()); + $this->fieldRolesService = $fieldRolesService; $this->defaultFieldRoles = $fieldRoles; } @@ -71,7 +71,9 @@ private function getFormattedPrice(float $price): string private function getPriceField(): string { - return $this->fieldRoles['price'] ?? $this->defaultFieldRoles['price'] ?? 'Price'; + $fieldRoles = $this->fieldRolesService->getRoles($this->context->getSalesChannelId()); + + return $fieldRoles['price'] ?? $this->defaultFieldRoles['price'] ?? 'Price'; } private function convertRecord(array $record): array