added option for additional info

main
alex 2024-08-11 11:48:11 +02:00
parent 918e19c56a
commit 1b1d8575bf
3 changed files with 21 additions and 3 deletions

View File

@ -29,6 +29,15 @@
"parameterName": "productUrl",
"type": "text",
"displayName": "URL vom Produkt (Shopify) (z. B. https://shinnex.de/products/gizmo) (für Direktweiterleitung 5 € Gutschein QR-Code)"
},
{
"parameterName": "additionalInfo",
"displayName": "Zusätzliche Informationen",
"type": "select",
"options": [
"Keine",
"Fehldrucke beigelegt"
]
}
]
}

View File

@ -4,7 +4,6 @@ import json
import subprocess
import sys
import os
import string
import random
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
@ -28,11 +27,13 @@ customerEmail = json_object["customerEmail"]
customerName = json_object["customerName"]
productUrl = json_object["productUrl"]
orderId = json_object["orderId"]
additionalInfo = json_object["additionalInfo"]
if (customerEmail is None
or orderId is None
or customerName is None
or productUrl is None):
or productUrl is None
or additionalInfo is None):
print("Missing required parameters")
sys.exit(1)
@ -40,6 +41,7 @@ customerEmail = customerEmail["value"]
customerName = customerName["value"]
productUrl = productUrl["value"]
orderId = orderId["value"]
additionalInfo = additionalInfo["value"]
# remove the # from the orderId if provided
if orderId.startswith("#"):
@ -220,6 +222,10 @@ def ReplaceHtmlVariables():
startTag = "<span>"
endTag = "</span>"
# add as text before last paragraph
if (additionalInfo != "Keine" and i == len(data["texts"][randomTextIndex]["paragraphs"]) - 1):
htmlParagraphs += f"{startTag}{data['additionalInfo'][additionalInfo]}{endTag}"
htmlParagraphs += f"{startTag}{paragraph.replace('{{CUSTOMER_NAME}}', customerName)}{endTag}"
i += 1

View File

@ -45,5 +45,8 @@
"Wir freuen uns darauf, Dich bald wieder bei uns begrüßen zu dürfen und wünschen Dir viel Freude mit Deiner Bestellung!"
]
}
]
],
"additionalInfo": {
"Fehldrucke beigelegt": "ⓘ Wir haben bemerkt, dass der erste Druck des Schildes nicht unseren Qualitätsstandards entsprach, weshalb wir es für Dich erneut gedruckt haben. Anstatt den ersten Druck zu entsorgen, legen wir ihn als kostenlose Zugabe bei. Vielleicht findest Du eine Verwendung dafür 😊"
}
}