Skip to content

Commit 1a203de

Browse files
committed
Squashed 'template/pages/' changes from 15fcdfa..b332d1e
b332d1e Update with @ecomplus/storefront-template v2.0.0-beta.167 git-subtree-dir: template/pages git-subtree-split: b332d1e7fafdde46fa09083497d5489d98a0a084
1 parent ee090d9 commit 1a203de

File tree

2 files changed

+39
-29
lines changed

2 files changed

+39
-29
lines changed

@/layout/header.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,10 +274,10 @@ const hasMegamenu = header.desktop_megamenu
274274
<nav class="header__submenu" id="<%= `s-${slug.replace(/\//g, '_')}` %>">
275275
<% subcategories.forEach(subcategory => { %>
276276
<div>
277-
<a href="<%= subcategory.slug %>"><%= subcategory.name %></a>
277+
<a href="/<%= subcategory.slug %>"><%= subcategory.name %></a>
278278
<% const thirdCategories = _.categories.filter(({ parent }) => parent && parent.slug === subcategory.slug) %>
279279
<% thirdCategories.forEach(thirdCategory => { %>
280-
<a class="header__submenu-subcategory" href="<%= thirdCategory.slug %>">
280+
<a class="header__submenu-subcategory" href="/<%= thirdCategory.slug %>">
281281
<%= thirdCategory.name %>
282282
</a>
283283
<% }) %>

@/sections/offers-timer.ejs

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
11
<%
22
if (Array.isArray(opt.offers) && opt.offers.length) {
33
const search = new _.EcomSearch()
4-
await search.setProductIds(opt.offers).fetch(true)
5-
const items = search.getItems().filter(item => _.ecomUtils.inStock(item))
6-
%>
4+
let items
5+
try {
6+
await search.setProductIds(opt.offers).fetch(true)
7+
items = search.getItems().filter(item => _.ecomUtils.inStock(item))
8+
} catch (err) {
9+
console.error(err)
10+
items = []
11+
}
712
8-
<section class="offers-timer my-4 my-lg-5">
9-
<div class="container">
10-
<div class="row">
11-
<div
12-
<% if (items.length <= 3) { %>
13-
class="col-12 col-md-<%= (7 - items.length) %>"
14-
<% } else { %>
15-
class="col-12 col-lg-3"
16-
<% } %>
17-
>
18-
<%- await include('@/sections/inc/timer', { _, opt }) %>
19-
</div>
20-
21-
<div class="col-12 col-md">
22-
<div class="row">
23-
<% for (let i = 0; i < items.length; i++) { %>
24-
<div class="col-6 col-md">
25-
<%- await include('@/sections/inc/product-item', {
26-
_, opt: { item: items[i] }
27-
}) %>
28-
</div>
13+
if (items.length) {
14+
%>
15+
<section class="offers-timer my-4 my-lg-5">
16+
<div class="container">
17+
<div class="row">
18+
<div
19+
<% if (items.length <= 3) { %>
20+
class="col-12 col-md-<%= (7 - items.length) %>"
21+
<% } else { %>
22+
class="col-12 col-lg-3"
2923
<% } %>
24+
>
25+
<%- await include('@/sections/inc/timer', { _, opt }) %>
26+
</div>
27+
28+
<div class="col-12 col-md">
29+
<div class="row">
30+
<% for (let i = 0; i < items.length; i++) { %>
31+
<div class="col-6 col-md">
32+
<%- await include('@/sections/inc/product-item', {
33+
_, opt: { item: items[i] }
34+
}) %>
35+
</div>
36+
<% } %>
37+
</div>
3038
</div>
3139
</div>
3240
</div>
33-
</div>
34-
</section>
35-
<% } %>
41+
</section>
42+
<%
43+
}
44+
}
45+
%>

0 commit comments

Comments
 (0)