Skip to content

Commit b7a744c

Browse files
committed
Integrating Adobe Commerce Category Display Mode Configuration with PWA Frontend Category Pages
1 parent 8fce578 commit b7a744c

File tree

5 files changed

+68
-589
lines changed

5 files changed

+68
-589
lines changed

packages/peregrine/lib/talons/RootComponents/Category/__tests__/__snapshots__/useCategoryContent.spec.js.snap

+4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ exports[`useCategoryContent tests handles no data prop 1`] = `
44
Object {
55
"availableSortMethods": null,
66
"categoryDescription": "Jewelry category",
7+
"categoryDisplayMode": undefined,
78
"categoryName": "Jewelry",
9+
"cmsBlockContent": undefined,
810
"filterOptions": undefined,
911
"filters": null,
1012
"items": Array [
@@ -33,7 +35,9 @@ Object {
3335
},
3436
],
3537
"categoryDescription": "Jewelry category",
38+
"categoryDisplayMode": undefined,
3639
"categoryName": "Jewelry",
40+
"cmsBlockContent": undefined,
3741
"filterOptions": undefined,
3842
"filters": Array [
3943
Object {

packages/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export const GET_CATEGORY_CONTENT = gql`
2727
description
2828
url_key
2929
url_path
30+
display_mode
31+
cms_block {
32+
content
33+
}
3034
}
3135
}
3236
}

packages/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,14 @@ export const useCategoryContent = props => {
196196
const availableSortMethods = sortData
197197
? sortData.products.sort_fields.options
198198
: null;
199+
const categoryDisplayMode =
200+
categoryData && categoryData.categories.items.length
201+
? categoryData.categories.items[0].display_mode
202+
: null;
203+
const cmsBlockContent =
204+
categoryData && categoryData.categories.items.length
205+
? categoryData.categories.items[0].cms_block?.content
206+
: null;
199207

200208
useEffect(() => {
201209
if (!categoryLoading && categoryData?.categories.items.length > 0) {
@@ -220,6 +228,8 @@ export const useCategoryContent = props => {
220228
setFilterOptions,
221229
items,
222230
totalCount,
223-
totalPagesFromData
231+
totalPagesFromData,
232+
categoryDisplayMode,
233+
cmsBlockContent
224234
};
225235
};

0 commit comments

Comments
 (0)