From 10ce20391c4c0466c36f81b7fe78534c6483494d Mon Sep 17 00:00:00 2001 From: Charles T Date: Mon, 2 Oct 2023 15:53:17 +0800 Subject: [PATCH] Update (ai gen): pricing copies --- app/Jobs/Tasks/GenerateShopeeAIArticleTask.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/app/Jobs/Tasks/GenerateShopeeAIArticleTask.php b/app/Jobs/Tasks/GenerateShopeeAIArticleTask.php index cb63a0b..92ef562 100644 --- a/app/Jobs/Tasks/GenerateShopeeAIArticleTask.php +++ b/app/Jobs/Tasks/GenerateShopeeAIArticleTask.php @@ -159,13 +159,25 @@ private static function getProductPricingExcerpt(array $jsonLdData) $currency = $data->offers->priceCurrency ?? null; $sellerName = $data->offers->seller->name ?? "online store"; // default to "online store" if name is not set + if (!is_empty($currency)) + { + if ($currency == 'MYR') + { + $currency = 'RM'; + } + } + + // Determine and format pricing sentence if ($lowPrice && $highPrice) { - return "Price Range from {$currency} {$lowPrice} to {$highPrice} in {$sellerName}"; + $lowPrice = number_format($lowPrice, 0); + $highPrice = number_format($highPrice, 0); + return "Price Range from {$currency} {$lowPrice} to {$highPrice} in {$sellerName} online store"; } elseif ($price) { - return "Priced at {$currency} {$price} in {$sellerName}"; + $price = number_format($price, 0); + return "Priced at {$currency} {$price} in {$sellerName} online store"; } else { - return "Price not stated, refer to {$sellerName}"; + return "Price not stated, refer to {$sellerName} online store"; } }