diff --git a/src/lib/emailRenderer.ts b/src/lib/emailRenderer.ts
index b085426..98ed80d 100644
--- a/src/lib/emailRenderer.ts
+++ b/src/lib/emailRenderer.ts
@@ -642,16 +642,7 @@ function renderExactProductCard(
// Pomocná funkcia na render samotnej cenovky (bez obalového
)
const renderBadgeContent = (bWidth: number, bAlign: string, padTop: number, padBottom: number, marginStyle: string) => {
- if (p.badgeCustomTemplate) {
- return `
-
-
- |
- ${renderCleanBadgeSvg(p.badgeCustomTemplate, p, bWidth)}
- |
-
- `;
- }
+ // Vlastná PNG cenovka (výnimka) má prednosť pred šablónou; po jej odstránení sa vráti šablóna
if (p.customBadgePngUrl) {
return `
@@ -662,6 +653,16 @@ function renderExactProductCard(
`;
}
+ if (p.badgeCustomTemplate) {
+ return `
+
+
+ |
+ ${renderCleanBadgeSvg(p.badgeCustomTemplate, p, bWidth)}
+ |
+
+ `;
+ }
const mainFontSize = Math.max(28, Math.round(bWidth * 0.54));
const subFontSize = Math.max(14, Math.round(bWidth * 0.27));
return `
@@ -809,14 +810,14 @@ function renderExactLoyaltyCard(p: any, validity: string): string {
|
- |
+ |
${(() => {
- // 1. Ak má vernostný produkt vlastnú dynamickú šablónu cenovky
- if (p.badgeCustomTemplate) {
- const bWidth = p.badgeWidth || p.badgeCustomTemplate.width || 120;
- const bAlign = p.badgeAlign || p.badgeCustomTemplate.align || 'center';
- const padTop = p.badgePaddingTop ?? (p.badgeCustomTemplate.paddingTop ?? 0);
- const padBottom = p.badgePaddingBottom ?? (p.badgeCustomTemplate.paddingBottom ?? 0);
+ // 1. Ak má vernostný produkt vlastnú PNG cenovku (prednosť) alebo dynamickú šablónu cenovky
+ if (p.customBadgePngUrl || p.badgeCustomTemplate) {
+ const bWidth = p.badgeWidth || p.badgeCustomTemplate?.width || 120;
+ const bAlign = p.badgeAlign || p.badgeCustomTemplate?.align || 'center';
+ const padTop = p.badgePaddingTop ?? (p.badgeCustomTemplate?.paddingTop ?? 0);
+ const padBottom = p.badgePaddingBottom ?? (p.badgeCustomTemplate?.paddingBottom ?? 0);
let marginStyle = 'margin: 0 auto;';
if (bAlign === 'left') {
@@ -836,7 +837,9 @@ function renderExactLoyaltyCard(p: any, validity: string): string {
- ${renderCleanBadgeSvg(p.badgeCustomTemplate, loyaltyProductData, bWidth)}
+ ${p.customBadgePngUrl
+ ? ` `
+ : renderCleanBadgeSvg(p.badgeCustomTemplate, loyaltyProductData, bWidth)}
|
`;
@@ -900,7 +903,7 @@ function renderExactLoyaltyCard(p: any, validity: string): string {
})()}
|
- ${p.badgeCustomTemplate ? `
+ ${p.badgeCustomTemplate || p.customBadgePngUrl ? `
|
${p.cardUnitPrice || p.unitPrice ? ` ${escapeHtml(p.cardUnitPrice || p.unitPrice)} ` : ' '}
|