Skip to content

Commit d4cfff7

Browse files
committed
Remove zoom and badge code
1 parent 09f72f7 commit d4cfff7

File tree

4 files changed

+33
-57
lines changed

4 files changed

+33
-57
lines changed

blocks/product-list-page/product-list-page.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import { fetchPlaceholders, getProductLink } from '../../scripts/commerce.js';
2222
import '../../scripts/initializers/search.js';
2323
import '../../scripts/initializers/wishlist.js';
2424

25-
let useZoomViewer = false;
26-
let useProductBadges = false;
25+
// let useZoomViewer = false;
26+
// let useProductBadges = false;
2727

2828
export default async function decorate(block) {
2929
const labels = await fetchPlaceholders();
@@ -74,8 +74,8 @@ export default async function decorate(block) {
7474
const $productList = fragment.querySelector('.search__product-list');
7575
const $pagination = fragment.querySelector('.search__pagination');
7676

77-
useZoomViewer = config.zoom || 'false';
78-
useProductBadges = config.badges || 'false';
77+
// useZoomViewer = config.zoom || 'false';
78+
// useProductBadges = config.badges || 'false';
7979

8080
//block.innerHTML = '';
8181
block.appendChild(fragment);
@@ -102,7 +102,7 @@ export default async function decorate(block) {
102102
}).catch(() => console.error('Error searching for products'));
103103
} else {
104104
await search({
105-
phrase: q || config.searchterm || '',
105+
phrase: q || config.searchTerm || '',
106106
currentPage: page ? Number(page) : 1,
107107
pageSize: 8,
108108
sort: getSortFromParams(sort),
@@ -300,30 +300,30 @@ function insertPromo(block, promosData) {
300300
let resultList = block.querySelector('.product-discovery-product-list__grid');
301301
resultList.querySelectorAll('.dropin-product-item-card.promo-card').forEach((el) => el.remove());
302302

303-
if (useProductBadges === 'true') {
304-
fetch('/extras/badges.json').then((badges) => {
305-
badges.json().then((bd) => {
306-
resultList.querySelectorAll('.dropin-product-item-card').forEach((el) => {
307-
if (el.classList.contains('promo-card')) return;
308-
const anchor = el.querySelector('.dropin-product-item-card__title a');
309-
const href = anchor?.href;
310-
const card = bd.data.find((bdge) => href.includes(bdge.url));
311-
if (card) {
312-
const badge = document.createElement('div');
313-
badge.className = 'dropin-product-item-card__badge';
314-
badge.innerHTML = card?.badge;
315-
el.append(badge);
316-
}
317-
});
318-
});
319-
});
320-
}
321-
322-
if (useZoomViewer === 'true') {
323-
resultList.querySelectorAll('.dropin-product-item-card__image').forEach((el) => {
324-
el.classList.add('zoom');
325-
});
326-
}
303+
// if (useProductBadges === 'true') {
304+
// fetch('/extras/badges.json').then((badges) => {
305+
// badges.json().then((bd) => {
306+
// resultList.querySelectorAll('.dropin-product-item-card').forEach((el) => {
307+
// if (el.classList.contains('promo-card')) return;
308+
// const anchor = el.querySelector('.dropin-product-item-card__title a');
309+
// const href = anchor?.href;
310+
// const card = bd.data.find((bdge) => href.includes(bdge.url));
311+
// if (card) {
312+
// const badge = document.createElement('div');
313+
// badge.className = 'dropin-product-item-card__badge';
314+
// badge.innerHTML = card?.badge;
315+
// el.append(badge);
316+
// }
317+
// });
318+
// });
319+
// });
320+
// }
321+
322+
// if (useZoomViewer === 'true') {
323+
// resultList.querySelectorAll('.dropin-product-item-card__image').forEach((el) => {
324+
// el.classList.add('zoom');
325+
// });
326+
// }
327327

328328
if (!resultList) return;
329329

component-definition.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@
283283
"selector": "div:nth-child(1)>div:nth-child(2)>p:nth-child(1)"
284284
},
285285
{
286-
"name": "searchterm",
286+
"name": "searchTerm",
287287
"selector": "div:nth-child(2)>div:nth-child(2)>p:nth-child(1)"
288288
},
289289
{

component-models.json

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -263,21 +263,9 @@
263263
{
264264
"component": "text",
265265
"valueType": "string",
266-
"name": "searchterm",
266+
"name": "searchTerm",
267267
"label": "Search Term",
268268
"value": ""
269-
},
270-
{
271-
"component": "boolean",
272-
"label": "Zoom Product Image on Hover",
273-
"name": "zoom",
274-
"valueType": "boolean"
275-
},
276-
{
277-
"component": "boolean",
278-
"label": "Use Product Badges",
279-
"name": "badges",
280-
"valueType": "boolean"
281269
}
282270
]
283271
},

ue/models/blocks/product-list-page.json

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"columns": 2,
1111
"fields": [
1212
{ "name": "category", "selector": "div:nth-child(1)>div:nth-child(2)>p:nth-child(1)" },
13-
{ "name": "searchterm", "selector": "div:nth-child(2)>div:nth-child(2)>p:nth-child(1)" },
13+
{ "name": "searchTerm", "selector": "div:nth-child(2)>div:nth-child(2)>p:nth-child(1)" },
1414
{ "name": "zoom", "selector": "div:nth-child(3)>div:nth-child(2)>p:nth-child(1)" },
1515
{ "name": "badges", "selector": "div:nth-child(4)>div:nth-child(2)>p:nth-child(1)" }
1616
]
@@ -32,21 +32,9 @@
3232
{
3333
"component": "text",
3434
"valueType": "string",
35-
"name": "searchterm",
35+
"name": "searchTerm",
3636
"label": "Search Term",
3737
"value": ""
38-
},
39-
{
40-
"component": "boolean",
41-
"label": "Zoom Product Image on Hover",
42-
"name": "zoom",
43-
"valueType": "boolean"
44-
},
45-
{
46-
"component": "boolean",
47-
"label": "Use Product Badges",
48-
"name": "badges",
49-
"valueType": "boolean"
5038
}
5139
]
5240
}

0 commit comments

Comments
 (0)