Browse Source

display product list, rest addtocart

Bachir Soussi Chiadmi 4 years ago
parent
commit
ebb20c6176
30 changed files with 1217 additions and 8 deletions
  1. 1 0
      composer.json
  2. 54 1
      composer.lock
  3. 21 0
      config/sync/block.block.cart.yml
  4. 1 1
      config/sync/commerce_store.settings.yml
  5. 8 0
      config/sync/core.entity_form_display.commerce_product_variation.materio_product_variation_type.default.yml
  6. 40 0
      config/sync/core.entity_view_display.commerce_product_variation.materio_product_variation_type.add_to_cart.yml
  7. 12 0
      config/sync/core.entity_view_display.commerce_product_variation.materio_product_variation_type.default.yml
  8. 10 0
      config/sync/core.entity_view_mode.commerce_product_variation.add_to_cart.yml
  9. 1 0
      config/sync/core.extension.yml
  10. 23 0
      config/sync/field.field.commerce_product_variation.materio_product_variation_type.field_multiple.yml
  11. 18 0
      config/sync/field.storage.commerce_product_variation.field_multiple.yml
  12. 20 0
      config/sync/rest.resource.commerce_cart_add.yml
  13. 20 0
      config/sync/rest.resource.commerce_cart_canonical.yml
  14. 20 0
      config/sync/rest.resource.commerce_cart_clear.yml
  15. 20 0
      config/sync/rest.resource.commerce_cart_collection.yml
  16. 22 0
      config/sync/rest.resource.commerce_cart_coupons.yml
  17. 20 0
      config/sync/rest.resource.commerce_cart_remove_item.yml
  18. 20 0
      config/sync/rest.resource.commerce_cart_update_item.yml
  19. 20 0
      config/sync/rest.resource.commerce_cart_update_items.yml
  20. 1 1
      config/sync/views.view.blabla.yml
  21. 633 0
      config/sync/views.view.pricing.yml
  22. 1 1
      config/sync/views.view.showrooms.yml
  23. 1 1
      web/modules/custom/materio_home/src/Controller/AjaxHomeController.php
  24. 8 0
      web/themes/custom/materiotheme/assets/dist/main.js
  25. 74 0
      web/themes/custom/materiotheme/vuejs/components/Content/Product.vue
  26. 45 0
      web/themes/custom/materiotheme/vuejs/components/Pages/Cart.vue
  27. 48 0
      web/themes/custom/materiotheme/vuejs/components/Pages/Pricing.vue
  28. 14 2
      web/themes/custom/materiotheme/vuejs/route/index.js
  29. 3 1
      web/themes/custom/materiotheme/vuejs/store/index.js
  30. 38 0
      web/themes/custom/materiotheme/vuejs/store/modules/pages.js

+ 1 - 0
composer.json

@@ -23,6 +23,7 @@
         "drupal/amswap": "^2.0",
         "drupal/auto_entitylabel": "2.x-dev",
         "drupal/commerce": "^2.12",
+        "drupal/commerce_cart_api": "^1.4",
         "drupal/commerce_license": "^2.0@alpha",
         "drupal/commerce_migrate": "^2.0",
         "drupal/commerce_monetico": "^1.0",

+ 54 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "7e10b3f48a875330ee707d7cee2bac93",
+    "content-hash": "bee8de31ae3bb4fa7aa201097983403f",
     "packages": [
         {
             "name": "alchemy/zippy",
@@ -3431,6 +3431,59 @@
                 "source": "https://git.drupalcode.org/project/commerce"
             }
         },
+        {
+            "name": "drupal/commerce_cart_api",
+            "version": "1.4.0",
+            "source": {
+                "type": "git",
+                "url": "https://git.drupalcode.org/project/commerce_cart_api.git",
+                "reference": "8.x-1.4"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://ftp.drupal.org/files/projects/commerce_cart_api-8.x-1.4.zip",
+                "reference": "8.x-1.4",
+                "shasum": "59dc0e713ac3a946b940707a93726b52e1f59e62"
+            },
+            "require": {
+                "drupal/commerce": "^2.13",
+                "drupal/commerce_cart": "*",
+                "drupal/core": "*"
+            },
+            "type": "drupal-module",
+            "extra": {
+                "branch-alias": {
+                    "dev-1.x": "1.x-dev"
+                },
+                "drupal": {
+                    "version": "8.x-1.4",
+                    "datestamp": "1560966488",
+                    "security-coverage": {
+                        "status": "covered",
+                        "message": "Covered by Drupal's security advisory policy"
+                    }
+                }
+            },
+            "notification-url": "https://packages.drupal.org/8/downloads",
+            "license": [
+                "GPL-2.0+"
+            ],
+            "authors": [
+                {
+                    "name": "mglaman",
+                    "homepage": "https://www.drupal.org/user/2416470"
+                }
+            ],
+            "description": "Provides a RESTful interface to interact with carts in Drupal Commerce via a lightweight public API.",
+            "homepage": "https://www.drupal.org/project/commerce_cart_api",
+            "keywords": [
+                "Drupal"
+            ],
+            "support": {
+                "source": "http://cgit.drupalcode.org/commerce_cart_api",
+                "issues": "https://www.drupal.org/project/issues/commerce_cart_api"
+            }
+        },
         {
             "name": "drupal/commerce_checkout",
             "version": "2.13.0",

+ 21 - 0
config/sync/block.block.cart.yml

@@ -0,0 +1,21 @@
+uuid: 90f98c52-9624-4758-9c38-3904d5ef5faa
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart
+  theme:
+    - materiotheme
+id: cart
+theme: materiotheme
+region: header_right
+weight: 0
+provider: null
+plugin: commerce_cart
+settings:
+  id: commerce_cart
+  label: Cart
+  provider: commerce_cart
+  label_display: visible
+  dropdown: true
+visibility: {  }

+ 1 - 1
config/sync/commerce_store.settings.yml

@@ -1,3 +1,3 @@
-default_store: bb23cf22-6a06-4f8d-88fc-0998f15ff2d0
+default_store: 8efb0192-cf8d-4aaa-86e3-01ffd5e09bb8
 _core:
   default_config_hash: B9ZFGR76POyzj9f3Sh66F346_Jp-wnnUc78Hk3Q-60o

+ 8 - 0
config/sync/core.entity_form_display.commerce_product_variation.materio_product_variation_type.default.yml

@@ -6,6 +6,7 @@ dependencies:
     - commerce_product.commerce_product_variation_type.materio_product_variation_type
     - field.field.commerce_product_variation.materio_product_variation_type.billing_schedule
     - field.field.commerce_product_variation.materio_product_variation_type.field_description
+    - field.field.commerce_product_variation.materio_product_variation_type.field_multiple
     - field.field.commerce_product_variation.materio_product_variation_type.license_expiration
     - field.field.commerce_product_variation.materio_product_variation_type.license_type
     - field.field.commerce_product_variation.materio_product_variation_type.subscription_type
@@ -32,6 +33,13 @@ content:
     third_party_settings: {  }
     type: text_textarea
     region: content
+  field_multiple:
+    weight: 93
+    settings:
+      display_label: true
+    third_party_settings: {  }
+    type: boolean_checkbox
+    region: content
   langcode:
     type: language_select
     weight: 2

+ 40 - 0
config/sync/core.entity_view_display.commerce_product_variation.materio_product_variation_type.add_to_cart.yml

@@ -0,0 +1,40 @@
+uuid: 670c3437-b44c-4bc9-b7f6-ec0b12d5c7ab
+langcode: en
+status: true
+dependencies:
+  config:
+    - commerce_product.commerce_product_variation_type.materio_product_variation_type
+    - core.entity_view_mode.commerce_product_variation.add_to_cart
+    - field.field.commerce_product_variation.materio_product_variation_type.billing_schedule
+    - field.field.commerce_product_variation.materio_product_variation_type.field_description
+    - field.field.commerce_product_variation.materio_product_variation_type.license_expiration
+    - field.field.commerce_product_variation.materio_product_variation_type.license_type
+    - field.field.commerce_product_variation.materio_product_variation_type.subscription_type
+  module:
+    - commerce_variation_cart_form
+third_party_settings:
+  commerce_variation_cart_form:
+    combine: '1'
+id: commerce_product_variation.materio_product_variation_type.add_to_cart
+targetEntityType: commerce_product_variation
+bundle: materio_product_variation_type
+mode: add_to_cart
+content:
+  commerce_variation_cart_form:
+    weight: 0
+    region: content
+    settings: {  }
+    third_party_settings: {  }
+hidden:
+  billing_schedule: true
+  field_description: true
+  langcode: true
+  license_expiration: true
+  license_type: true
+  list_price: true
+  price: true
+  product_id: true
+  search_api_excerpt: true
+  sku: true
+  subscription_type: true
+  title: true

+ 12 - 0
config/sync/core.entity_view_display.commerce_product_variation.materio_product_variation_type.default.yml

@@ -6,6 +6,7 @@ dependencies:
     - commerce_product.commerce_product_variation_type.materio_product_variation_type
     - field.field.commerce_product_variation.materio_product_variation_type.billing_schedule
     - field.field.commerce_product_variation.materio_product_variation_type.field_description
+    - field.field.commerce_product_variation.materio_product_variation_type.field_multiple
     - field.field.commerce_product_variation.materio_product_variation_type.license_expiration
     - field.field.commerce_product_variation.materio_product_variation_type.license_type
     - field.field.commerce_product_variation.materio_product_variation_type.subscription_type
@@ -33,6 +34,16 @@ content:
     third_party_settings: {  }
     type: text_default
     region: content
+  field_multiple:
+    weight: 4
+    label: above
+    settings:
+      format: default
+      format_custom_false: ''
+      format_custom_true: ''
+    third_party_settings: {  }
+    type: boolean
+    region: content
   price:
     label: hidden
     type: commerce_price_default
@@ -57,5 +68,6 @@ hidden:
   license_type: true
   list_price: true
   product_id: true
+  search_api_excerpt: true
   sku: true
   subscription_type: true

+ 10 - 0
config/sync/core.entity_view_mode.commerce_product_variation.add_to_cart.yml

@@ -0,0 +1,10 @@
+uuid: f0ae2b16-c0cd-4fcd-bc2d-4920dce0b9ec
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_product
+id: commerce_product_variation.add_to_cart
+label: 'add to cart'
+targetEntityType: commerce_product_variation
+cache: true

+ 1 - 0
config/sync/core.extension.yml

@@ -19,6 +19,7 @@ module:
   ckeditor: 0
   commerce: 0
   commerce_cart: 0
+  commerce_cart_api: 0
   commerce_checkout: 0
   commerce_cmcic: 0
   commerce_license: 0

+ 23 - 0
config/sync/field.field.commerce_product_variation.materio_product_variation_type.field_multiple.yml

@@ -0,0 +1,23 @@
+uuid: 915cd4b9-78c4-495b-abec-38923c6d71d3
+langcode: en
+status: true
+dependencies:
+  config:
+    - commerce_product.commerce_product_variation_type.materio_product_variation_type
+    - field.storage.commerce_product_variation.field_multiple
+id: commerce_product_variation.materio_product_variation_type.field_multiple
+field_name: field_multiple
+entity_type: commerce_product_variation
+bundle: materio_product_variation_type
+label: multiple
+description: ''
+required: false
+translatable: false
+default_value:
+  -
+    value: 0
+default_value_callback: ''
+settings:
+  on_label: 'On'
+  off_label: 'Off'
+field_type: boolean

+ 18 - 0
config/sync/field.storage.commerce_product_variation.field_multiple.yml

@@ -0,0 +1,18 @@
+uuid: d33342d9-6be2-4dd9-97fe-736ddbaa7deb
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_product
+id: commerce_product_variation.field_multiple
+field_name: field_multiple
+entity_type: commerce_product_variation
+type: boolean
+settings: {  }
+module: core
+locked: false
+cardinality: 1
+translatable: true
+indexes: {  }
+persist_with_no_fields: false
+custom_storage: false

+ 20 - 0
config/sync/rest.resource.commerce_cart_add.yml

@@ -0,0 +1,20 @@
+uuid: 3f812527-927a-4c9c-ab9f-178013a83a1f
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart_api
+    - serialization
+    - user
+_core:
+  default_config_hash: LptJMeSNAYdcJ0FCczBiIiAvSs3pgfeITgwPlUR5LmM
+id: commerce_cart_add
+plugin_id: commerce_cart_add
+granularity: resource
+configuration:
+  methods:
+    - POST
+  formats:
+    - json
+  authentication:
+    - cookie

+ 20 - 0
config/sync/rest.resource.commerce_cart_canonical.yml

@@ -0,0 +1,20 @@
+uuid: 4ce9498b-f336-4291-96f2-af4da7fe5509
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart_api
+    - serialization
+    - user
+_core:
+  default_config_hash: 4nYqayd8aO5e2acUdQAIbm5_cWyLV2Z5pdVB9eM_L-U
+id: commerce_cart_canonical
+plugin_id: commerce_cart_canonical
+granularity: resource
+configuration:
+  methods:
+    - GET
+  formats:
+    - json
+  authentication:
+    - cookie

+ 20 - 0
config/sync/rest.resource.commerce_cart_clear.yml

@@ -0,0 +1,20 @@
+uuid: 599fc55b-d435-4f54-90dc-51ff1a53b6cb
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart_api
+    - serialization
+    - user
+_core:
+  default_config_hash: gFt_6Zv9JEPLa560_rsfsqrQC21_LQ6becnJMNjUIpM
+id: commerce_cart_clear
+plugin_id: commerce_cart_clear
+granularity: resource
+configuration:
+  methods:
+    - DELETE
+  formats:
+    - json
+  authentication:
+    - cookie

+ 20 - 0
config/sync/rest.resource.commerce_cart_collection.yml

@@ -0,0 +1,20 @@
+uuid: 78d0e03d-34a3-4f1c-805e-54855769a65e
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart_api
+    - serialization
+    - user
+_core:
+  default_config_hash: hmTTiE7SFlCqDYrx7_F-rWrUkDx2GrFg3wN6BcIq5xc
+id: commerce_cart_collection
+plugin_id: commerce_cart_collection
+granularity: resource
+configuration:
+  methods:
+    - GET
+  formats:
+    - json
+  authentication:
+    - cookie

+ 22 - 0
config/sync/rest.resource.commerce_cart_coupons.yml

@@ -0,0 +1,22 @@
+uuid: 0fb1c3c3-fb23-48e1-b838-61301c101257
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart_api
+    - serialization
+    - user
+_core:
+  default_config_hash: '-VZFihnbsF6hEpC1DV9RX_b3dI4QQkqGTNiv6qMTbkA'
+id: commerce_cart_coupons
+plugin_id: commerce_cart_coupons
+granularity: resource
+configuration:
+  methods:
+    - GET
+    - PATCH
+    - DELETE
+  formats:
+    - json
+  authentication:
+    - cookie

+ 20 - 0
config/sync/rest.resource.commerce_cart_remove_item.yml

@@ -0,0 +1,20 @@
+uuid: 2aaeb0f0-aba3-4906-9ee5-6770f5c3e2b0
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart_api
+    - serialization
+    - user
+_core:
+  default_config_hash: cQORBV4olEqxQT9k7Z9gmobi4AUuEahhxC32K8CprOQ
+id: commerce_cart_remove_item
+plugin_id: commerce_cart_remove_item
+granularity: resource
+configuration:
+  methods:
+    - DELETE
+  formats:
+    - json
+  authentication:
+    - cookie

+ 20 - 0
config/sync/rest.resource.commerce_cart_update_item.yml

@@ -0,0 +1,20 @@
+uuid: 16dcbb19-336e-4d95-a015-a06afdc61af6
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart_api
+    - serialization
+    - user
+_core:
+  default_config_hash: WqYdG4xXtHm4Ok5hm8eKZIdWyoZ2icbbjm88ZEWLQXs
+id: commerce_cart_update_item
+plugin_id: commerce_cart_update_item
+granularity: resource
+configuration:
+  methods:
+    - PATCH
+  formats:
+    - json
+  authentication:
+    - cookie

+ 20 - 0
config/sync/rest.resource.commerce_cart_update_items.yml

@@ -0,0 +1,20 @@
+uuid: 081147a6-6299-40d1-907a-8f4e6e67d24d
+langcode: en
+status: true
+dependencies:
+  module:
+    - commerce_cart_api
+    - serialization
+    - user
+_core:
+  default_config_hash: cEt7qeWXge5-KBeMTZViFP-KX7AqedUbSpxGS43GFDA
+id: commerce_cart_update_items
+plugin_id: commerce_cart_update_items
+granularity: resource
+configuration:
+  methods:
+    - PATCH
+  formats:
+    - json
+  authentication:
+    - cookie

+ 1 - 1
config/sync/views.view.blabla.yml

@@ -24,7 +24,7 @@ id: blabla
 label: Blabla
 module: views
 description: ''
-tag: ''
+tag: Materio
 base_table: node_field_data
 base_field: nid
 core: 8.x

+ 633 - 0
config/sync/views.view.pricing.yml

@@ -0,0 +1,633 @@
+uuid: 85b6fa75-c392-415a-9e3f-58322aeba35f
+langcode: en
+status: true
+dependencies:
+  config:
+    - commerce_product.commerce_product_variation_type.materio_product_variation_type
+    - field.storage.commerce_product_variation.field_description
+    - field.storage.commerce_product_variation.field_multiple
+    - system.menu.header
+  module:
+    - commerce
+    - commerce_price
+    - commerce_product
+    - rest
+    - serialization
+    - text
+id: pricing
+label: Pricing
+module: views
+description: ''
+tag: ''
+base_table: commerce_product_variation_field_data
+base_field: variation_id
+core: 8.x
+display:
+  default:
+    display_plugin: default
+    id: default
+    display_title: Master
+    position: 0
+    display_options:
+      access:
+        type: none
+        options: {  }
+      cache:
+        type: tag
+        options: {  }
+      query:
+        type: views_query
+        options:
+          disable_sql_rewrite: false
+          distinct: false
+          replica: false
+          query_comment: ''
+          query_tags: {  }
+      exposed_form:
+        type: basic
+        options:
+          submit_button: Apply
+          reset_button: false
+          reset_button_label: Reset
+          exposed_sorts_label: 'Sort by'
+          expose_sort_order: true
+          sort_asc_label: Asc
+          sort_desc_label: Desc
+      pager:
+        type: mini
+        options:
+          items_per_page: 10
+          offset: 0
+          id: 0
+          total_pages: null
+          expose:
+            items_per_page: false
+            items_per_page_label: 'Items per page'
+            items_per_page_options: '5, 10, 25, 50'
+            items_per_page_options_all: false
+            items_per_page_options_all_label: '- All -'
+            offset: false
+            offset_label: Offset
+          tags:
+            previous: ‹‹
+            next: ››
+      style:
+        type: default
+      row:
+        type: fields
+      fields:
+        variation_id:
+          id: variation_id
+          table: commerce_product_variation_field_data
+          field: variation_id
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: number_integer
+          settings:
+            thousand_separator: ''
+            prefix_suffix: true
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: commerce_product_variation
+          entity_field: variation_id
+          plugin_id: field
+        uuid:
+          id: uuid
+          table: commerce_product_variation
+          field: uuid
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: false
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: commerce_product_variation
+          entity_field: uuid
+          plugin_id: field
+        title:
+          id: title
+          table: commerce_product_variation_field_data
+          field: title
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: string
+          settings:
+            link_to_entity: false
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: commerce_product_variation
+          entity_field: title
+          plugin_id: field
+        field_description:
+          id: field_description
+          table: commerce_product_variation__field_description
+          field: field_description
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: text_default
+          settings: {  }
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          plugin_id: field
+        price__number:
+          id: price__number
+          table: commerce_product_variation_field_data
+          field: price__number
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: number
+          type: commerce_price_default
+          settings:
+            strip_trailing_zeroes: false
+            currency_display: symbol
+          group_column: ''
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          entity_type: commerce_product_variation
+          entity_field: price
+          plugin_id: field
+        field_multiple:
+          id: field_multiple
+          table: commerce_product_variation__field_multiple
+          field: field_multiple
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          click_sort_column: value
+          type: boolean
+          settings:
+            format: boolean
+            format_custom_true: ''
+            format_custom_false: ''
+          group_column: value
+          group_columns: {  }
+          group_rows: true
+          delta_limit: 0
+          delta_offset: 0
+          delta_reversed: false
+          delta_first_last: false
+          multi_type: separator
+          separator: ', '
+          field_api_classes: false
+          plugin_id: field
+      filters:
+        status:
+          value: '1'
+          table: commerce_product_variation_field_data
+          field: status
+          plugin_id: boolean
+          entity_type: commerce_product_variation
+          entity_field: status
+          id: status
+          expose:
+            operator: ''
+          group: 1
+        type:
+          id: type
+          table: commerce_product_variation_field_data
+          field: type
+          value:
+            materio_product_variation_type: materio_product_variation_type
+          entity_type: commerce_product_variation
+          entity_field: type
+          plugin_id: commerce_entity_bundle
+      sorts: {  }
+      title: Pricing
+      header: {  }
+      footer: {  }
+      empty: {  }
+      relationships: {  }
+      arguments: {  }
+      display_extenders: {  }
+    cache_metadata:
+      max-age: -1
+      contexts:
+        - 'languages:language_content'
+        - 'languages:language_interface'
+        - url.query_args
+      tags:
+        - 'config:field.storage.commerce_product_variation.field_description'
+        - 'config:field.storage.commerce_product_variation.field_multiple'
+  page_1:
+    display_plugin: page
+    id: page_1
+    display_title: Page
+    position: 1
+    display_options:
+      display_extenders:
+        views_ef_fieldset: {  }
+      path: pricing
+      menu:
+        type: normal
+        title: Pricing
+        menu_name: header
+      fields:
+        rendered_entity:
+          id: rendered_entity
+          table: commerce_product_variation
+          field: rendered_entity
+          relationship: none
+          group_type: group
+          admin_label: ''
+          label: ''
+          exclude: false
+          alter:
+            alter_text: false
+            text: ''
+            make_link: false
+            path: ''
+            absolute: false
+            external: false
+            replace_spaces: false
+            path_case: none
+            trim_whitespace: false
+            alt: ''
+            rel: ''
+            link_class: ''
+            prefix: ''
+            suffix: ''
+            target: ''
+            nl2br: false
+            max_length: 0
+            word_boundary: true
+            ellipsis: true
+            more_link: false
+            more_link_text: ''
+            more_link_path: ''
+            strip_tags: false
+            trim: false
+            preserve_tags: ''
+            html: false
+          element_type: ''
+          element_class: ''
+          element_label_type: ''
+          element_label_class: ''
+          element_label_colon: false
+          element_wrapper_type: ''
+          element_wrapper_class: ''
+          element_default_classes: true
+          empty: ''
+          hide_empty: false
+          empty_zero: false
+          hide_alter_empty: true
+          view_mode: default
+          entity_type: commerce_product_variation
+          plugin_id: rendered_entity
+      defaults:
+        fields: false
+    cache_metadata:
+      max-age: -1
+      contexts:
+        - 'languages:language_interface'
+        - url.query_args
+      tags:
+        - 'config:core.entity_view_display.commerce_product_variation.default.cart'
+        - 'config:core.entity_view_display.commerce_product_variation.default.summary'
+        - 'config:core.entity_view_display.commerce_product_variation.materio_product_variation_type.add_to_cart'
+        - 'config:core.entity_view_display.commerce_product_variation.materio_product_variation_type.default'
+  rest_export_1:
+    display_plugin: rest_export
+    id: rest_export_1
+    display_title: 'REST export'
+    position: 2
+    display_options:
+      display_extenders:
+        views_ef_fieldset: {  }
+      path: pricing_rest
+      style:
+        type: serializer
+        options:
+          formats:
+            json: json
+      defaults:
+        style: false
+        row: false
+        fields: true
+      row:
+        type: data_field
+        options:
+          field_options:
+            field_description:
+              alias: ''
+              raw_output: false
+            price__number:
+              alias: ''
+              raw_output: false
+            title:
+              alias: ''
+              raw_output: false
+            uuid:
+              alias: ''
+              raw_output: false
+            list_price__number:
+              alias: ''
+              raw_output: false
+      pager:
+        type: some
+        options:
+          items_per_page: 10
+          offset: 0
+    cache_metadata:
+      max-age: -1
+      contexts:
+        - 'languages:language_content'
+        - 'languages:language_interface'
+        - request_format
+      tags:
+        - 'config:field.storage.commerce_product_variation.field_description'
+        - 'config:field.storage.commerce_product_variation.field_multiple'

+ 1 - 1
config/sync/views.view.showrooms.yml

@@ -25,7 +25,7 @@ id: showrooms
 label: Showrooms
 module: views
 description: ''
-tag: ''
+tag: Materio
 base_table: taxonomy_term_field_data
 base_field: tid
 core: 8.x

+ 1 - 1
web/modules/custom/materio_home/src/Controller/AjaxHomeController.php

@@ -89,7 +89,7 @@ class AjaxHomeController extends ControllerBase {
 
     $data['#cache'] = [
       'max-age' => \Drupal\Core\Cache\Cache::PERMANENT,
-      'tags' => ['edlp-home-cache'],
+      'tags' => ['materio-home-cache'],
       'contexts' => [
         'languages:language_content'
       ]

File diff suppressed because it is too large
+ 8 - 0
web/themes/custom/materiotheme/assets/dist/main.js


+ 74 - 0
web/themes/custom/materiotheme/vuejs/components/Content/Product.vue

@@ -0,0 +1,74 @@
+<template>
+  <article class="product">
+    <header>
+      <h1 v-html="product.title" />
+    </header>
+    <section class="content">
+      <div class="description" v-html="product.field_description" />
+      <span class="price">{{ product.price__number }}</span>
+    </section>
+    <aside class="">
+      <input
+        v-if="product.field_multiple"
+        v-model="quantity"
+        placeholder="quantity"
+        type="text"
+        name="quantity"
+        value="1"
+      />
+      <button
+        type="button"
+        name="addtocart"
+        @click.stop="addtocart"
+      >
+        Commander
+      </button>
+    </aside>
+
+  </article>
+</template>
+
+<script>
+
+import { REST } from 'vuejs/api/rest-axios'
+import router from 'vuejs/route'
+
+let basePath = drupalSettings.path.baseUrl + drupalSettings.path.pathPrefix;
+
+export default {
+  name: "Product",
+  router,
+  props: ['product'],
+  data(){
+    return {
+      quantity: 1
+    }
+  },
+  methods:{
+    addtocart () {
+      console.log("addtocart clicked");
+      // curl -X POST \
+      //   'http://localhost:32775/cart/add?_format=json' \
+      //   -H 'Content-Type: application/json' \
+      //   -d '[{ "purchased_entity_type": "commerce_product_variation", "purchased_entity_id": "6", "quantity": "1"}]'
+
+      REST.post(`/cart/add?_format=json`, [{
+        "purchased_entity_type": "commerce_product_variation",
+        "purchased_entity_id": this.product.variation_id,
+        "quantity": this.quantity
+      }])
+        .then(({ data }) => {
+          console.log('product add to cart REST: data', data)
+        })
+        .catch(( error ) => {
+            console.warn('Issue with pricing', error)
+            Promise.reject(error)
+        })
+
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+</style>

+ 45 - 0
web/themes/custom/materiotheme/vuejs/components/Pages/Cart.vue

@@ -0,0 +1,45 @@
+<template>
+  <div id="cart">
+    <div class="loading" v-if="!false">
+      <span>Loading ...</span>
+    </div>
+    <div class="">
+      This the cart
+    </div>
+  </div>
+</template>
+
+<script>
+
+// import Showroom from 'vuejs/components/Content/Showroom'
+// import { mapState, mapActions } from 'vuex'
+
+export default {
+  name: "cart",
+  // data() {
+  //   return {
+  //     items:[],
+  //     page:0
+  //   }
+  // },
+  // computed: {
+  //   ...mapState({
+  //     items: state => state.Showrooms.items
+  //   })
+  // },
+  created(){
+    // if(!this.items.length)
+    //   this.getItems()
+  },
+  methods: {
+    // ...mapActions({
+    //   getItems: 'Showrooms/getItems'
+    // })
+  },
+  // components: {
+  //   Showroom
+  // }
+}
+</script>
+<style lang="scss" scoped>
+</style>

+ 48 - 0
web/themes/custom/materiotheme/vuejs/components/Pages/Pricing.vue

@@ -0,0 +1,48 @@
+<template>
+  <div id="pricing">
+    <div class="loading" v-if="!pricing.length">
+      <span>Loading ...</span>
+    </div>
+    <Product
+      v-else
+      v-for="product in pricing"
+      v-bind:key="product.uuid"
+      :product="product"
+    />
+  </div>
+</template>
+
+<script>
+
+import Product from 'vuejs/components/Content/Product'
+import { mapState, mapActions } from 'vuex'
+
+export default {
+  name: "Pricing",
+  // data() {
+  //   return {
+  //     items:[],
+  //     page:0
+  //   }
+  // },
+  computed: {
+    ...mapState({
+      pricing: state => state.Pages.pricing
+    })
+  },
+  created(){
+    if(!this.pricing.length)
+      this.getPricing()
+  },
+  methods: {
+    ...mapActions({
+      getPricing: 'Pages/getPricing'
+    })
+  },
+  components: {
+    Product
+  }
+}
+</script>
+<style lang="scss" scoped>
+</style>

+ 14 - 2
web/themes/custom/materiotheme/vuejs/route/index.js

@@ -6,6 +6,8 @@ import Base from 'vuejs/components/Pages/Base'
 import Blabla from 'vuejs/components/Pages/Blabla'
 import Article from 'vuejs/components/Pages/Article'
 import Showrooms from 'vuejs/components/Pages/Showrooms'
+import Pricing from 'vuejs/components/Pages/Pricing'
+import Cart from 'vuejs/components/Pages/Cart'
 
 Vue.use(VueRouter)
 
@@ -66,14 +68,24 @@ const routes = [
     path: `${basePath}showrooms`,
     component: Showrooms,
     // meta: { uuid:null }
-  }
+  },
   // {
   //   path: '*',
   //   name: 'notfound',
   //   components: {
   //     'notfound': NotFound
   //   }
-  // }
+  // },
+  {
+    name:'pricing',
+    path: `${basePath}pricing`,
+    component: Pricing
+  },
+  {
+    name:'cart',
+    path: `${basePath}cart`,
+    component: Cart
+  }
 ]
 
 export default new VueRouter({

+ 3 - 1
web/themes/custom/materiotheme/vuejs/store/index.js

@@ -5,6 +5,7 @@ import User from './modules/user'
 import Search from './modules/search'
 import Blabla from './modules/blabla'
 import Showrooms from './modules/showrooms'
+import Pages from './modules/pages'
 
 // https://github.com/vuejs/vuex/tree/dev/examples/shopping-cart
 
@@ -15,6 +16,7 @@ export default new Vuex.Store({
     User,
     Search,
     Blabla,
-    Showrooms
+    Showrooms,
+    Pages
   }
 })

+ 38 - 0
web/themes/custom/materiotheme/vuejs/store/modules/pages.js

@@ -0,0 +1,38 @@
+import { JSONAPI } from 'vuejs/api/json-axios'
+import { REST } from 'vuejs/api/rest-axios'
+import { MA } from 'vuejs/api/ma-axios'
+import qs from 'querystring'
+
+export default {
+  namespaced: true,
+
+  // initial state
+  state : {
+    pricing: {},
+  },
+
+  // getters
+  getters : {},
+
+  // mutations
+  mutations : {
+    setPricing (state, page) {
+      state.pricing = page
+    }
+  },
+
+  // actions
+  actions : {
+    getPricing({ dispatch, commit, state }){
+      REST.get(`/pricing_rest?_format=json`, {})
+        .then(({ data }) => {
+          console.log('pricing REST: data', data)
+          commit('setPricing',data)
+        })
+        .catch(( error ) => {
+            console.warn('Issue with pricing', error)
+            Promise.reject(error)
+        })
+    }
+  }
+}

Some files were not shown because too many files changed in this diff