Compare commits

...
2 Commits
Author SHA1 Message Date
Unchained bfce7dcca0 fix: filter bundles from homepage, sitemap, and static params
Build and Deploy / build (push) Has been cancelled
2026-03-24 20:14:42 +02:00
Unchained 8f780c3585 fix: bundle UI improvements - remove QTY selector, filter bundles from similar products
Build and Deploy / build (push) Has been cancelled
2026-03-24 18:50:39 +02:00
5 changed files with 22 additions and 30 deletions
+4 -1
View File
@@ -40,7 +40,10 @@ export default async function Homepage({ params }: { params: Promise<{ locale: s
console.log("Failed to fetch products during build");
}
const featuredProducts = products?.slice(0, 4) || [];
const filteredProducts = products?.filter(
(p: any) => !p.name.includes("2x Set") && !p.name.includes("3x Set")
);
const featuredProducts = filteredProducts?.slice(0, 4) || [];
const hasProducts = featuredProducts.length > 0;
const basePath = `/${validLocale}`;
+8 -5
View File
@@ -20,7 +20,10 @@ export async function generateStaticParams() {
try {
const saleorLocale = locale === "sr" ? "SR" : "EN";
const products = await getProducts(saleorLocale, 100);
products.forEach((product: Product) => {
const filteredProducts = products.filter(
(p: Product) => !p.name.includes("2x Set") && !p.name.includes("3x Set")
);
filteredProducts.forEach((product: Product) => {
params.push({ locale, slug: product.slug });
});
} catch (e) {
@@ -88,9 +91,10 @@ export default async function ProductPage({ params }: ProductPageProps) {
let relatedProducts: Product[] = [];
let bundleProducts: Product[] = [];
try {
const allProducts = await getProducts(saleorLocale, 8);
const allProducts = await getProducts(saleorLocale, 50);
relatedProducts = allProducts
.filter((p: Product) => p.id !== product.id)
.filter((p) => !p.name.includes("2x Set") && !p.name.includes("3x Set"))
.slice(0, 4);
} catch (e) {}
@@ -100,10 +104,9 @@ export default async function ProductPage({ params }: ProductPageProps) {
const bundleAttr = p.attributes?.find(
(attr) => attr.attribute.slug === "bundle-items"
);
if (!bundleAttr) return false;
if (!bundleAttr || bundleAttr.values.length === 0) return false;
return bundleAttr.values.some((val) => {
const baseIdPart = product.id.replace("UHJvZHVjdDo", "");
return val.slug.includes(baseIdPart);
return val.name === product.name || p.name.includes(product.name.split(" - ")[0]);
});
});
} catch (e) {}
+5 -1
View File
@@ -27,7 +27,11 @@ export default async function ProductsPage({ params }: ProductsPageProps) {
setRequestLocale(validLocale);
const t = await getTranslations("Products");
const saleorLocale = getSaleorLocale(validLocale as Locale);
const products = await getProducts(saleorLocale);
const allProducts = await getProducts(saleorLocale);
const products = allProducts.filter((product) => {
return !product.name.includes("2x Set") && !product.name.includes("3x Set");
});
return (
<>
+5 -1
View File
@@ -80,9 +80,13 @@ export default async function sitemap(): Promise<SitemapEntry[]> {
},
];
const filteredProducts = products.filter(
(p: any) => !p.name.includes("2x Set") && !p.name.includes("3x Set")
);
const productUrls: SitemapEntry[] = [];
for (const product of products) {
for (const product of filteredProducts) {
const hreflangs: Record<string, string> = {};
for (const locale of SUPPORTED_LOCALES) {
const path = locale === "sr" ? `/products/${product.slug}` : `/${locale}/products/${product.slug}`;
-22
View File
@@ -354,28 +354,6 @@ export default function ProductDetail({ product, relatedProducts, bundleProducts
)
)}
<div className="flex items-center gap-4 mb-8">
<span className="text-sm uppercase tracking-[0.1em] font-medium w-16">
{t("qty")}
</span>
<div className="flex items-center border-2 border-[#1a1a1a]">
<button
onClick={() => setQuantity(Math.max(1, quantity - 1))}
className="w-12 h-12 flex items-center justify-center hover:bg-[#f8f9fa] transition-colors"
disabled={quantity <= 1}
>
<Minus className="w-4 h-4" />
</button>
<span className="w-14 text-center text-base font-medium">{quantity}</span>
<button
onClick={() => setQuantity(quantity + 1)}
className="w-12 h-12 flex items-center justify-center hover:bg-[#f8f9fa] transition-colors"
>
<Plus className="w-4 h-4" />
</button>
</div>
</div>
{isAvailable ? (
<button
onClick={handleAddToCart}