diff --git a/src/Resources/app/storefront/package-lock.json b/src/Resources/app/storefront/package-lock.json index 22b7386..767aa5d 100644 --- a/src/Resources/app/storefront/package-lock.json +++ b/src/Resources/app/storefront/package-lock.json @@ -1,40 +1,40 @@ { - "name": "storefront", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "devDependencies": { - "@friendsofshopware/storefront-types": "^0.1.1" - } - }, - "node_modules/@friendsofshopware/storefront-types": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/@friendsofshopware/storefront-types/-/storefront-types-0.1.7.tgz", - "integrity": "sha512-Z2r5jUFvBle4eSKiuaQVxr0IfD4mg8V6/ULW4y15AyCzKCYP2YED3bKqvi4Za7sGRZN7SBNyH28YfOtIoa5X4g==", - "dev": true, - "dependencies": { - "@types/bootstrap": "^5.2.0" - } - }, - "node_modules/@popperjs/core": { - "version": "2.11.8", - "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", - "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", - "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/popperjs" - } - }, - "node_modules/@types/bootstrap": { - "version": "5.2.10", - "resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.2.10.tgz", - "integrity": "sha512-F2X+cd6551tep0MvVZ6nM8v7XgGN/twpdNDjqS1TUM7YFNEtQYWk+dKAnH+T1gr6QgCoGMPl487xw/9hXooa2g==", - "dev": true, - "dependencies": { - "@popperjs/core": "^2.9.2" - } + "name": "storefront", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@friendsofshopware/storefront-types": "^0.1.1" + } + }, + "node_modules/@friendsofshopware/storefront-types": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/@friendsofshopware/storefront-types/-/storefront-types-0.1.7.tgz", + "integrity": "sha512-Z2r5jUFvBle4eSKiuaQVxr0IfD4mg8V6/ULW4y15AyCzKCYP2YED3bKqvi4Za7sGRZN7SBNyH28YfOtIoa5X4g==", + "dev": true, + "dependencies": { + "@types/bootstrap": "^5.2.0" + } + }, + "node_modules/@popperjs/core": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", + "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } + }, + "node_modules/@types/bootstrap": { + "version": "5.2.10", + "resolved": "https://registry.npmjs.org/@types/bootstrap/-/bootstrap-5.2.10.tgz", + "integrity": "sha512-F2X+cd6551tep0MvVZ6nM8v7XgGN/twpdNDjqS1TUM7YFNEtQYWk+dKAnH+T1gr6QgCoGMPl487xw/9hXooa2g==", + "dev": true, + "dependencies": { + "@popperjs/core": "^2.9.2" + } + } } - } } diff --git a/src/Resources/public/administration/.vite/entrypoints.json b/src/Resources/public/administration/.vite/entrypoints.json new file mode 100644 index 0000000..228f30f --- /dev/null +++ b/src/Resources/public/administration/.vite/entrypoints.json @@ -0,0 +1,25 @@ +{ + "base": "/bundles/froshproductcompare/administration/", + "entryPoints": { + "frosh-product-compare": { + "css": [ + "/bundles/froshproductcompare/administration/assets/frosh-product-compare-o8J2jA-S.css" + ], + "dynamic": [], + "js": [ + "/bundles/froshproductcompare/administration/assets/frosh-product-compare-DUYyGMfe.js" + ], + "legacy": false, + "preload": [] + } + }, + "legacy": false, + "metadatas": {}, + "version": [ + "7.1.0", + 7, + 1, + 0 + ], + "viteServer": null +} \ No newline at end of file diff --git a/src/Resources/public/administration/.vite/manifest.json b/src/Resources/public/administration/.vite/manifest.json new file mode 100644 index 0000000..b458d99 --- /dev/null +++ b/src/Resources/public/administration/.vite/manifest.json @@ -0,0 +1,11 @@ +{ + "main.js": { + "file": "assets/frosh-product-compare-DUYyGMfe.js", + "name": "frosh-product-compare", + "src": "main.js", + "isEntry": true, + "css": [ + "assets/frosh-product-compare-o8J2jA-S.css" + ] + } +} \ No newline at end of file diff --git a/src/Resources/public/administration/assets/frosh-product-compare-DUYyGMfe.js b/src/Resources/public/administration/assets/frosh-product-compare-DUYyGMfe.js new file mode 100644 index 0000000..a6fde3b --- /dev/null +++ b/src/Resources/public/administration/assets/frosh-product-compare-DUYyGMfe.js @@ -0,0 +1,2 @@ +const i=`{% block sw_prduct_cross_selling_form_active_field %} {% parent() %} {% endblock %} {% block sw_prduct_cross_selling_form_limit_field %} {% endblock %}`;const{Component:l,Utils:o}=Shopware;l.override("sw-product-cross-selling-form",{template:i,data(){return{originalLimit:this.crossSelling.limit}},watch:{"crossSelling.extensions.crossSellingComparable.isComparable":{deep:!0,immediate:!0,handler(s){this.crossSelling.limit=s?4:this.originalLimit}}},created(){let s=o.get(this.crossSelling,"extensions.crossSellingComparable",null);s||(s=this.repositoryFactory.create("frosh_cross_selling_comparable").create(Shopware.Context.api),s.isComparable=!1,this.crossSelling.extensions.crossSellingComparable=s),o.get(this.crossSelling,"extensions.crossSellingComparable.isComparable",!1)&&(this.crossSelling.limit=4)},computed:{allowEditLimit(){return this.crossSelling.extensions.crossSellingComparable.isComparable||!this.allowEdit}}});const{Component:r}=Shopware;r.override("sw-product-detail-cross-selling",{methods:{onAddCrossSelling(){const s=this.repositoryFactory.create(this.product.crossSellings.entity,this.product.crossSellings.source);this.crossSelling=s.create(Shopware.Context.api);const e=this.repositoryFactory.create("frosh_cross_selling_comparable").create(Shopware.Context.api);e.isComparable=!1,this.crossSelling.productId=this.product.id,this.crossSelling.position=this.product.crossSellings.length+1,this.crossSelling.type="productStream",this.crossSelling.sortBy="name",this.crossSelling.sortDirection="ASC",this.crossSelling.limit=24,this.crossSelling.extensions.crossSellingComparable=e,this.product.crossSellings.push(this.crossSelling)}}});const{Component:t}=Shopware;t.override("sw-product-detail",{computed:{productCriteria(){const s=this.$super("productCriteria");return s.addAssociation("crossSellings.crossSellingComparable"),s}}}); +//# sourceMappingURL=frosh-product-compare-DUYyGMfe.js.map diff --git a/src/Resources/public/administration/assets/frosh-product-compare-DUYyGMfe.js.map b/src/Resources/public/administration/assets/frosh-product-compare-DUYyGMfe.js.map new file mode 100644 index 0000000..6398b8d --- /dev/null +++ b/src/Resources/public/administration/assets/frosh-product-compare-DUYyGMfe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"frosh-product-compare-DUYyGMfe.js","sources":["../../../app/administration/src/extension/sw-product/component/sw-product-cross-selling-form/sw-product-cross-selling-form.html.twig","../../../app/administration/src/extension/sw-product/component/sw-product-cross-selling-form/index.js","../../../app/administration/src/extension/sw-product/view/sw-product-detail-cross-selling/index.js","../../../app/administration/src/extension/sw-product/page/sw-product-detail/index.js"],"sourcesContent":["{% block sw_prduct_cross_selling_form_active_field %}\n{% parent() %}\n\n\n \n{% endblock %}\n\n{% block sw_prduct_cross_selling_form_limit_field %}\n\n \n{% endblock %}","import template from './sw-product-cross-selling-form.html.twig';\nimport './sw-product-cross-selling-form.scss';\nimport { MAXIMUM_COMPARE_PRODUCT_ITEMS } from '../../../../constant/frosh-product-compare.constant';\n\nconst { Component, Utils } = Shopware;\n\nComponent.override('sw-product-cross-selling-form', {\n template,\n\n data() {\n return {\n originalLimit: this.crossSelling.limit,\n };\n },\n\n watch: {\n 'crossSelling.extensions.crossSellingComparable.isComparable': {\n deep: true,\n immediate: true,\n handler(value) {\n this.crossSelling.limit = value\n ? MAXIMUM_COMPARE_PRODUCT_ITEMS\n : this.originalLimit;\n },\n },\n },\n\n created() {\n let crossSellingComparable = Utils.get(\n this.crossSelling,\n 'extensions.crossSellingComparable',\n null\n );\n\n if (!crossSellingComparable) {\n crossSellingComparable = this.repositoryFactory\n .create('frosh_cross_selling_comparable')\n .create(Shopware.Context.api);\n crossSellingComparable.isComparable = false;\n this.crossSelling.extensions.crossSellingComparable =\n crossSellingComparable;\n }\n\n if (\n Utils.get(\n this.crossSelling,\n 'extensions.crossSellingComparable.isComparable',\n false\n )\n ) {\n this.crossSelling.limit = MAXIMUM_COMPARE_PRODUCT_ITEMS;\n }\n },\n computed: {\n allowEditLimit() {\n return (\n this.crossSelling.extensions.crossSellingComparable\n .isComparable || !this.allowEdit\n );\n },\n },\n});\n","const { Component } = Shopware;\n\nComponent.override('sw-product-detail-cross-selling', {\n methods: {\n onAddCrossSelling() {\n const crossSellingRepository = this.repositoryFactory.create(\n this.product.crossSellings.entity,\n this.product.crossSellings.source\n );\n\n this.crossSelling = crossSellingRepository.create(\n Shopware.Context.api\n );\n const crossSellingComparableRepo = this.repositoryFactory.create(\n 'frosh_cross_selling_comparable'\n );\n\n const crossSellingComparable = crossSellingComparableRepo.create(\n Shopware.Context.api\n );\n crossSellingComparable.isComparable = false;\n\n this.crossSelling.productId = this.product.id;\n this.crossSelling.position = this.product.crossSellings.length + 1;\n this.crossSelling.type = 'productStream';\n this.crossSelling.sortBy = 'name';\n this.crossSelling.sortDirection = 'ASC';\n this.crossSelling.limit = 24;\n this.crossSelling.extensions.crossSellingComparable =\n crossSellingComparable;\n\n this.product.crossSellings.push(this.crossSelling);\n },\n },\n});\n","const { Component } = Shopware;\n\nComponent.override('sw-product-detail', {\n computed: {\n productCriteria() {\n const criteria = this.$super('productCriteria');\n\n criteria.addAssociation('crossSellings.crossSellingComparable');\n\n return criteria;\n },\n },\n});\n"],"names":["template","Component","Utils","value","crossSellingComparable","crossSellingRepository","criteria"],"mappings":"AAAA,MAAAA,EAAe,6iBCIf,KAAM,WAAEC,EAAW,MAAAC,CAAK,EAAK,SAE7BD,EAAU,SAAS,gCAAiC,CAChD,SAAAD,EAEA,MAAO,CACH,MAAO,CACH,cAAe,KAAK,aAAa,KAC7C,CACA,EAEI,MAAO,CACH,8DAA+D,CAC3D,KAAM,GACN,UAAW,GACX,QAAQG,EAAO,CACX,KAAK,aAAa,MAAQA,EACpB,EACA,KAAK,aAC3B,CACA,CACA,EAEI,SAAU,CACN,IAAIC,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.css b/src/Resources/public/administration/assets/frosh-product-compare-o8J2jA-S.css new file mode 100644 index 0000000..8321783 --- /dev/null +++ b/src/Resources/public/administration/assets/frosh-product-compare-o8J2jA-S.css @@ -0,0 +1 @@ +.product-detail-cross-selling-form__card-container>.sw-container{grid-template-columns:4.6fr 1fr 1fr!important} diff --git a/src/Resources/views/storefront/page/product-detail/buy-widget.html.twig b/src/Resources/views/storefront/component/buy-widget/buy-widget.html.twig similarity index 55% rename from src/Resources/views/storefront/page/product-detail/buy-widget.html.twig rename to src/Resources/views/storefront/component/buy-widget/buy-widget.html.twig index ef9533e..b1106f7 100644 --- a/src/Resources/views/storefront/page/product-detail/buy-widget.html.twig +++ b/src/Resources/views/storefront/component/buy-widget/buy-widget.html.twig @@ -1,15 +1,13 @@ -{% sw_extends '@Storefront/storefront/page/product-detail/buy-widget.html.twig' %} +{% sw_extends '@Storefront/storefront/component/buy-widget/buy-widget.html.twig' %} -{% block page_product_detail_buy_container %} +{% block buy_widget_buy_container %} {{ parent() }} {% if config('FroshProductCompare.config.active') %} {% block page_product_detail_add_to_compare_button %}
{% sw_include '@Storefront/storefront/component/product/card/compare-button.html.twig' with { - navigationTree: page.header.navigation.tree, - categoryTree: page.product.categoryTree|last, - product: page.product + product: product } only %}
{% endblock %} diff --git a/src/Resources/views/storefront/component/product/card/action.html.twig b/src/Resources/views/storefront/component/product/card/action.html.twig index 95342ba..9a2b12b 100644 --- a/src/Resources/views/storefront/component/product/card/action.html.twig +++ b/src/Resources/views/storefront/component/product/card/action.html.twig @@ -1,21 +1,11 @@ {% sw_extends '@Storefront/storefront/component/product/card/action.html.twig' %} -{% block component_product_box_action_buy %} +{% block component_product_box_action_buttons %} {{ parent() }} {% if config('FroshProductCompare.config.active') and activeRoute != 'frontend.compare.content' %} {% block component_product_box_action_add_to_compare_button %} {% sw_include '@Storefront/storefront/component/product/card/compare-button.html.twig' %} {% endblock %} - {% endif %} -{% endblock %} - -{% block component_product_box_action_detail %} - {{ parent() }} - - {% if config('FroshProductCompare.config.active') and activeRoute != 'frontend.compare.content' %} - {% block component_product_box_action_detail_add_to_compare_button %} - {% sw_include '@Storefront/storefront/component/product/card/compare-button.html.twig' %} - {% endblock %} {% endif %} {% endblock %} diff --git a/src/Resources/views/storefront/page/product-detail/cross-selling/tabs.html.twig b/src/Resources/views/storefront/page/product-detail/cross-selling/tabs.html.twig deleted file mode 100644 index daf455e..0000000 --- a/src/Resources/views/storefront/page/product-detail/cross-selling/tabs.html.twig +++ /dev/null @@ -1,72 +0,0 @@ -{% sw_extends '@Storefront/storefront/page/product-detail/cross-selling/tabs.html.twig' %} - -{% block page_product_detail_cross_selling_tabs_content_container %} -
- {% for item in crossSellings|filter(item => item.total > 0 and item.crossSelling.active == true) %} - {% set id = item.crossSelling.id %} - {% set crossSellingComparable = item.crossSelling.extensions.crossSellingComparable %} - {% if crossSellingComparable and crossSellingComparable.isComparable %} - {% set page = { - products: item.getProducts(), - properties: item.crossSelling.extensions.compareProperties - } %} -
- - {% sw_include '@Storefront/storefront/component/compare/content.html.twig' with { - page: page - } %} -
- {% else %} -
- {% set config = { - 'title': { - 'value': item.crossSelling.name ?: item.crossSelling.translated.name - }, - 'border': { - 'value': false - }, - 'rotate': { - 'value': false - }, - 'products': { - 'value': item.getProducts() - }, - 'boxLayout': { - 'value': 'standard' - }, - 'elMinWidth': { - 'value': '300px' - }, - 'navigation': { - 'value': true - }, - 'displayMode': { - 'value': 'minimal' - }, - 'verticalAlign': { - 'value': 'top' - }, - } %} - - {% sw_include "@Storefront/storefront/element/cms-element-product-slider.html.twig" with { - sliderConfig: config, - element: { - 'data': { - 'products': { - elements: item.getProducts() - } - }, - type: 'product-slider' - } - } %} -
- {% endif %} - {% endfor %} -
-{% endblock %}