diff --git a/frontend/admin-panel/src/pages/Products.tsx b/frontend/admin-panel/src/pages/Products.tsx
index 36dd20a4..c29e0664 100644
--- a/frontend/admin-panel/src/pages/Products.tsx
+++ b/frontend/admin-panel/src/pages/Products.tsx
@@ -26,7 +26,8 @@ export default function Products() {
const [formData, setFormData] = useState({
artNo: '',
- name: '',
+ nameFa: '',
+ nameEn: '',
scientificTagline: '',
description: '',
shortDescription: '',
@@ -86,7 +87,8 @@ export default function Products() {
setEditingProduct(product);
setFormData({
artNo: product.artNo,
- name: product.name,
+ nameFa: product.nameFa || '',
+ nameEn: product.nameEn || '',
scientificTagline: product.scientificTagline || '',
description: product.description || '',
shortDescription: product.shortDescription || '',
@@ -107,7 +109,7 @@ export default function Products() {
} else {
setEditingProduct(null);
setFormData({
- artNo: '', name: '', scientificTagline: '', description: '', shortDescription: '', categoryId: '',
+ artNo: '', nameFa: '', nameEn: '', scientificTagline: '', description: '', shortDescription: '', categoryId: '',
priceValue: 0, priceDisplay: '', unit: '', packageSize: 0, dosageLogic: '', suitableFor: 'سگ و گربه',
imageUrl: '', metaTitle: '', metaDescription: '', keywords: '', canonicalUrl: '', slug: ''
});
@@ -214,7 +216,7 @@ export default function Products() {
{product.imageUrl ? (
-
+
) : (
@@ -222,7 +224,12 @@ export default function Products() {
)}
{product.artNo}
- {product.name}
+
+
+ {product.nameFa || product.name || '-'}
+ {product.nameEn && {product.nameEn} }
+
+
{product.category?.name || 'بدون دسته'}
@@ -294,8 +301,12 @@ export default function Products() {
setFormData({...formData, artNo: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none font-mono" dir="ltr" />
- نام محصول *
- setFormData({...formData, name: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none" />
+ نام فارسی محصول *
+ setFormData({...formData, nameFa: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none" dir="rtl" placeholder="مثال: ژل دندان میکروسیلور" />
+
+
+ نام انگلیسی / آلمانی (nameEn) *
+ setFormData({...formData, nameEn: e.target.value})} className="w-full px-4 py-3 rounded-xl border border-gray-200 focus:border-purple-500 outline-none font-mono" dir="ltr" placeholder="e.g. Canina Mikrosilber Zahngel - 50ml" />
شعار علمی (Tagline)
diff --git a/frontend/application/app/shop/[slug]/page.tsx b/frontend/application/app/shop/[slug]/page.tsx
index 81d2b7a4..93277207 100644
--- a/frontend/application/app/shop/[slug]/page.tsx
+++ b/frontend/application/app/shop/[slug]/page.tsx
@@ -18,7 +18,9 @@ export async function generateMetadata(
// Get raw data for custom fields if we added them (like metaTitle)
// Since we don't have local access to raw DB object without modifying productService,
// we can just use the mapped product fields for now.
- const title = product.name.includes("Canina") ? product.name : `${product.name} | برند کانینا آلمان`;
+ const nameFa = product.nameFa || product.name;
+ const nameEn = product.nameEn || "";
+ const title = nameFa.includes("Canina") ? nameFa : `${nameFa} (${nameEn}) | برند کانینا آلمان`;
const description = (product.shortDescription || product.description || '').substring(0, 150).trim();
const keywords = (product as any).keywords ? (product as any).keywords.split(',') : product.main_ingredients;
@@ -51,7 +53,7 @@ export default async function ShopProductPage({ params }: { params: Promise<{ sl
const jsonLd = {
'@context': 'https://schema.org',
'@type': 'Product',
- name: product.name,
+ name: product.nameFa || product.name,
image: product.image,
description: product.shortDescription || product.description,
sku: product.artNo,
diff --git a/frontend/application/components/ArchivePage.tsx b/frontend/application/components/ArchivePage.tsx
index d129baad..3e697881 100644
--- a/frontend/application/components/ArchivePage.tsx
+++ b/frontend/application/components/ArchivePage.tsx
@@ -134,7 +134,16 @@ const ArchiveProductCard: React.FC<{ product: Product, onClick: (p: Product) =>
{product.category}
-
{product.name}
+
+
+ {product.nameFa || product.name}
+
+ {product.nameEn && (
+
+ {product.nameEn}
+
+ )}
+
{product.symptoms.slice(0, 2).map((s, i) => (
diff --git a/frontend/application/components/CartDrawer.tsx b/frontend/application/components/CartDrawer.tsx
index d456ceca..363bf418 100644
--- a/frontend/application/components/CartDrawer.tsx
+++ b/frontend/application/components/CartDrawer.tsx
@@ -103,10 +103,10 @@ export default function CartDrawer({ isOpen, onClose, onCheckout, onShopNavigate
{items.map((item) => (
-
+
-
{item.product.name}
+
{item.product.nameFa || item.product.name}
{item.product.category}
diff --git a/frontend/application/components/FeaturedProducts.tsx b/frontend/application/components/FeaturedProducts.tsx
index 42c0c0aa..aa69af2c 100644
--- a/frontend/application/components/FeaturedProducts.tsx
+++ b/frontend/application/components/FeaturedProducts.tsx
@@ -3,178 +3,169 @@ import { useState, useEffect, useMemo } from "react";
import { Product } from "../lib/data/products";
import { usePetStore } from "../lib/store/usePetStore";
import { productService } from "../lib/services/productService";
-import { motion, AnimatePresence } from "motion/react";
-import { Eye, ShoppingCart, ShieldCheck, Heart, AlertCircle, Sparkles } from "lucide-react";
+import { motion } from "motion/react";
+import { Eye, ShoppingCart, Heart, AlertCircle, Sparkles } from "lucide-react";
import SafeImage from "./SafeImage";
import { ProductCardSkeleton } from "./Skeleton";
-import Link from 'next/link';
+import Link from "next/link";
+import { useRouter } from "next/navigation";
import { useSettingsStore } from "../lib/store/settingsStore";
-
import { useCartStore } from "../lib/store/cartStore";
+import { toast } from "sonner";
-function ProductCard({ product, onClick }: { product: Product; key?: string | number; onClick: (p: Product) => void }) {
+function ProductCard({ product }: { product: Product }) {
const router = useRouter();
- const getText = useSettingsStore(state => state.getText);
+ const getText = useSettingsStore((state) => state.getText);
const { getActivePet } = usePetStore();
const activePet = getActivePet();
const { addItem } = useCartStore();
+ const nameFa = product.nameFa || product.name;
+ const nameEn = product.nameEn || "";
+
const compatibility = useMemo(() => {
if (!activePet) return null;
const sameSpecies = product.suitableFor === activePet.type || product.suitableFor === "هر دو";
- const helpsSymptom = (activePet.medicalConditions || []).some(s => product.symptoms.includes(s));
- if (!sameSpecies) return { type: 'alert', text: `مخصوص ${product.suitableFor}` };
- if (helpsSymptom) return { type: 'success', text: `توصیه شده برای ${activePet.name}` };
- return { type: 'neutral', text: `مناسب برای ${activePet.name}` };
+ const helpsSymptom = (activePet.medicalConditions || []).some((s) => product.symptoms.includes(s));
+ if (!sameSpecies) return { type: "alert", text: `مخصوص ${product.suitableFor}` };
+ if (helpsSymptom) return { type: "success", text: `توصیه شده برای ${activePet.name}` };
+ return { type: "neutral", text: `مناسب برای ${activePet.name}` };
}, [product, activePet]);
return (
- {/* Independent Category Tag at the absolute top-right of the card */}
+ {/* Category Badge */}
{product.category}
+ {/* Compatibility Tag */}
{compatibility && (
-
- {compatibility.type === 'alert' ?
: compatibility.type === 'success' ?
:
}
+ {compatibility.type === "alert" ?
: compatibility.type === "success" ?
:
}
{compatibility.text}
)}
- {/* Product Image Area */}
-
-
-
- {/* Main PDP Link */}
-
- {/* Hover Actions (z-20 to be clickable over the main PDP link) */}
+ {/* Image */}
+
+
+ {/* PDP Link overlay */}
+
+ {/* Hover Actions */}
-
{
- e.stopPropagation();
- router.push(`/shop/${product.slug || product.id}`);
- }}
- className="w-12 h-12 rounded-full bg-white text-canina-blue flex items-center justify-center hover:scale-110 transition-transform shadow-lg cursor-pointer"
+
{ e.stopPropagation(); router.push(`/shop/${product.slug || product.id}`); }}
+ className="w-11 h-11 rounded-full bg-white text-canina-blue flex items-center justify-center hover:scale-110 transition-transform shadow-lg cursor-pointer"
>
-
{
e.stopPropagation();
addItem(product, 1);
- toast.success(`${product.name} به سبد خرید شما اضافه شد.`);
+ toast.success(`${nameFa} به سبد خرید اضافه شد.`);
}}
- className="w-12 h-12 rounded-full bg-canina-blue text-white flex items-center justify-center hover:scale-110 transition-transform shadow-lg border border-white/20 cursor-pointer"
+ className="w-11 h-11 rounded-full bg-canina-blue text-white flex items-center justify-center hover:scale-110 transition-transform shadow-lg border border-white/20 cursor-pointer"
>
- {/* Content Area */}
-
-
-
- {product.name}
+ {/* Content */}
+
+ {/* Dual-language Name */}
+
+
+ {nameFa}
+ {nameEn && (
+
+ {nameEn}
+
+ )}
-
-
+
+ {/* Short description */}
+
{product.shortDescription || product.description}
-
-
- {product.benefits && (
-
- )}
-
-
-
{product.price}
-
- {getText('product_view_details', "مشاهده جزئیات")}
-
-
+
+ {/* Footer: Price + CTA */}
+
+
{product.price}
+
+ {getText("product_view_details", "مشاهده جزئیات")}
+
);
}
-import { useRouter } from 'next/navigation';
-import { toast } from 'sonner';
-
export default function FeaturedProducts() {
const router = useRouter();
- const getText = useSettingsStore(state => state.getText);
+ const getText = useSettingsStore((state) => state.getText);
const [products, setProducts] = useState
([]);
const [isLoading, setIsLoading] = useState(true);
useEffect(() => {
- const fetchFeatured = async () => {
- try {
- const data = await productService.getFeaturedProducts();
- setProducts(data);
- } catch (error) {
- console.error("Failed to fetch featured products:", error);
- toast.error("خطا در دریافت لیست محصولات از سرور. لطفاً صفحه را رفرش کنید.");
- } finally {
- setIsLoading(false);
- }
- };
- fetchFeatured();
+ productService.getFeaturedProducts()
+ .then(setProducts)
+ .catch(() => toast.error("خطا در دریافت لیست محصولات از سرور."))
+ .finally(() => setIsLoading(false));
}, []);
return (
- {/* Header - Correct RTL alignment with primary and secondary elements */}
-
{getText('featured_badge', "بیشترین انتخاب توسط دامپزشکان")}
+
+ {getText("featured_badge", "بیشترین انتخاب توسط دامپزشکان")}
+
- {getText('featured_title_line1', "محصولات برگزیده و راهکارهای")} {getText('featured_title_line2', "درمان تخصصی")}
+ {getText("featured_title_line1", "محصولات برگزیده و راهکارهای")}{" "}
+ {getText("featured_title_line2", "درمان تخصصی")}
-
router.push('/shop')}
+ router.push("/shop")}
className="inline-flex items-center gap-2 text-canina-blue font-black text-sm hover:translate-x-1 transition-all group font-vazir"
>
- {getText('featured_view_all', "مشاهده تمامی محصولات")}
+ {getText("featured_view_all", "مشاهده تمامی محصولات")}
←
-
+
{isLoading ? (
- Array.from({ length: 4 }).map((_, i) =>
)
+ Array.from({ length: 4 }).map((_, i) =>
)
) : products.length > 0 ? (
- products.map((p) => (
-
router.push(`/shop/${p.slug || p.id}`)} product={p} />
- ))
+ products.map((p) => )
) : (
-
{getText('featured_no_products_title', "هیچ محصولی یافت نشد")}
+
+ {getText("featured_no_products_title", "هیچ محصولی یافت نشد")}
+
- {getText('featured_no_products_desc', "در حال حاضر هیچ محصول برجستهای برای نمایش وجود ندارد. لطفاً در پنل ادمین محصولات برگزیده را تنظیم کنید.")}
+ {getText("featured_no_products_desc", "در حال حاضر هیچ محصول برجستهای برای نمایش وجود ندارد.")}
)}
diff --git a/frontend/application/components/ProductPage.tsx b/frontend/application/components/ProductPage.tsx
index 9501cf2c..b45c8322 100644
--- a/frontend/application/components/ProductPage.tsx
+++ b/frontend/application/components/ProductPage.tsx
@@ -242,9 +242,16 @@ export default function ProductPage({ productSlug }: { productSlug: string }) {
)}
-
- {product.name}
-
+
+
+ {product.nameFa || product.name}
+
+ {product.nameEn && (
+
+ {product.nameEn}
+
+ )}
+
{isMounted && pets.length > 0 ? (
product.optimisticTemplate?.replace("[PetName]", activePet?.name || "").replace("[OnSet]", product.onSetOfAction || "به زودی")
diff --git a/frontend/application/components/SearchResultsPage.tsx b/frontend/application/components/SearchResultsPage.tsx
index 6350bc59..96d20cf7 100644
--- a/frontend/application/components/SearchResultsPage.tsx
+++ b/frontend/application/components/SearchResultsPage.tsx
@@ -70,7 +70,7 @@ export default function SearchResultsPage({ query }: { query: string }) {
@@ -92,7 +92,7 @@ export default function SearchResultsPage({ query }: { query: string }) {
{product.category}
-
{product.name}
+
{product.nameFa || product.name}
{product.benefits}
diff --git a/frontend/application/lib/data/products.ts b/frontend/application/lib/data/products.ts
index a3f290f2..06be3d89 100644
--- a/frontend/application/lib/data/products.ts
+++ b/frontend/application/lib/data/products.ts
@@ -30,6 +30,8 @@ export interface Product {
slug?: string;
artNo: string;
name: string;
+ nameFa?: string;
+ nameEn?: string;
scientificTagline: string;
description: string;
shortDescription?: string;
diff --git a/frontend/application/lib/services/productService.ts b/frontend/application/lib/services/productService.ts
index 78d1fa90..7ddd4714 100644
--- a/frontend/application/lib/services/productService.ts
+++ b/frontend/application/lib/services/productService.ts
@@ -42,7 +42,9 @@ export class ProductService {
return {
id: data.id,
artNo: data.artNo,
- name: data.name,
+ name: data.nameFa || data.name || '',
+ nameFa: data.nameFa || data.name || '',
+ nameEn: data.nameEn || '',
scientificTagline: data.scientificTagline,
description: data.description,
shortDescription: data.shortDescription || '',