switched to new commerce product type with mutliple variation types

This commit is contained in:
Bachir Soussi Chiadmi 2022-03-15 14:55:21 +01:00
parent f10cfd76f4
commit 9d6f19eeaf
11 changed files with 206 additions and 20 deletions

View File

@ -0,0 +1,44 @@
uuid: ab56fa3c-d61f-4654-85a2-a8573936df9f
langcode: en
status: true
dependencies:
config:
- commerce_product.commerce_product_variation_type.materio_product_licence_variatio
- core.entity_view_mode.commerce_product_variation.add_to_cart
- field.field.commerce_product_variation.materio_product_licence_variatio.field_description
- field.field.commerce_product_variation.materio_product_licence_variatio.license_expiration
- field.field.commerce_product_variation.materio_product_licence_variatio.license_type
module:
- commerce_variation_cart_form
- text
third_party_settings:
commerce_variation_cart_form:
combine: false
id: commerce_product_variation.materio_product_licence_variatio.add_to_cart
targetEntityType: commerce_product_variation
bundle: materio_product_licence_variatio
mode: add_to_cart
content:
commerce_variation_cart_form:
settings: { }
third_party_settings: { }
weight: 1
region: content
field_description:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 0
region: content
hidden:
langcode: true
license_expiration: true
license_type: true
list_price: true
price: true
product_id: true
search_api_excerpt: true
sku: true
synonyms: true
title: true

View File

@ -9,44 +9,51 @@ dependencies:
- field.field.commerce_product_variation.materio_product_licence_variatio.license_type
module:
- commerce_price
- commerce_variation_cart_form
- text
third_party_settings:
commerce_variation_cart_form:
combine: true
id: commerce_product_variation.materio_product_licence_variatio.default
targetEntityType: commerce_product_variation
bundle: materio_product_licence_variatio
mode: default
content:
commerce_variation_cart_form:
settings: { }
third_party_settings: { }
weight: 3
region: content
field_description:
type: text_default
label: above
label: hidden
settings: { }
third_party_settings: { }
weight: 1
region: content
list_price:
price:
type: commerce_price_default
label: above
label: hidden
settings:
strip_trailing_zeroes: false
currency_display: symbol
third_party_settings: { }
weight: -1
weight: 2
region: content
price:
type: commerce_price_default
label: above
title:
type: string
label: hidden
settings:
strip_trailing_zeroes: false
currency_display: symbol
link_to_entity: false
third_party_settings: { }
weight: 0
region: content
hidden:
commerce_variation_cart_form: true
langcode: true
license_expiration: true
license_type: true
list_price: true
product_id: true
search_api_excerpt: true
sku: true
synonyms: true
title: true

View File

@ -0,0 +1,51 @@
uuid: c6ddd2e5-87c0-438b-a7a7-369a443addb5
langcode: en
status: true
dependencies:
config:
- commerce_product.commerce_product_variation_type.materio_product_licence_variatio
- core.entity_view_mode.commerce_product_variation.order_summary
- field.field.commerce_product_variation.materio_product_licence_variatio.field_description
- field.field.commerce_product_variation.materio_product_licence_variatio.license_expiration
- field.field.commerce_product_variation.materio_product_licence_variatio.license_type
module:
- text
id: commerce_product_variation.materio_product_licence_variatio.order_summary
targetEntityType: commerce_product_variation
bundle: materio_product_licence_variatio
mode: order_summary
content:
field_description:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 2
region: content
product_id:
type: entity_reference_entity_view
label: hidden
settings:
view_mode: order_summary
link: false
third_party_settings: { }
weight: 0
region: content
title:
type: string
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
weight: 1
region: content
hidden:
commerce_variation_cart_form: true
langcode: true
license_expiration: true
license_type: true
list_price: true
price: true
search_api_excerpt: true
sku: true
synonyms: true

View File

@ -0,0 +1,52 @@
uuid: 64366592-bee7-4ed3-ae6a-4b3982d7ccd3
langcode: en
status: true
dependencies:
config:
- commerce_product.commerce_product_variation_type.materio_product_licence_variatio
- core.entity_view_mode.commerce_product_variation.summary
- field.field.commerce_product_variation.materio_product_licence_variatio.field_description
- field.field.commerce_product_variation.materio_product_licence_variatio.license_expiration
- field.field.commerce_product_variation.materio_product_licence_variatio.license_type
module:
- commerce_price
id: commerce_product_variation.materio_product_licence_variatio.summary
targetEntityType: commerce_product_variation
bundle: materio_product_licence_variatio
mode: summary
content:
price:
type: commerce_price_default
label: hidden
settings:
strip_trailing_zeroes: false
currency_display: symbol
third_party_settings: { }
weight: 2
region: content
product_id:
type: entity_reference_label
label: hidden
settings:
link: false
third_party_settings: { }
weight: 0
region: content
title:
type: string
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
weight: 1
region: content
hidden:
commerce_variation_cart_form: true
field_description: true
langcode: true
license_expiration: true
license_type: true
list_price: true
search_api_excerpt: true
sku: true
synonyms: true

View File

@ -3,7 +3,7 @@ langcode: en
status: true
dependencies:
config:
- commerce_product.commerce_product_type.materio_product_type
- commerce_product.commerce_product_type.materio_product_license_type
- field.storage.commerce_product.body
- system.menu.header
module:
@ -405,14 +405,45 @@ display:
id: type
table: commerce_product_field_data
field: type
relationship: none
group_type: group
admin_label: ''
entity_type: commerce_product
entity_field: type
plugin_id: commerce_entity_bundle
operator: in
value:
materio_product_type: materio_product_type
materio_product_license_type: materio_product_license_type
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
operator_limit_selection: false
operator_list: { }
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
reduce: false
hide_single_bundle: true
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
langcode:
id: langcode
table: commerce_product_field_data

View File

@ -29,4 +29,4 @@
}
}
${n}
`;s.Z.post("",{query:(0,c.S)(a)}).then((t=>{e(r,{items:t.data.data.materiaux,callBackArgs:o})})).catch((e=>{console.warn("Issue with loadMaterials",e),Promise.reject(e)}))}}}})}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e].call(n.exports,n,n.exports,o),n.exports}o.m=i,e=[],o.O=(t,n,i,r)=>{if(!n){var a=1/0;for(l=0;l<e.length;l++){for(var[n,i,r]=e[l],s=!0,c=0;c<n.length;c++)(!1&r||a>=r)&&Object.keys(o.O).every((e=>o.O[e](n[c])))?n.splice(c--,1):(s=!1,r<a&&(a=r));s&&(e.splice(l--,1),t=i())}return t}r=r||0;for(var l=e.length;l>0&&e[l-1][2]>r;l--)e[l]=e[l-1];e[l]=[n,i,r]},o.F={},o.E=e=>{Object.keys(o.F).map((t=>{o.F[t](e)}))},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>({67:"module-blabla",204:"module-showrooms",282:"module-thematique",665:"module-pricing",694:"module-base",790:"module-article"}[e]+"."+{67:"d2a190261f0858b2929c",204:"f4e99dc6af9efd6ef724",282:"8b067b3da8f434cd4886",665:"f39149436228499ed25f",694:"7a080824c1dd865ba888",790:"86caee458383dab87430"}[e]+".bundle.js"),o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="materio.com:",o.l=(e,i,r,a)=>{if(t[e])t[e].push(i);else{var s,c;if(void 0!==r)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var d=l[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==n+r){s=d;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.setAttribute("data-webpack",n+r),s.src=e),t[e]=[i];var f=(n,i)=>{s.onerror=s.onload=null,clearTimeout(p);var r=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach((e=>e(i))),n)return n(i)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.bind(null,s.onload),c&&document.head.appendChild(s)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.p="/themes/custom/materiotheme/assets/dist/",(()=>{var e={179:0};o.f.j=(t,n)=>{var i=o.o(e,t)?e[t]:void 0;if(0!==i)if(i)n.push(i[2]);else{var r=new Promise(((n,r)=>i=e[t]=[n,r]));n.push(i[2]=r);var a=o.p+o.u(t),s=new Error;o.l(a,(n=>{if(o.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var r=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+r+": "+a+")",s.name="ChunkLoadError",s.type=r,s.request=a,i[1](s)}}),"chunk-"+t,t)}},o.F.j=t=>{if(!o.o(e,t)||void 0===e[t]){e[t]=null;var n=document.createElement("link");o.nc&&n.setAttribute("nonce",o.nc),n.rel="prefetch",n.as="script",n.href=o.p+o.u(t),document.head.appendChild(n)}},o.O.j=t=>0===e[t];var t=(t,n)=>{var i,r,[a,s,c]=n,l=0;for(i in s)o.o(s,i)&&(o.m[i]=s[i]);for(c&&c(o),t&&t(n);l<a.length;l++)r=a[l],o.o(e,r)&&e[r]&&e[r][0](),e[a[l]]=0;o.O()},n=self.webpackChunkmaterio_com=self.webpackChunkmaterio_com||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),o.O(0,[179],(()=>[694,282,67,790,204,665].map(o.E)),5);var a=o.O(void 0,[289],(()=>o(470)));a=o.O(a)})();
`;s.Z.post("",{query:(0,c.S)(a)}).then((t=>{e(r,{items:t.data.data.materiaux,callBackArgs:o})})).catch((e=>{console.warn("Issue with loadMaterials",e),Promise.reject(e)}))}}}})}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e].call(n.exports,n,n.exports,o),n.exports}o.m=i,e=[],o.O=(t,n,i,r)=>{if(!n){var a=1/0;for(l=0;l<e.length;l++){for(var[n,i,r]=e[l],s=!0,c=0;c<n.length;c++)(!1&r||a>=r)&&Object.keys(o.O).every((e=>o.O[e](n[c])))?n.splice(c--,1):(s=!1,r<a&&(a=r));s&&(e.splice(l--,1),t=i())}return t}r=r||0;for(var l=e.length;l>0&&e[l-1][2]>r;l--)e[l]=e[l-1];e[l]=[n,i,r]},o.F={},o.E=e=>{Object.keys(o.F).map((t=>{o.F[t](e)}))},o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>({67:"module-blabla",204:"module-showrooms",282:"module-thematique",665:"module-pricing",694:"module-base",790:"module-article"}[e]+"."+{67:"d2a190261f0858b2929c",204:"f4e99dc6af9efd6ef724",282:"8b067b3da8f434cd4886",665:"46c403a3723d5309dc4b",694:"7a080824c1dd865ba888",790:"86caee458383dab87430"}[e]+".bundle.js"),o.miniCssF=e=>{},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t={},n="materio.com:",o.l=(e,i,r,a)=>{if(t[e])t[e].push(i);else{var s,c;if(void 0!==r)for(var l=document.getElementsByTagName("script"),u=0;u<l.length;u++){var d=l[u];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==n+r){s=d;break}}s||(c=!0,(s=document.createElement("script")).charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.setAttribute("data-webpack",n+r),s.src=e),t[e]=[i];var f=(n,i)=>{s.onerror=s.onload=null,clearTimeout(p);var r=t[e];if(delete t[e],s.parentNode&&s.parentNode.removeChild(s),r&&r.forEach((e=>e(i))),n)return n(i)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:s}),12e4);s.onerror=f.bind(null,s.onerror),s.onload=f.bind(null,s.onload),c&&document.head.appendChild(s)}},o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.p="/themes/custom/materiotheme/assets/dist/",(()=>{var e={179:0};o.f.j=(t,n)=>{var i=o.o(e,t)?e[t]:void 0;if(0!==i)if(i)n.push(i[2]);else{var r=new Promise(((n,r)=>i=e[t]=[n,r]));n.push(i[2]=r);var a=o.p+o.u(t),s=new Error;o.l(a,(n=>{if(o.o(e,t)&&(0!==(i=e[t])&&(e[t]=void 0),i)){var r=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;s.message="Loading chunk "+t+" failed.\n("+r+": "+a+")",s.name="ChunkLoadError",s.type=r,s.request=a,i[1](s)}}),"chunk-"+t,t)}},o.F.j=t=>{if(!o.o(e,t)||void 0===e[t]){e[t]=null;var n=document.createElement("link");o.nc&&n.setAttribute("nonce",o.nc),n.rel="prefetch",n.as="script",n.href=o.p+o.u(t),document.head.appendChild(n)}},o.O.j=t=>0===e[t];var t=(t,n)=>{var i,r,[a,s,c]=n,l=0;for(i in s)o.o(s,i)&&(o.m[i]=s[i]);for(c&&c(o),t&&t(n);l<a.length;l++)r=a[l],o.o(e,r)&&e[r]&&e[r][0](),e[a[l]]=0;o.O()},n=self.webpackChunkmaterio_com=self.webpackChunkmaterio_com||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})(),o.O(0,[179],(()=>[694,282,67,790,204,665].map(o.E)),5);var a=o.O(void 0,[289],(()=>o(470)));a=o.O(a)})();

View File

@ -1 +1 @@
(self.webpackChunkmaterio_com=self.webpackChunkmaterio_com||[]).push([[665],{1003:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>v});var r=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{attrs:{id:"pricing"}},[t.products.length?t._l(t.products,(function(t){return s("Product",{key:t.uuid,attrs:{product:t}})})):s("div",{staticClass:"loading"},[s("span",[t._v(t._s(t.$t("default.Loading…")))])])],2)};r._withStripped=!0;var i=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("article",{staticClass:"product"},[s("header",[s("h1",{domProps:{innerHTML:t._s(t.product.title)}})]),t._v(" "),s("section",{staticClass:"content"},[s("div",{staticClass:"description",domProps:{innerHTML:t._s(t.product.body)}})]),t._v(" "),t.isAdherent?t._e():s("aside",[t._l(t.product.variations,(function(e){return s("div",{key:e.id,staticClass:"variation"},[s("div",{staticClass:"variation-description",domProps:{innerHTML:t._s(e.description)}}),t._v(" "),s("div",{staticClass:"actions"},[s("button",{attrs:{type:"button",name:"addtocart"},on:{click:function(s){return s.stopPropagation(),t.checkaddtocart(s,e.id)}}},[t._v("\n "+t._s(t.$t("default."+t.variation_btn_txt[e.id]))+"\n ")])])])})),t._v(" "),3==t.product.id?s("div",[s("a",{staticClass:"btn",attrs:{href:"/pricing/multijoueur"}},[t._v("\n "+t._s(t.$t("default.Ask for a quote"))+"\n ")])]):t._e()],2)])};i._withStripped=!0;var o=s(4408),n=s(1423);const a={name:"Product",router:o.Z,props:["product"],mixins:[n.Z],data:()=>({quantity:1,variation_btn_txt:{1:"Yeees!",2:"Yay!",3:"Great!",4:"OKAY!"}}),created(){this.product}};var c=s(1900),d=(0,c.Z)(a,i,[],!1,null,"0f9e2147",null);d.options.__file="web/themes/custom/materiotheme/vuejs/components/Content/Product.vue";const u=d.exports;var p=s(629);const l={name:"Pricing",computed:{...(0,p.rn)({products:t=>t.Pages.products})},created(){this.products.length||this.getProducts()},methods:{...(0,p.nv)({getProducts:"Pages/getProducts"})},components:{Product:u}};var _=(0,c.Z)(l,r,[],!1,null,"bdd44e2e",null);_.options.__file="web/themes/custom/materiotheme/vuejs/components/Pages/Pricing.vue";const v=_.exports}}]);
(self.webpackChunkmaterio_com=self.webpackChunkmaterio_com||[]).push([[665],{1003:(t,e,s)=>{"use strict";s.r(e),s.d(e,{default:()=>v});var r=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{attrs:{id:"pricing"}},[t.products.length?t._l(t.products,(function(t){return s("Product",{key:t.uuid,attrs:{product:t}})})):s("div",{staticClass:"loading"},[s("span",[t._v(t._s(t.$t("default.Loading…")))])])],2)};r._withStripped=!0;var i=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("article",{staticClass:"product"},[s("header",[s("h1",{domProps:{innerHTML:t._s(t.product.title)}})]),t._v(" "),s("section",{staticClass:"content"},[s("div",{staticClass:"description",domProps:{innerHTML:t._s(t.product.body)}})]),t._v(" "),t.isAdherent?t._e():s("aside",[t._l(t.product.variations,(function(e){return s("div",{key:e.id,staticClass:"variation"},[s("div",{staticClass:"variation-description",domProps:{innerHTML:t._s(e.description)}}),t._v(" "),s("div",{staticClass:"actions"},[s("button",{attrs:{type:"button",name:"addtocart"},on:{click:function(s){return s.stopPropagation(),t.checkaddtocart(s,e.id)}}},[t._v("\n "+t._s(t.$t("default."+t.variation_btn_txt[e.id]))+"\n ")])])])})),t._v(" "),8==t.product.id?s("div",[s("a",{staticClass:"btn",attrs:{href:"/pricing/multijoueur"}},[t._v("\n "+t._s(t.$t("default.Ask for a quote"))+"\n ")])]):t._e()],2)])};i._withStripped=!0;var o=s(4408),n=s(1423);const a={name:"Product",router:o.Z,props:["product"],mixins:[n.Z],data:()=>({quantity:1,variation_btn_txt:{6:"Yeees!",7:"Yay!",8:"Great!",9:"OKAY!"}}),created(){this.product}};var c=s(1900),d=(0,c.Z)(a,i,[],!1,null,"0f9e2147",null);d.options.__file="web/themes/custom/materiotheme/vuejs/components/Content/Product.vue";const u=d.exports;var p=s(629);const l={name:"Pricing",computed:{...(0,p.rn)({products:t=>t.Pages.products})},created(){this.products.length||this.getProducts()},methods:{...(0,p.nv)({getProducts:"Pages/getProducts"})},components:{Product:u}};var _=(0,c.Z)(l,r,[],!1,null,"bdd44e2e",null);_.options.__file="web/themes/custom/materiotheme/vuejs/components/Pages/Pricing.vue";const v=_.exports}}]);

View File

@ -23,7 +23,7 @@
</button>
</div>
</div>
<div v-if="product.id == 3">
<div v-if="product.id == 8">
<a href="/pricing/multijoueur" class="btn">
{{ $t("default.Ask for a quote") }}
</a>
@ -44,14 +44,15 @@ export default {
props: ['product'],
mixins: [productsMixins],
data(){
// thoose should be on a field of the variation
return {
quantity: 1,
// showLoginModal:false
variation_btn_txt: {
1: 'Yeees!',
2: 'Yay!',
3: 'Great!',
4: 'OKAY!'
6: 'Yeees!',
7: 'Yay!',
8: 'Great!',
9: 'OKAY!'
}
}
},