diff --git a/@ecomplus/storefront-template/template/pages/@/sections/collection-shelf.ejs b/@ecomplus/storefront-template/template/pages/@/sections/collection-shelf.ejs index fe5a3c5ac..acd43a6aa 100644 --- a/@ecomplus/storefront-template/template/pages/@/sections/collection-shelf.ejs +++ b/@ecomplus/storefront-template/template/pages/@/sections/collection-shelf.ejs @@ -1,29 +1,24 @@ -
- <% - if (opt.collection_id) { - const res = await _.ecomClient.store({ - url: `/collections/${opt.collection_id}.json` - }) - const collection = res.data - let items = [] - if (Array.isArray(collection.products) && collection.products.length) { - const search = new _.EcomSearch() - await search.setProductIds(collection.products).fetch() - items = search.getItems() - } - const { title, link } = opt - - %> - <%- await include('/@/sections/inc/products-carousel', { - _, opt: { items, collection, title, link } - }) %> - <% - } else { - %> - <%- await include('/@/sections/inc/products-carousel', { - _, opt: { items: _.items } - }) %> - <% +<% +const { title, link, shuffle } = opt +let items, collection +if (opt.collection_id) { + const res = await _.ecomClient.store({ + url: `/collections/${opt.collection_id}.json` + }) + collection = res.data + items = [] + if (Array.isArray(collection.products) && collection.products.length) { + const search = new _.EcomSearch() + await search.setProductIds(collection.products).fetch() + items = search.getItems() } - %> +} else { + items = _.items +} +%> + +
+ <%- await include('/@/sections/inc/products-carousel', { + _, opt: { items, collection, title, link, shuffle } + }) %>
diff --git a/@ecomplus/storefront-template/template/pages/@/sections/custom-content.ejs b/@ecomplus/storefront-template/template/pages/@/sections/custom-content.ejs new file mode 100644 index 000000000..38c91d510 --- /dev/null +++ b/@ecomplus/storefront-template/template/pages/@/sections/custom-content.ejs @@ -0,0 +1,3 @@ +
+ <%- await include('/@/sections/inc/md-content') %> +
diff --git a/@ecomplus/storefront-template/template/pages/@/sections/custom-html.ejs b/@ecomplus/storefront-template/template/pages/@/sections/custom-html.ejs new file mode 100644 index 000000000..1a1c78315 --- /dev/null +++ b/@ecomplus/storefront-template/template/pages/@/sections/custom-html.ejs @@ -0,0 +1,9 @@ +<% if (typeof opt.html === 'string') { %> +
+
+
+ <%- opt.html %> +
+
+
+<% } %> diff --git a/@ecomplus/storefront-template/template/pages/@/sections/inc/banner.ejs b/@ecomplus/storefront-template/template/pages/@/sections/inc/banner.ejs index e62f046dc..247adbb70 100644 --- a/@ecomplus/storefront-template/template/pages/@/sections/inc/banner.ejs +++ b/@ecomplus/storefront-template/template/pages/@/sections/inc/banner.ejs @@ -1,7 +1,22 @@ +<% +let dimensions +if (opt.img.startsWith('/')) { + try { + dimensions = _.imageSize(`template/public${opt.img}`) + } catch (e) { + dimensions = null + } +} +%> +