shoplazza-cli 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.editorconfig +28 -0
  2. package/.prettierrc +9 -0
  3. package/LICENSE +21 -0
  4. package/README.md +208 -0
  5. package/bin/shoplazza +117 -0
  6. package/fixtures/assets/blog.scss +74 -0
  7. package/fixtures/assets/cart_modal.scss +450 -0
  8. package/fixtures/assets/collection_detail.js +234 -0
  9. package/fixtures/assets/collection_detail.scss +345 -0
  10. package/fixtures/assets/collection_list.scss +11 -0
  11. package/fixtures/assets/collection_slider.scss +169 -0
  12. package/fixtures/assets/feature_columns.scss +26 -0
  13. package/fixtures/assets/feature_product.scss +109 -0
  14. package/fixtures/assets/footer.js +58 -0
  15. package/fixtures/assets/footer.scss +337 -0
  16. package/fixtures/assets/four_images.scss +29 -0
  17. package/fixtures/assets/gallery.scss +55 -0
  18. package/fixtures/assets/header.js +178 -0
  19. package/fixtures/assets/header.scss +929 -0
  20. package/fixtures/assets/image_text.scss +72 -0
  21. package/fixtures/assets/logo_bar.scss +11 -0
  22. package/fixtures/assets/newsletter.scss +90 -0
  23. package/fixtures/assets/not_found.scss +39 -0
  24. package/fixtures/assets/page_detail.scss +16 -0
  25. package/fixtures/assets/pagination.scss +150 -0
  26. package/fixtures/assets/postcss.config.js +6 -0
  27. package/fixtures/assets/product_description.scss +88 -0
  28. package/fixtures/assets/product_detail.js +634 -0
  29. package/fixtures/assets/product_detail.scss +1106 -0
  30. package/fixtures/assets/relative_product.scss +45 -0
  31. package/fixtures/assets/reviews.scss +70 -0
  32. package/fixtures/assets/rich_text.scss +71 -0
  33. package/fixtures/assets/search.js +87 -0
  34. package/fixtures/assets/search.scss +67 -0
  35. package/fixtures/assets/slide.scss +51 -0
  36. package/fixtures/assets/slider.scss +141 -0
  37. package/fixtures/assets/theme.css +976 -0
  38. package/fixtures/assets/theme.scss +1100 -0
  39. package/fixtures/assets/three_images.scss +20 -0
  40. package/fixtures/assets/tools.scss +23 -0
  41. package/fixtures/assets/two_images.scss +24 -0
  42. package/fixtures/assets/video.scss +45 -0
  43. package/fixtures/assets/video_text.scss +63 -0
  44. package/fixtures/config/settings_data.json +107 -0
  45. package/fixtures/config/settings_schema.json +690 -0
  46. package/fixtures/layout/theme.liquid +76 -0
  47. package/fixtures/locales/ar-SA.json +212 -0
  48. package/fixtures/locales/de-DE.json +290 -0
  49. package/fixtures/locales/en-US.json +290 -0
  50. package/fixtures/locales/es-ES.json +290 -0
  51. package/fixtures/locales/fr-FR.json +290 -0
  52. package/fixtures/locales/id-ID.json +212 -0
  53. package/fixtures/locales/it-IT.json +212 -0
  54. package/fixtures/locales/ja-JP.json +289 -0
  55. package/fixtures/locales/ko-KR.json +290 -0
  56. package/fixtures/locales/nl-NL.json +290 -0
  57. package/fixtures/locales/pl-PL.json +290 -0
  58. package/fixtures/locales/pt-PT.json +212 -0
  59. package/fixtures/locales/ru-RU.json +212 -0
  60. package/fixtures/locales/th-TH.json +212 -0
  61. package/fixtures/locales/zh-CN.json +290 -0
  62. package/fixtures/locales/zh-TW.json +290 -0
  63. package/fixtures/sections/apps.liquid +47 -0
  64. package/fixtures/sections/blog.liquid +137 -0
  65. package/fixtures/sections/collection_desc.liquid +34 -0
  66. package/fixtures/sections/collection_detail.liquid +436 -0
  67. package/fixtures/sections/collection_image.liquid +104 -0
  68. package/fixtures/sections/collection_list.liquid +161 -0
  69. package/fixtures/sections/collection_name.liquid +34 -0
  70. package/fixtures/sections/collection_slider.liquid +330 -0
  71. package/fixtures/sections/feature_columns.liquid +275 -0
  72. package/fixtures/sections/feature_product.liquid +227 -0
  73. package/fixtures/sections/footer.liquid +488 -0
  74. package/fixtures/sections/four_images.liquid +160 -0
  75. package/fixtures/sections/gallery.liquid +258 -0
  76. package/fixtures/sections/header.liquid +1157 -0
  77. package/fixtures/sections/html.liquid +40 -0
  78. package/fixtures/sections/image_text.liquid +350 -0
  79. package/fixtures/sections/instagram_plus.liquid +393 -0
  80. package/fixtures/sections/logo_bar.liquid +183 -0
  81. package/fixtures/sections/newsletter.liquid +225 -0
  82. package/fixtures/sections/not_found.liquid +39 -0
  83. package/fixtures/sections/overlay_image.liquid +648 -0
  84. package/fixtures/sections/page_detail.liquid +39 -0
  85. package/fixtures/sections/photo_collection.liquid +433 -0
  86. package/fixtures/sections/product_description.liquid +208 -0
  87. package/fixtures/sections/product_detail.liquid +611 -0
  88. package/fixtures/sections/products.liquid +216 -0
  89. package/fixtures/sections/relative_product.liquid +121 -0
  90. package/fixtures/sections/reviews.liquid +115 -0
  91. package/fixtures/sections/rich_text.liquid +157 -0
  92. package/fixtures/sections/search.liquid +163 -0
  93. package/fixtures/sections/slide.liquid +719 -0
  94. package/fixtures/sections/three_images.liquid +157 -0
  95. package/fixtures/sections/two_images.liquid +125 -0
  96. package/fixtures/sections/video.liquid +95 -0
  97. package/fixtures/sections/video_text.liquid +128 -0
  98. package/fixtures/snippets/bgset.liquid +21 -0
  99. package/fixtures/snippets/card_title.liquid +8 -0
  100. package/fixtures/snippets/cart_modal.liquid +74 -0
  101. package/fixtures/snippets/collection.liquid +77 -0
  102. package/fixtures/snippets/collection_filter_modal.liquid +56 -0
  103. package/fixtures/snippets/default_image_4.liquid +14 -0
  104. package/fixtures/snippets/default_image_6.liquid +18 -0
  105. package/fixtures/snippets/default_image_8.liquid +23 -0
  106. package/fixtures/snippets/four_images_item.liquid +8 -0
  107. package/fixtures/snippets/header_ads.liquid +95 -0
  108. package/fixtures/snippets/hero_image.liquid +94 -0
  109. package/fixtures/snippets/icon_video_play_large.liquid +1 -0
  110. package/fixtures/snippets/icon_video_play_medium.liquid +4 -0
  111. package/fixtures/snippets/icon_video_play_small.liquid +4 -0
  112. package/fixtures/snippets/lazyimg.liquid +22 -0
  113. package/fixtures/snippets/lazyimg_art.liquid +36 -0
  114. package/fixtures/snippets/lazysizes.liquid +41 -0
  115. package/fixtures/snippets/link.liquid +2 -0
  116. package/fixtures/snippets/pagination.liquid +48 -0
  117. package/fixtures/snippets/product.liquid +126 -0
  118. package/fixtures/snippets/product_art_tpl.liquid +152 -0
  119. package/fixtures/snippets/product_info_body.liquid +337 -0
  120. package/fixtures/snippets/product_info_tpl.liquid +423 -0
  121. package/fixtures/snippets/product_label.liquid +46 -0
  122. package/fixtures/snippets/settings.liquid +295 -0
  123. package/fixtures/snippets/social-meta-tags.liquid +106 -0
  124. package/fixtures/snippets/video_html.liquid +11 -0
  125. package/fixtures/snippets/video_source.liquid +98 -0
  126. package/fixtures/snippets/video_thumb_icon.liquid +2 -0
  127. package/fixtures/templates/404.liquid +1 -0
  128. package/fixtures/templates/collection.liquid +92 -0
  129. package/fixtures/templates/index.liquid +206 -0
  130. package/fixtures/templates/page.liquid +1 -0
  131. package/fixtures/templates/product.liquid +99 -0
  132. package/fixtures/templates/search.liquid +1 -0
  133. package/jest.config.js +192 -0
  134. package/lib/__tests__/log.test.js +15 -0
  135. package/lib/__tests__/utils.test.js +69 -0
  136. package/lib/auth/__mocks__/getCode.js +7 -0
  137. package/lib/auth/__mocks__/index.js +0 -0
  138. package/lib/auth/child.js +23 -0
  139. package/lib/auth/getCode.js +35 -0
  140. package/lib/auth/index.js +91 -0
  141. package/lib/commands/__tests__/login.test.js +77 -0
  142. package/lib/commands/__tests__/logout.test.js +29 -0
  143. package/lib/commands/__tests__/store.test.js +44 -0
  144. package/lib/commands/__tests__/switch.test.js +45 -0
  145. package/lib/commands/login.js +99 -0
  146. package/lib/commands/logout.js +14 -0
  147. package/lib/commands/store.js +14 -0
  148. package/lib/commands/switch.js +52 -0
  149. package/lib/commands/theme/__tests__/delete.test.js +49 -0
  150. package/lib/commands/theme/__tests__/init.test.js +21 -0
  151. package/lib/commands/theme/__tests__/list.test.js +80 -0
  152. package/lib/commands/theme/__tests__/package.test.js +17 -0
  153. package/lib/commands/theme/__tests__/publish.test.js +61 -0
  154. package/lib/commands/theme/__tests__/pull.test.js +69 -0
  155. package/lib/commands/theme/__tests__/push.test.js +63 -0
  156. package/lib/commands/theme/__tests__/serve.test.js +107 -0
  157. package/lib/commands/theme/delete.js +64 -0
  158. package/lib/commands/theme/init.js +51 -0
  159. package/lib/commands/theme/list.js +28 -0
  160. package/lib/commands/theme/package.js +37 -0
  161. package/lib/commands/theme/publish.js +56 -0
  162. package/lib/commands/theme/pull.js +62 -0
  163. package/lib/commands/theme/push.js +106 -0
  164. package/lib/commands/theme/serve.js +153 -0
  165. package/lib/commands/theme/share.js +20 -0
  166. package/lib/commands/version.js +6 -0
  167. package/lib/config.js +5 -0
  168. package/lib/db/__mocks__/index.js +9 -0
  169. package/lib/db/__tests__/analytics.test.js +19 -0
  170. package/lib/db/__tests__/user.test.js +20 -0
  171. package/lib/db/analytics.js +48 -0
  172. package/lib/db/index.js +9 -0
  173. package/lib/db/user.js +68 -0
  174. package/lib/log.js +13 -0
  175. package/lib/openAPI/__mocks__/index.js +20 -0
  176. package/lib/openAPI/api.js +76 -0
  177. package/lib/openAPI/index.js +46 -0
  178. package/lib/report.js +37 -0
  179. package/lib/tracing.js +50 -0
  180. package/lib/utils.js +48 -0
  181. package/package.json +54 -0
@@ -0,0 +1,137 @@
1
+ <div class="container container-gap">
2
+ {% if section.settings.title %}
3
+ <div id="blog-{{section.id}}-title" {% if shop.env == 0 %} style="display:none" {% endif %} >
4
+ {% include 'card_title',
5
+ title: section.settings.title,
6
+ titlePath: 'title'
7
+ %}
8
+ </div>
9
+ {% endif %}
10
+ <div id="blog-{{section.id}}-articles" class="row"></div>
11
+ <div style="margin:3.5rem 0;text-align:center;display:none;" id="blog-{{section.id}}-viewall">
12
+ <a href="{{section.settings.blog.url}}" class="btn btn-primary dj_skin_title_font">{{ 'i18n.general.view.view_all' | t }}</a>
13
+ </div>
14
+ </div>
15
+ {% use 'blog.css' %}
16
+ {% javascript %}
17
+ $(function(){
18
+ var settings = {{ section.settings | json }};
19
+ var sectionId = "{{section.id}}";
20
+ (function(callback){
21
+ if(settings.blog && settings.blog.id && settings.blog.url){
22
+ $.get('/api/front' + settings.blog.url + '/articles?per_page=' + settings.size + '&page=1').then(function(res){
23
+ $("#blog-{{section.id}}-viewall")[res.count > settings.size?"show":"hide"]();
24
+ callback(res.articles);
25
+ })
26
+ }else{
27
+ callback([]);
28
+ }
29
+ })(function(arr){
30
+ {% if shop.env == 1 %}
31
+ arr = arr.concat(Array.apply(null, Array(settings.size-arr.length)).map(function(){
32
+ return {url:"javascript:$.toast.show({content:'请添加博客专辑'});",published_at:"2019-06-14T00:30:47Z",author:"{{shop.name}}",title:"New Pattern Spotlight: The Micro-Stripe",excerpt:"With an expansive collection of solid and heather colors in our line, the idea of adding a pattern to our collection has naturally been for years",blogs:[{title:"category1"},{title:"category2"}]};
33
+ }));
34
+ {% endif %}
35
+ arr.length && ($("#blog-{{section.id}}-title").show());
36
+ $("#blog-{{section.id}}-articles").html(arr.map(function(a){
37
+ return window.template("blogs-tpl", { article: a });
38
+ }).join(""));
39
+ });
40
+ });
41
+ {% endjavascript %}
42
+
43
+ <script id="blogs-tpl" type="text/html">
44
+ <div class="col-12 col-md-6">
45
+ <a href="<%= article.url %>" class="article__img">
46
+ <div class="common__img-wrapper_lazy" style="padding-bottom: 57%;overflow:hidden;">
47
+ {% assign defaultImg = 'oss/operation/1468cb0e248c143782cd5161c2a81455.png' | img_url: '1080x' %}
48
+ <% var src = article.image && article.image.src ? article.image.src : '{{defaultImg}}'; %>
49
+ <img src="{{shop.default_img}}" data-src="<%= src %>"
50
+ style="width: 100%;max-height: unset;"
51
+ alt="<%= (article.image && article.image.alt) || article.title %>" class="lazy lazyload">
52
+ </div>
53
+ </a>
54
+ <div class="article__date">
55
+ <% if (article.published_at) { %>
56
+ <span><%= $imports.dateFormat($imports.toTimestamp(article.published_at), 'MM.dd.yyyy') %></span>
57
+ <% } %>
58
+ <% if (article.published_at && article.author) { %>
59
+ <span style='margin:0 10px;'>|</span>
60
+ <% } %>
61
+ <% if (article.author) { %>
62
+ <span><%= article.author %></span>
63
+ <% } %>
64
+ </div>
65
+ <a href="<%= article.url %>" class="article__title two_line_text_truncate"><%= article.title %></a>
66
+ <% if (article.excerpt) { %><div class="article__excerpt"><%= article.excerpt %></div><% } %>
67
+ <hr>
68
+ <div class="d-flex justify-content-between article__readline">
69
+ <a href="<%= article.url %>" class="article__read">{{ 'i18n.blog.general.blog_read' | t }}</a>
70
+ <span class="article__blogs two_line_text_truncate">
71
+ <% for (var i = 0; i < article.blogs.length; i++) { %>
72
+ <%= article.blogs[i].title %><% if (i < article.blogs.length - 1) { %>,<% } %>
73
+ <% } %>
74
+ </span>
75
+ </div>
76
+ </div>
77
+ </script>
78
+
79
+
80
+ {% schema %}
81
+ {
82
+ "name": "blog",
83
+ "settings": [
84
+ {
85
+ "type": "text",
86
+ "id": "title",
87
+ "label": {
88
+ "en-US": "Heading",
89
+ "zh-CN": "标题"
90
+ },
91
+ "default": "Blog",
92
+ "placeholder": "Blog"
93
+ },
94
+ {
95
+ "type": "range",
96
+ "label": {
97
+ "zh-CN": "博客显示数量",
98
+ "en-US": "Show blog posts"
99
+ },
100
+ "id": "size",
101
+ "min": 1,
102
+ "max": 8,
103
+ "step": 1,
104
+ "default": 8
105
+ },
106
+ {
107
+ "type": "blog",
108
+ "id": "blog",
109
+ "label": {
110
+ "en-US": "Blog posts",
111
+ "zh-CN": "博客专辑"
112
+ }
113
+ }
114
+ ],
115
+ "blocks": [],
116
+ "presets": [
117
+ {
118
+ "name": "blog",
119
+ "cname": {
120
+ "zh-CN": "博客专辑",
121
+ "en-US": "Blogs"
122
+ },
123
+ "category": {
124
+ "en-US": "Material",
125
+ "zh-CN": "素材"
126
+ },
127
+ "ccategory": {
128
+ "en-US": "Material",
129
+ "zh-CN": "素材"
130
+ },
131
+ "display": true,
132
+ "blocks": [],
133
+ "icon": "oss/operation/a2a64b5c6aed6f57a53dcf82935520ae.svg"
134
+ }
135
+ ]
136
+ }
137
+ {% endschema %}
@@ -0,0 +1,34 @@
1
+ {% if collection.description %}
2
+ <div class="container container-gap collection__container">
3
+ <div class="row">
4
+ <div class="collection__desc col-12 dj-mce-view">{{collection.description}}</div>
5
+ </div>
6
+ </div>
7
+ {% endif %}
8
+
9
+ {% schema %}
10
+ {
11
+ "name": "collection_desc",
12
+ "templates": ["collection"],
13
+ "limit": 1,
14
+ "settings": [],
15
+ "presets": [
16
+ {
17
+ "name": "collection_desc",
18
+ "cname": {
19
+ "en-US": "Collection description",
20
+ "zh-CN": "专辑描述"
21
+ },
22
+ "category": {
23
+ "en-US": "Page",
24
+ "zh-CN": "页面"
25
+ },
26
+ "ccategory": {
27
+ "en-US": "Page",
28
+ "zh-CN": "页面"
29
+ },
30
+ "display": true
31
+ }
32
+ ]
33
+ }
34
+ {% endschema %}
@@ -0,0 +1,436 @@
1
+ {% use 'collection_detail.css' %}
2
+ {% assign limit = section.settings.limit | default: 40 %}
3
+ {% if section.settings.is_pagination_show == nil %}
4
+ {% assign is_pagination_show = false %}
5
+ {% else %}
6
+ {% assign is_pagination_show = section.settings.is_pagination_show %}
7
+ {% endif %}
8
+
9
+ {% paginate collection.products by limit %}
10
+
11
+ <div class="container container-gap collection__container">
12
+ {% comment %} 专辑商品列表 {% endcomment %}
13
+ <div class="row">
14
+ {% assign content_col = 'col-12 col-md-12' %}
15
+ {% assign product_col = 'col-6 col-md-3' %}
16
+ {% if section.settings.filter %}
17
+ {% include 'collection_filter_modal' %}
18
+ {% endif %}
19
+ <div class="{{content_col}}">
20
+ {% comment %} 排序部分 {% endcomment %}
21
+ <div class="collection__sort d-flex align-items-center justify-content-between" style="flex-wrap:wrap;">
22
+ <span class="collection__number">{{ 'i18n.collection.collection_detail.products' | t: count: collection.products_count }}</span>
23
+ {% if section.settings.sort or section.settings.sort == nil %}
24
+ {% assign show_sort = true %}
25
+ {% endif %}
26
+ <div class="d-flex justify-content-between collection__filter-buttons {% if section.settings.filter %}collection__filter-buttons_has-filter{% endif %}">
27
+ {% if section.settings.filter %}
28
+ <button
29
+ class="d-md-none form-control btn btn-primary collection__filter-by"
30
+ {% if show_sort %}
31
+ style="margin-right: 8px;"
32
+ {% endif %}>
33
+ {{ 'i18n.collection.collection_detail.filter_by' | t }}
34
+ </button>
35
+ {% endif %}
36
+ {% if show_sort %}
37
+ <span class="collection__sort-select d-flex align-items-center" style="margin-left: 8px;">
38
+ {% if collection.products_count > 0 %}
39
+ {% assign recomend = 'i18n.collection.collection_detail.recommend' | t %}
40
+ {% assign low_to_high = 'i18n.collection.collection_detail.low_to_high' | t %}
41
+ {% assign high_to_low = 'i18n.collection.collection_detail.high_to_low' | t %}
42
+ {% assign best_selling = 'i18n.collection.collection_detail.best_selling' | t %}
43
+ {% assign newest = 'i18n.collection.collection_detail.newest' | t %}
44
+ {% assign sales_descending = 'i18n.collection.collection_detail.sales_descending' | t %}
45
+ {% assign add_to_cart_count_descending = 'i18n.collection.collection_detail.add_to_cart_count_descending' | t %}
46
+ {% assign views_descending = 'i18n.collection.collection_detail.views_descending' | t %}
47
+
48
+ {% assign manual = "@manual|" %}
49
+ {% assign price_ascending = "@price-ascending|" %}
50
+ {% assign price_descending = "@price-descending|" %}
51
+ {% assign best_selling_tag = "@best-selling|" %}
52
+ {% assign published_descending = "@published-descending|" %}
53
+ {% assign sales_descending_value = '@best-selling|' %}
54
+ {% assign add_to_cart_count_descending_value = '@add_to_cart_count|' %}
55
+ {% assign views_descending_value = '@views' %}
56
+ {% comment %} {% assign options = recomend | append: manual | append: low_to_high | append: price_ascending | append: high_to_low | append: price_descending | append: best_selling | append: best_selling_tag | append: newest | append: published_descending | append: sales_descending | append: sales_descending_value | append: add_to_cart_count_descending_value | append: add_to_cart_count_descending | append: views_descending_value | append: views_descending %} {% endcomment %}
57
+ {% assign options = recomend | append: manual | append: low_to_high | append: price_ascending | append: high_to_low | append: price_descending | append: newest | append: published_descending | append: sales_descending | append: sales_descending_value | append: add_to_cart_count_descending | append: add_to_cart_count_descending_value | append: views_descending | append: views_descending_value %}
58
+ <span class="d-none d-md-block collection__sort-label" style="margin-right: 16px;">{{ 'i18n.collection.collection_detail.sort_by' | t }}</span>
59
+ {% assign price = product.price %}
60
+ {% assign compareAtPrice = product.compare_at_price %}
61
+ {% assign title = product.title %}
62
+ {% assign id = product.id %}
63
+ {% assign type = product.type %}
64
+ {% assign option = options | split: "|" %}
65
+ <span class="common__select">
66
+ <select class ="form-control">
67
+ {% for item in option %}
68
+ {% assign i = item | split: "@" %}
69
+ <option value="{{i[1]}}">{{i[0]}}</option>
70
+ {% endfor %}
71
+ </select>
72
+ </span>
73
+ {% javascript %}
74
+ $(function () {
75
+ var dom = $('[data-section-id={{section.id}}] .common__select');
76
+ dom.find('select').change(function () {
77
+ var select = dom.find('option:selected');
78
+ $(document).trigger('dj.common.sort_select.change', {
79
+ value: select.val(),
80
+ name: select.text(),
81
+ sectionId: '{{section.id}}'
82
+ })
83
+ })
84
+ })
85
+ {% endjavascript %}
86
+ {% endif %}
87
+ </span>
88
+ {% endif %}
89
+ </div>
90
+ </div>
91
+ <div class="row collection-product__wrapper" data-top-products-flag="enabled">
92
+ {% comment %} 置顶商品 {% endcomment %}
93
+ {% assign top_product_ids = "" %}
94
+ {% assign has_valid_top_product = false %}
95
+ {% assign params = REQUEST_URI | split: "?" | last | split: "&" %}
96
+ {% for p in params %}
97
+ {% assign pair = p | split: "=" %}
98
+ {% if pair[0] == "page" and pair[1] != "1" and REQUEST_URI contains 'show_page=first_page' %}
99
+ {% assign top_product_ids = "" %}
100
+ {% break %}
101
+ {% endif %}
102
+ {% if pair[0] == "ids" and pair[1] != '' %}
103
+ {% assign top_product_ids = pair[1] %}
104
+ {% endif %}
105
+ {% endfor %}
106
+
107
+
108
+ {% if top_product_ids != "" %}
109
+ {% assign top_product_ids_arr = top_product_ids | url_decode | split: "," %}
110
+ {% for product_id in top_product_ids_arr %}
111
+ {% if product_id != "" %}
112
+ {% assign product = all_products[product_id] %}
113
+ {% if product.published %}
114
+ {% assign has_valid_top_product = true %}
115
+ <div class="{{product_col}} common__product-gap top-product">
116
+ {% include 'product', product: product %}
117
+ </div>
118
+ {% endif %}
119
+ {% endif %}
120
+ {% endfor %}
121
+ {% endif %}
122
+
123
+ {% for product in collection.products %}
124
+ {% if product.published %}
125
+ {% unless top_product_ids contains product.id %}
126
+ <div class="{{product_col}} common__product-gap">
127
+ {% include 'product', product: product %}
128
+ </div>
129
+ {% endunless %}
130
+ {% endif %}
131
+ {% endfor %}
132
+ {% comment %} 列表空 {% endcomment %}
133
+ {% if collection.products_count == 0 and has_valid_top_product != true %}
134
+ <div class="col-12 text-center collection__none">{{ 'i18n.collection.collection_detail.coming_soon' | t }}</div>
135
+ <div class="col-12 text-center collection__none-btn"><a href="/" class="btn btn-primary col-12">{{ 'i18n.collection.collection_detail.continue_shopping' | t }}</a></div>
136
+ {% endif %}
137
+ </div>
138
+ </div>
139
+ </div>
140
+ {% comment %} 加载更多 {% endcomment %}
141
+ {% comment %} 分页 {% endcomment %}
142
+ {% if is_pagination_show and collection.products_count != 0 %}
143
+ <div class="row collection__pagination">
144
+ <div id="pagination" class="col-12"></div>
145
+ </div>
146
+ {% endif %}
147
+ </div>
148
+
149
+ {% comment %} 定义前端模板 {% endcomment %}
150
+ <script id="collection-art-tpl" type="text/html">
151
+ <% var col = 'col-6 col-md-3' %>
152
+ <% if (filter == 'true') { %>
153
+ <% col = 'col-6 col-md-4' %>
154
+ <% } %>
155
+ <% for(var i = 0; i < products.length; i++) { %>
156
+ <div class="<%= col %> common__product-gap">
157
+ <% include ('product_art_tpl', {
158
+ product: products[i]
159
+ }) %>
160
+ </div>
161
+ <% } %>
162
+ </script>
163
+ {% comment %} 定义搜索结果空模板 {% endcomment %}
164
+ <script id="collection-empty-art-tpl" type="text/html">
165
+ <div style="margin: 100px auto;color: #999;font-size: 14px;" class="collection-empty-art-tpl">{{ 'i18n.collection.collection_detail.no_result' | t }}</div>
166
+ </script>
167
+ {% include 'pagination' %}
168
+ {% javascript %}
169
+
170
+ $(function () {
171
+ $.collectionDetail && $.collectionDetail({
172
+ filter: '{{section.settings.filter}}',
173
+ id: '{{ section.id }}',
174
+ env: '{{ shop.env }}',
175
+ collection_id: '{{ collection.id }}',
176
+ lang: {{ 'i18n.collection.collection_detail' | t | json }},
177
+ products_count: {{ collection.products_count }},
178
+ is_pagination_show: {{ is_pagination_show }},
179
+ limit: {{ limit }},
180
+ current_tags:{{ current_tags | json }},
181
+ current_page: {{ paginate.current_page }},
182
+ pages: {{ paginate.pages }},
183
+ handle: "{{ collection.handle }}"
184
+ });
185
+ })
186
+ {% endjavascript %}
187
+
188
+ {% endpaginate %}
189
+
190
+ {% schema %}
191
+ {
192
+ "name": "collection_detail",
193
+ "templates": ["collection"],
194
+ "limit": 1,
195
+ "contentType": [
196
+ "collection"
197
+ ],
198
+ "max_blocks": 10,
199
+ "settings": [
200
+ {
201
+ "type": "select",
202
+ "id": "limit",
203
+ "label": {
204
+ "zh-CN": "每页商品数",
205
+ "en-US": "Number of products per page"
206
+ },
207
+ "default": 48,
208
+ "options": [
209
+ {
210
+ "value": 8,
211
+ "label": "8"
212
+ },
213
+ {
214
+ "value": 12,
215
+ "label": "12"
216
+ },
217
+ {
218
+ "value": 16,
219
+ "label": "16"
220
+ },
221
+ {
222
+ "value": 24,
223
+ "label": "24"
224
+ },
225
+ {
226
+ "value": 40,
227
+ "label": "40"
228
+ },
229
+ {
230
+ "value": 48,
231
+ "label": "48"
232
+ },
233
+ {
234
+ "value": 60,
235
+ "label": "60"
236
+ },
237
+ {
238
+ "value": 72,
239
+ "label": "72"
240
+ },
241
+ {
242
+ "value": 80,
243
+ "label": "80"
244
+ },
245
+ {
246
+ "value": 84,
247
+ "label": "84"
248
+ }
249
+ ]
250
+ },
251
+ {
252
+ "type": "checkbox",
253
+ "id": "is_pagination_show",
254
+ "label": {
255
+ "en-US": "Pagination",
256
+ "zh-CN": "分页"
257
+ },
258
+ "desc": {
259
+ "zh-CN": "开启后将会展示在PC端列表底部",
260
+ "en-US": "It will be displayed on the bottom of the desktop list after being activated"
261
+ },
262
+ "default": false
263
+ },
264
+ {
265
+ "type": "checkbox",
266
+ "id": "sort",
267
+ "label": {
268
+ "zh-CN": "开启排序",
269
+ "en-US": "Show Sort by"
270
+ },
271
+ "default": true
272
+ },
273
+ {
274
+ "type": "checkbox",
275
+ "id": "filter",
276
+ "label": {
277
+ "en-US": "Enable filter",
278
+ "zh-CN": "开启筛选"
279
+ },
280
+ "default": false
281
+ },
282
+ {
283
+ "content": {
284
+ "zh-CN": "筛选维度",
285
+ "en-US": "Filter dimension"
286
+ },
287
+ "type": "header"
288
+ }
289
+ ],
290
+ "blocks": [
291
+ {
292
+ "type": "@app"
293
+ },
294
+ {
295
+ "type": "tag_filter",
296
+ "name": {
297
+ "zh-CN": "标签筛选",
298
+ "en-US": "Label"
299
+ },
300
+ "info": {
301
+ "zh-CN": "商品标签可在后台<a href='/admin/products' style='text-decoration: underline;' target='_blank'>商品管理</a>模块设置",
302
+ "en-US": "Product tags can be setted up at product module"
303
+ },
304
+ "settings": [
305
+ {
306
+ "type": "text",
307
+ "id": "title",
308
+ "label": {
309
+ "en-US": "Heading",
310
+ "zh-CN": "标题"
311
+ },
312
+ "default": "Tags",
313
+ "placeholder": {
314
+ "zh-CN": "输入标题",
315
+ "en-US": "Input heading"
316
+ }
317
+ },
318
+ {
319
+ "type": "checkbox",
320
+ "id": "is_all_tags_show",
321
+ "label": {
322
+ "en-US": "Show all tags",
323
+ "zh-CN": "显示所有标签"
324
+ },
325
+ "info": {
326
+ "zh-CN": "自动隐藏筛选结果为空的标签",
327
+ "en-US": "Automatically hides tags with empty filter results"
328
+ },
329
+ "default": true
330
+ },
331
+ {
332
+ "type": "text",
333
+ "id": "tags",
334
+ "label": {
335
+ "zh-CN": "显示部分标签",
336
+ "en-US": "Show partial tags"
337
+ },
338
+ "info": {
339
+ "zh-CN": "仅当“显示所有标签”关闭时,才会显示此处设置的标签,多个标签以英文逗号隔开。",
340
+ "en-US": "The tags setted will be displayed only when 'Show all tags' is disabled. Multiple tags are separated by commas."
341
+ },
342
+ "placeholder": {
343
+ "zh-CN": "示例:Tag1,Tag2,Tag3",
344
+ "en-US": "Example:Tag1,Tag2,Tag3"
345
+ }
346
+ }
347
+ ]
348
+ },
349
+ {
350
+ "type": "price_filter",
351
+ "name": {
352
+ "zh-CN": "价格筛选",
353
+ "en-US": "Price"
354
+ },
355
+ "limit": 1,
356
+ "settings": [
357
+ {
358
+ "type": "text",
359
+ "id": "title",
360
+ "label": {
361
+ "en-US": "Heading",
362
+ "zh-CN": "标题"
363
+ },
364
+ "default": "Price",
365
+ "placeholder": {
366
+ "zh-CN": "输入标题",
367
+ "en-US": "Input heading"
368
+ }
369
+ },
370
+ {
371
+ "type": "text",
372
+ "id": "tags",
373
+ "label": {
374
+ "en-US": "Price ranges",
375
+ "zh-CN": "价格区间的边界值"
376
+ },
377
+ "info": {
378
+ "zh-CN": "设置不同价格区间的边界值,多个值以英文逗号隔开。ps. 货币单位取店铺的结算货币。",
379
+ "en-US": "Set the boundary values of different price ranges, separated by commas. eg. Unit of currency adopt the settlement currency of the store."
380
+ },
381
+ "default": "0,50,100",
382
+ "placeholder": {
383
+ "zh-CN": "示例:0,50,100",
384
+ "en-US": "Example:0,50,100"
385
+ }
386
+ },
387
+ {
388
+ "type": "checkbox",
389
+ "id": "is_last_price_show",
390
+ "label": {
391
+ "en-US": "Show the last price range",
392
+ "zh-CN": "显示最后一个价格区间"
393
+ },
394
+ "default": true
395
+ }
396
+ ]
397
+ }
398
+ ],
399
+ "presets": [
400
+ {
401
+ "name": "collection_detail",
402
+ "cname": {
403
+ "zh-CN": "专辑详情",
404
+ "en-US": "Collection pages"
405
+ },
406
+ "category": {
407
+ "en-US": "Page",
408
+ "zh-CN": "页面"
409
+ },
410
+ "ccategory": {
411
+ "en-US": "Page",
412
+ "zh-CN": "页面"
413
+ },
414
+ "display": true,
415
+ "blocks": [
416
+ {
417
+ "type": "tag_filter",
418
+ "settings": {
419
+ "title": "Color",
420
+ "is_all_tags_show": true,
421
+ "tags": "red,yellow,blue"
422
+ }
423
+ },
424
+ {
425
+ "type": "price_filter",
426
+ "settings": {
427
+ "title": "Price",
428
+ "is_last_price_show": true,
429
+ "tags": "0,50,100"
430
+ }
431
+ }
432
+ ]
433
+ }
434
+ ]
435
+ }
436
+ {% endschema %}