Update (ai gen): pricing copies

This commit is contained in:
2023-10-02 15:53:17 +08:00
parent b143c91402
commit 10ce20391c

View File

@@ -159,13 +159,25 @@ private static function getProductPricingExcerpt(array $jsonLdData)
$currency = $data->offers->priceCurrency ?? null; $currency = $data->offers->priceCurrency ?? null;
$sellerName = $data->offers->seller->name ?? "online store"; // default to "online store" if name is not set $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 // Determine and format pricing sentence
if ($lowPrice && $highPrice) { 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) { } elseif ($price) {
return "Priced at {$currency} {$price} in {$sellerName}"; $price = number_format($price, 0);
return "Priced at {$currency} {$price} in {$sellerName} online store";
} else { } else {
return "Price not stated, refer to {$sellerName}"; return "Price not stated, refer to {$sellerName} online store";
} }
} }