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"; } }