Add a Torob toggle in store settings and show parent category on product chips.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
fde6a34e44
commit
8c187b18be
@@ -16,6 +16,8 @@ export interface ProductApi {
|
||||
categoryId: string | null
|
||||
categoryName: string
|
||||
categoryNameFa?: string
|
||||
categoryParentName?: string
|
||||
categoryParentNameFa?: string
|
||||
brandId: string | null
|
||||
brand: {
|
||||
id: string
|
||||
@@ -86,6 +88,8 @@ export function mapProductApiToUi(product: ProductApi): Product {
|
||||
categoryId: product.categoryId ?? '',
|
||||
category: product.categoryName,
|
||||
categoryFa: product.categoryNameFa || '',
|
||||
categoryParent: product.categoryParentName || '',
|
||||
categoryParentFa: product.categoryParentNameFa || '',
|
||||
summary: product.summary,
|
||||
description: product.descriptionHtml,
|
||||
image: product.image || product.thumbnail || '',
|
||||
@@ -98,6 +102,19 @@ export function mapProductApiToUi(product: ProductApi): Product {
|
||||
}
|
||||
}
|
||||
|
||||
export function formatProductCategoryChip(
|
||||
product: Pick<Product, 'category' | 'categoryFa' | 'categoryParent' | 'categoryParentFa'>,
|
||||
isFa: boolean,
|
||||
): string {
|
||||
const leaf = isFa ? product.categoryFa || product.category : product.category
|
||||
if (!leaf) return ''
|
||||
const parent = isFa
|
||||
? product.categoryParentFa || product.categoryParent
|
||||
: product.categoryParent
|
||||
if (!parent) return leaf
|
||||
return `${parent} >> ${leaf}`
|
||||
}
|
||||
|
||||
export function getProductGalleryUrls(product: ProductApi): string[] {
|
||||
const urls: string[] = []
|
||||
const featured = product.thumbnailUrl || product.thumbnail || product.image
|
||||
|
||||
@@ -59,6 +59,7 @@ export interface EPaymentSettings {
|
||||
|
||||
export interface StoreSettings {
|
||||
onlineSellEnabled: boolean
|
||||
torobEnabled: boolean
|
||||
orderProcessSteps: OrderProcessStep[]
|
||||
ePayment: EPaymentSettings
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user