{
$latestRelease = $game->latestRelease;
+ $product = null;
+ $gamePromoted = getPromotedProduct($game);
+ if ($gamePromoted) {
+ $product = [
+ 'type' => 'entitlement',
+ 'identifier' => $gamePromoted->identifier,
+ 'name' => $gamePromoted->name,
+ 'description' => $gamePromoted->description ?? '',
+ 'localPrice' => $gamePromoted->localPrice,
+ 'originalPrice' => $gamePromoted->originalPrice,
+ 'percentOff' => 0,
+ 'currency' => $gamePromoted->currency,
+ ];
+ }
+
// http://cweiske.de/ouya-store-api-docs.htm#get-https-devs-ouya-tv-api-v1-apps-xxx
return [
'app' => [
'supportPhone' => $game->developer->supportPhone,
'founder' => $game->developer->founder,
- 'promotedProduct' => null,
+ 'promotedProduct' => $product,
],
];
}
];
}
+ $product = null;
+ $gamePromoted = getPromotedProduct($game);
+ if ($gamePromoted) {
+ $product = [
+ 'type' => 'entitlement',
+ 'identifier' => $gamePromoted->identifier,
+ 'name' => $gamePromoted->name,
+ 'description' => $gamePromoted->description ?? '',
+ 'localPrice' => $gamePromoted->localPrice,
+ 'originalPrice' => $gamePromoted->originalPrice,
+ 'percentOff' => 0,
+ 'currency' => $gamePromoted->currency,
+ ];
+ }
+
// http://cweiske.de/ouya-store-api-docs.htm#get-https-devs-ouya-tv-api-v1-details
return [
'type' => 'Game',
'url' => null,
],
- 'promotedProduct' => null,
+ 'promotedProduct' => $product,
'buttons' => $buttons,
];
}
return $imageUrls;
}
+function getPromotedProduct($game)
+{
+ if (!isset($game->products) || !count($game->products)) {
+ return null;
+ }
+ foreach ($game->products as $gameProd) {
+ if ($gameProd->promoted) {
+ return $gameProd;
+ }
+ }
+ return null;
+}
+
function writeJson($path, $data)
{
global $wwwDir;