Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
sujata
/
Akruti-Frontend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Registry
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit e220abc6
authored
2026-04-14 17:10:48 +0530
by
Ravindra Kanojiya
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
updated slug same name
1 parent
44372be9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
103 deletions
pages/collections/[category]/[subCategory]/[productSlug].js
services/collectionDetailCategoryApi.js
pages/collections/[category]/[subCategory]/[productSlug].js
View file @
e220abc
...
...
@@ -37,15 +37,15 @@ const ProductPage = ({ productData, cataloguesData }) => {
{
href
:
"/"
,
label
:
"Collections"
},
{
href
:
`/collections/
${
category
}
`
,
label
:
category
.
replace
(
/-/g
,
" "
)
,
label
:
category
?.
replace
(
/-/g
,
" "
)
||
""
,
},
{
href
:
`/collections/
${
category
}
/
${
subCategoryData
.
slug
}
`
,
label
:
subCategoryData
.
title
,
href
:
`/collections/
${
category
}
/
${
subCategoryData
?.
slug
??
subCategorySlug
??
""
}
`,
label: subCategoryData
?.title ?? subCategorySlug?.replace(/-/g, " ") ?? ""
,
},
{
href: router.asPath,
label
:
productData
.
title
,
label: productData
?.title ?? ""
,
},
];
...
...
@@ -129,9 +129,9 @@ export default ProductPage;
/* ---------- SSR ---------- */
export async function getServerSideProps({ params }) {
try {
const
{
productSlug
}
=
params
;
const { productSlug
, subCategory
} = params;
const
productData
=
await
getCollectionDetailCategoryData
(
productSlug
);
const productData = await getCollectionDetailCategoryData(productSlug
, subCategory
);
const cataloguesData = await getCataloguesBySlug();
if (!productData || productData.length === 0) {
...
...
services/collectionDetailCategoryApi.js
View file @
e220abc
import
{
fetchFromStrapi
}
from
"./api"
;
export
async
function
getCollectionDetailCategoryData
(
productSlug
)
{
try
{
const
query
=
{
filters
:
{
slug
:
{
$eq
:
productSlug
,
const
POPULATE
=
{
image
:
true
,
collection_sub_category
:
{
populate
:
true
,
},
gallery
:
{
populate
:
{
image
:
true
,
},
},
aboutInfo
:
{
populate
:
true
,
},
video
:
{
populate
:
{
video
:
true
,
},
},
exploreProducts
:
{
populate
:
{
item
:
{
populate
:
{
image
:
true
,
},
},
populate
:
{
image
:
true
,
// isDoorAndPartitionsLayouts:true,
collection_sub_category
:
{
populate
:
true
,
},
gallery
:
{
populate
:
{
image
:
true
,
},
}
,
productTabs
:
{
populate
:
{
companyOverview
:
{
populate
:
{
items
:
{
populate
:
{
image
:
true
,
}
,
},
},
aboutInfo
:
{
populate
:
true
,
},
videoSection
:
{
populate
:
{
video
:
true
,
},
video
:
{
populate
:
{
video
:
true
,
},
},
aboutInfo
:
true
,
technicalDetails
:
{
populate
:
{
image
:
true
,
details
:
true
,
},
exploreProducts
:
{
populate
:
{
item
:
{
populate
:
{
image
:
true
,
},
},
},
},
gallery
:
{
populate
:
{
image
:
true
,
},
productTabs
:
{
populate
:
{
companyOverview
:
{
populate
:
{
items
:
{
populate
:
{
image
:
true
,
},
},
},
},
videoSection
:
{
populate
:
{
video
:
true
,
},
},
aboutInfo
:
true
,
technicalDetails
:
{
populate
:
{
image
:
true
,
details
:
true
,
},
},
gallery
:
{
populate
:
{
image
:
true
,
},
},
},
},
},
},
aboutInfoStone
:
{
populate
:
{
aboutInfo
:
{
populate
:
"*"
},
detailsItem
:
{
populate
:
"*"
},
aboutInfoTwo
:
{
populate
:
"*"
},
detailsItemTwo
:
{
populate
:
"*"
},
bottomInfo
:
{
populate
:
"*"
},
video
:
{
populate
:
"*"
},
gallery
:
{
populate
:
{
image
:
true
,
},
aboutInfoStone
:
{
populate
:
{
aboutInfo
:
{
populate
:
"*"
,
},
detailsItem
:
{
populate
:
"*"
,
},
aboutInfoTwo
:
{
populate
:
"*"
,
},
detailsItemTwo
:
{
populate
:
"*"
,
},
bottomInfo
:
{
populate
:
"*"
,
},
video
:
{
populate
:
"*"
,
},
gallery
:
{
populate
:
{
image
:
true
,
},
},
},
},
},
};
export
async
function
getCollectionDetailCategoryData
(
productSlug
,
subCategorySlug
)
{
try
{
if
(
subCategorySlug
)
{
const
scopedQuery
=
{
filters
:
{
slug
:
{
$eq
:
productSlug
},
collection_sub_category
:
{
slug
:
{
$eq
:
subCategorySlug
},
},
},
populate
:
POPULATE
,
};
const
scopedResponse
=
await
fetchFromStrapi
(
"/api/collection-detail-categories"
,
scopedQuery
,
);
// productTabs:{
// populate: "*",
if
(
scopedResponse
?.
data
?.
length
>
0
)
{
return
scopedResponse
.
data
;
}
}
// },
// technicalDetails:{
// populate:"*"
// },
// explore:{
// populate:"*"
// }
const
fallbackQuery
=
{
filters
:
{
slug
:
{
$eq
:
productSlug
},
},
populate
:
POPULATE
,
};
const
r
esponse
=
await
fetchFromStrapi
(
const
fallbackR
esponse
=
await
fetchFromStrapi
(
"/api/collection-detail-categories"
,
q
uery
,
fallbackQ
uery
,
);
return
r
esponse
?.
data
||
[];
return
fallbackR
esponse
?.
data
||
[];
}
catch
(
error
)
{
console
.
error
(
"Product fetch error:"
,
error
);
return
[];
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment