{php
// ---------- GEO: Product 结构化数据 ----------
$product_name = isset($title) ? $title : '';
$product_desc = isset($introduce) && $introduce ? $introduce : (isset($head_description) ? $head_description : '');
$product_img = isset($albums) && is_array($albums) && $albums ? $albums[0] : (isset($thumb) ? $thumb : '');
$product_price = isset($price) ? floatval($price) : 0;
$product_url = isset($linkurl) ? $linkurl : '';
$product_brand = isset($brand) ? $brand : '';
$product_currency = isset($DT['money_unit']) ? $DT['money_unit'] : 'CNY';
$product_seller = isset($company) ? $company : '';
$product_seller_url = isset($username) ? DT_PATH.'index.php?homepage='.$username : '';
$product_date = isset($addtime) ? date('c', $addtime) : '';
$_pd = array(
'@type' => 'Product',
'name' => $product_name,
'description' => $product_desc,
'url' => $product_url,
);
if($product_img) $_pd['image'] = $product_img;
if($product_brand) $_pd['brand'] = array('@type'=>'Brand','name'=>$product_brand);
if($product_price > 0){
$_pd['offers'] = array(
'@type' => 'Offer',
'priceCurrency' => $product_currency,
'price' => $product_price,
'availability' => 'https://schema.org/InStock',
'seller' => array('@type'=>'Organization','name'=>$product_seller,'url'=>$product_seller_url),
);
}
$_geo_ld = array('@context'=>'https://schema.org','@graph'=>array($_pd));
echo '';
?>