Version 4.3.0

This commit is contained in:
Neo committed 2025-12-19 05:47:12 -08:00
1 parent 96997ddd8e
commit fe1acf984a
1349 files changed
+116159 -67711

No files matched your search

@@ -158,40 +158,52 @@ class _store extends \IPS\Dispatcher\Controller
foreach( $packages as $package )
{
$item = \IPS\nexus\Package\Item::load( $package->id );
$price = $package->price();
\IPS\Output::i()->jsonLd['package' . $package->id ] = array(
'@context' => "http://schema.org",
'@type' => "Product",
'name' => $package->_title,
'description' => strip_tags( $item->truncated() ),
'category' => $category->_title,
'url' => (string) $package->url(),
'sku' => $package->id,
'offers' => array(
'@type' => 'Offer',
'availability' => ( $package->stock > 0 OR $package->stock == -1 ) ? 'http://schema.org/InStock' : 'http://schema.org/OutOfStock',
'price' => $price->amountAsString(),
'priceCurrency' => $price->currency,
'seller' => array(
'@type' => 'Organization',
'name' => \IPS\Settings::i()->board_name
),
),
);
if( $package->image )
try
{
\IPS\Output::i()->jsonLd['package' . $package->id ]['image'] = (string) $package->image;
$price = $package->price();
}
catch( \OutOfBoundsException $e )
{
$price = NULL;
}
if( $package->reviewable )
/* A product MUST have an offer, so if there's no price (i.e. due to currency configuration) don't even output */
if( $price !== NULL )
{
\IPS\Output::i()->jsonLd['package' . $package->id ]['aggregateRating'] = array(
'@type' => 'AggregateRating',
'ratingValue' => $item->averageReviewRating(),
'ratingCount' => $item->reviews
\IPS\Output::i()->jsonLd['package' . $package->id ] = array(
'@context' => "http://schema.org",
'@type' => "Product",
'name' => $package->_title,
'description' => strip_tags( $item->truncated() ),
'category' => $category->_title,
'url' => (string) $package->url(),
'sku' => $package->id,
'offers' => array(
'@type' => 'Offer',
'availability' => ( $package->stock > 0 OR $package->stock == -1 ) ? 'http://schema.org/InStock' : 'http://schema.org/OutOfStock',
'price' => $price->amountAsString(),
'priceCurrency' => $price->currency,
'seller' => array(
'@type' => 'Organization',
'name' => \IPS\Settings::i()->board_name
),
),
);
if( $package->image )
{
\IPS\Output::i()->jsonLd['package' . $package->id ]['image'] = (string) $package->image;
}
if( $package->reviewable )
{
\IPS\Output::i()->jsonLd['package' . $package->id ]['aggregateRating'] = array(
'@type' => 'AggregateRating',
'ratingValue' => $item->averageReviewRating(),
'ratingCount' => $item->reviews
);
}
}
}