Commit e92cf9e3 authored by Hannes Peterseim's avatar Hannes Peterseim

Initial commit

parents
jld.png

1.63 KB

<?php
/**
* Metadata version
* @var string
*/
$sMetadataVersion = '1.1';
/**
* Module information
* @var array
*/
$aModule = array(
'id' => 'jsonld',
'title' => '<b>j</b>son-<b>ld</b> microdata',
'description' => array(
'de' => 'Erzeugt in den Seiten maschinell lesbare Daten im JSON-LD Format.<br>Ermöglicht es beispielsweise Google Daten für rich snippets auszulesen.<br>Ersetzt den RDF/A Export.<br><br>Weitere Software unter <a href="https://www.petit-souris.de" target="_blank">https://www.petit-souris.de</a> oder <a href="https://gitlab.petit-souris.de" target="_blank">https://gitlab.petit-souris.de</a>, Fragen, Wünsche, Jobangebote gern unter <a href="mailto:oxid@petit-souris.de">oxid@petit-souris.de</a>.<br><a href="https://paypal.me/hpeterseim/1" target=""blank">Und wenn Sie möchten können Sie natürlich auch gerne einen Euro spenden.</a>',
'en' => 'Creates machine readable data in the JSON-LD format in your pages.<br>Enables e.g. google to read rich snippets data from your shop.<br>Replaces the RDF/A export.<br><br>More peaces of software under <a href="https://www.petit-souris.de" target="_blank">https://www.petit-souris.de</a> or <a href="https://gitlab.petit-souris.de" target="_blank">https://gitlab.petit-souris.de</a>, questions, wishes or job offers goes to <a href="mailto:oxid@petit-souris.de">oxid@petit-souris.de</a>.<br><a href="https://paypal.me/hpeterseim/1" target=""blank">Spend an euro if you want.</a>'
),
'thumbnail' => 'views/admin/image.php',
'version' => '1.0.0',
'author' => 'Hannes Peterseim',
'email' => 'oxid@petit-souris.de',
'url' => 'https://www.petit-souris.de',
'extend' => array(),
'templates' => array(
'jsonldWidget.tpl' => 'jsonld/views/widgets/jsonldWidget.tpl',
'jsonldProduct.tpl' => 'jsonld/views/widgets/jsonldProduct.tpl',
'jsonldProductList.tpl' => 'jsonld/views/widgets/jsonldProductList.tpl',
'jsonldSearch.tpl' => 'jsonld/views/widgets/jsonldSearch.tpl',
'jsonldTagList.tpl' => 'jsonld/views/widgets/jsonldTagList.tpl',
),
'blocks' => array(
array(
'template' => 'layout/base.tpl',
'block' => 'base_js',
'file' => '/views/blocks/jsonldBlock.tpl'
)
),
'files' => array(
'jsonldWidget' => 'jsonld/src/Controller/jsonldWidget.php'
),
'settings' => array(
array('group' => 'main', 'name' => 'jsonld_enable_for_products', 'type' => 'bool', 'value' => '1'),
array('group' => 'main', 'name' => 'jsonld_enable_for_product_lists', 'type' => 'bool', 'value' => '1'),
array('group' => 'main', 'name' => 'jsonld_enable_for_searches', 'type' => 'bool', 'value' => '1'),
array('group' => 'main', 'name' => 'jsonld_enable_for_tag_lists', 'type' => 'bool', 'value' => '1'),
array('group' => 'basic', 'name' => 'jsonld_name_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_shortdesc_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_sku_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_ean_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_mpn_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_weight_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_metrics_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_manufacturer_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_category_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_image_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'basic', 'name' => 'jsonld_link_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'price', 'name' => 'jsonld_price_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'availability', 'name' => 'jsonld_availability_enable', 'type' => 'bool', 'value' => 1),
array('group' => 'condition', 'name' => 'jsonld_new_enable', 'type' => 'bool', 'value' => ''),
array('group' => 'condition', 'name' => 'jsonld_used_enable', 'type' => 'bool', 'value' => ''),
array('group' => 'rating', 'name' => 'jsonld_rating_enable', 'type' => 'bool', 'value' => ''),
array('group' => 'rating', 'name' => 'jsonld_rating_higher_than', 'type' => 'str', 'value' => '4'),
)
);
\ No newline at end of file
# jld alias JSON-LD
## Installation :
1. Checken Sie das Repository in den Ordner oxidroot/modules/ aus oder laden Sie das Repo herunter und dann die Struktur komplett in den Ordner oxidroot/modules/json-ld hoch.
2. Gehen Sie im Backend in den Bereich Erweiterungen (bei Oxid EE im jeweiligen Subshop) und aktivieren Sie das Modul.
3. Konfigurieren Sie das Modul nach Belieben in den Einstellungen.
## Test
Um zu überprüfen ob das Modul korrekt arbeitet kann man das Google Testtool für strukturierte Daten nutzen.
Dieses findet sich unter https://search.google.com/structured-data/testing-tool/?hl=de
Geben Sie dort den URL einer beliebigen Produktseite an, denken Sie daran das bei aktiviertem RDF/A zweimal Daten für Product gerendert werden, der obere ist der RDF/A, der untere der JSON-LD Export.
## Hints
Der Export fußt auf den im Shop hinterlegten Daten, je besser diese sind umso besser der Export.
<?php
/**
* Copyright 2017 by Hannes Peterseim
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Questions, job offers or simply wishes for this product are welcome, please use oxid@petit-souris.de or take a look @ https://gitlab.petit-souris.de for other peaces of software.
*/
/**
* Class jsonldWidget
*/
class jsonldWidget extends oxWidget
{
/**
* @var string
*/
protected $_sThisTemplate = 'jsonldWidget.tpl';
/**
* @var bool
*/
private $_oConf = false;
/**
* @var bool
*/
private $_oView = false;
/**
* @var null
*/
private $_product = null;
/**
* @var null
*/
private $_productList = null;
/**
* @var null
*/
private $_search = null;
/**
* @var null
*/
private $_tagList = null;
/**
* jsonldWidget constructor.
*/
public function __construct()
{
$this->_oConf = oxRegistry::getConfig();
$this->_oView = $this->_oConf->getTopActiveView();
}
/**
* @return string
*/
public function _whereAmI()
{
if($this->getViewParameter('cl') == 'details') {
return 'pdp';
}
if($this->getViewParameter('cl') == 'alist') {
return 'plp';
}
if($this->getViewParameter('cl') == 'search') {
return 'search';
}
if($this->getViewParameter('cl') == 'tag') {
return 'taglist';
}
return false;
}
/**
* @return mixed|null
*/
public function _getTagListAmount()
{
$this->_tagList = \oxNew('Tag');
return count($this->_tagList->getArticleList());
}
/**
* @return mixed|null
*/
public function _getTagList()
{
$this->_tagList = \oxNew('Tag');
return $this->_tagList->getArticleList();
}
/**
* @return mixed|null
*/
public function _getSearchAmount()
{
$this->_search = \oxNew('oxsearch');
return $this->_search->getSearchArticleCount($this->getViewParameter('searchparam'));
}
/**
* @return mixed|null
*/
public function _getSearchResults()
{
$this->_search = \oxNew('oxsearch');
return $this->_search->getSearchArticles($this->getViewParameter('searchparam'));
}
/**
* @return mixed|null
*/
public function _getProductListAmount()
{
$this->_productList = \oxNew('aList');
return count($this->_productList->getArticleList());
}
/**
* @return mixed|null
*/
public function _getProductList()
{
$this->_productList = \oxNew('aList');
return $this->_productList->getArticleList();
}
/**
* @param null $oId
* @return oxArticle
*/
public function _getProduct($oId=null)
{
$this->_product = \oxNew('oxArticle');
if ($oId == null) {
$oId = $this->getViewParameter('aid');
} else {
$oId = $oId->oxarticles__oxid->value;
}
$this->_product->load($oId);
return $this->_product;
}
/**
* @param $product
* @return mixed
*/
public function _productsActive($product)
{
return $product->oxarticles__oxactive->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsSku($product)
{
return $product->oxarticles__oxartnum->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsEan($product)
{
return $product->oxarticles__oxean->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsMpn($product)
{
return $product->oxarticles__oxmpn->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsWeight($product)
{
return (float) number_format($product->oxarticles__oxweight->value,3,'.','');
}
/**
* @param $product
* @return mixed
*/
public function _productsHeight($product)
{
return (float) number_format($product->oxarticles__oxheight->value,3,'.','');
}
/**
* @param $product
* @return mixed
*/
public function _productsLength($product)
{
return (float) number_format($product->oxarticles__oxlength->value,3,'.','');
}
/**
* @param $product
* @return mixed
*/
public function _productsWidth($product)
{
return (float) number_format($product->oxarticles__oxwidth->value,3,'.','');
}
/**
* @param $product
* @return mixed
*/
public function _productsManufacturer($product)
{
return $product->getManufacturer()->oxmanufacturers__oxtitle->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsCategory($product)
{
return $product->getCategory()->oxcategories__oxtitle->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsName($product)
{
if ($product->oxarticles__oxvarselect->value) {
return $product->oxarticles__oxtitle->value . ', ' . $product->oxarticles__oxvarselect->value;
} else {
return $product->oxarticles__oxtitle->value;
}
}
/**
* @param $product
* @return mixed
*/
public function _productsShortdesc($product)
{
return $product->oxarticles__oxshortdesc->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsImage($product)
{
return $product->getPictureUrl();
}
/**
* @param $product
* @return mixed
*/
public function _productsLink($product)
{
return $product->getLink();
}
/**
* @param $product
* @return mixed
*/
public function _productsBuyable($product)
{
return $product->isBuyable();
}
/**
* @param $product
* @return mixed
*/
public function _productsPrice($product)
{
return number_format($product->oxarticles__oxprice->value,2,'.','');
}
/**
* @param $product
* @return mixed
*/
public function _productsHighPrice($product)
{
return number_format($product->oxarticles__oxvarminprice->value,2,'.','');
}
/**
* @param $product
* @return mixed
*/
public function _productsLowPrice($product)
{
return number_format($product->oxarticles__oxvarminprice->value,2,'.','');
}
/**
* @return mixed
*/
public function _currencyName()
{
return $this->_oConf->getActShopCurrencyObject()->name;
}
/**
* @param $product
* @return mixed
*/
public function _productsAggregatedRatingsAmount($product)
{
return $product->oxarticles__oxratingcnt->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsAggregatedRatingsValue($product)
{
return $product->oxarticles__oxrating->value;
}
/**
* @param $product
* @return mixed
*/
public function _productsHasVariants($product)
{
return count($product->getVariants());
}
/**
* @param $product
* @return mixed
*/
public function _productsGetVariants($product)
{
return $product->getVariants();
}
/**
* @param $product
* @return mixed
*/
public function _productsGetVariantSelections($product)
{
$names = explode(' | ',$product->oxarticles__oxvarname->value);
$values = explode(' | ',$product->oxarticles__oxvarselect->value);
for($i=0;$i<count($names);$i++) {
$variants[] = array('name' => $names[$i],'value' => $values[$i]);
}
return $variants;
}
/**
* @param $key
* @return bool
*/
public function jsonLdConf($key)
{
if (substr_count($key, '_enable') > 0) {
return (bool)$this->_oConf->getConfigParam($key);
} else {
return $this->_oConf->getConfigParam($key);
}
}
}
\ No newline at end of file
<?php
$sLangName = 'Deutsch';
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
'charset' => 'UTF-8',
'SHOP_MODULE_GROUP_main' => 'Allgemein',
'SHOP_MODULE_jsonld_enable_for_products' => 'für PDPs aktivieren',
'HELP_SHOP_MODULE_jsonld_enable_for_products' => 'Aktiviert die Ausgabe der Produktdaten im JSON-LD Format.',
'SHOP_MODULE_jsonld_enable_for_product_lists' => 'für PLPs aktivieren',
'HELP_SHOP_MODULE_jsonld_enable_for_product_lists' => 'Aktiviert die Ausgabe der Produktdaten im JSON-LD Format auf Kategorieseiten.',
'SHOP_MODULE_jsonld_enable_for_searches' => 'für SERPs aktivieren',
'HELP_SHOP_MODULE_jsonld_enable_for_searches' => 'Aktiviert die Ausgabe der Produktdaten im JSON-LD Format auf Suchergebnisseiten.',
'SHOP_MODULE_jsonld_enable_for_tag_lists' => 'für TLPs aktivieren',
'HELP_SHOP_MODULE_jsonld_enable_for_tag_lists' => 'Aktiviert die Ausgabe der Produktdaten im JSON-LD Format auf den Taglistseiten.',
'SHOP_MODULE_GROUP_basic' => 'allgemeine Angaben',
'SHOP_MODULE_jsonld_name_enable' => 'Produktname',
'HELP_SHOP_MODULE_jsonld_name_enable' => 'Gibt den Produktnamen aus.',
'SHOP_MODULE_jsonld_shortdesc_enable' => 'Kurzbeschreibung',
'HELP_SHOP_MODULE_jsonld_shortdesc_enable' => 'Gibt die Kurzbeschreibung aus.',
'SHOP_MODULE_jsonld_sku_enable' => 'Artikelnummer',
'HELP_SHOP_MODULE_jsonld_sku_enable' => 'Gibt die Artikelnummer aus.',
'SHOP_MODULE_jsonld_ean_enable' => 'EAN Code',
'HELP_SHOP_MODULE_jsonld_ean_enable' => 'Gibt den EAN Code, so vorhanden, aus.',
'SHOP_MODULE_jsonld_mpn_enable' => 'MPN',
'HELP_SHOP_MODULE_jsonld_mpn_enable' => 'Gibt die Herstellerartikelnummer, so vorhanden, aus.',
'SHOP_MODULE_jsonld_manufacturer_enable' => 'Brand',
'HELP_SHOP_MODULE_jsonld_manufacturer_enable' => 'Gibt den Hersteller, so vorhanden, aus.',
'SHOP_MODULE_jsonld_category_enable' => 'Kategorie',
'HELP_SHOP_MODULE_jsonld_category_enable' => 'Gibt die Kategorie, so vorhanden, aus.',
'SHOP_MODULE_jsonld_weight_enable' => 'Gewicht',
'HELP_SHOP_MODULE_jsonld_weight_enable' => 'Gibt das Gewicht, so vorhanden, aus.',
'SHOP_MODULE_jsonld_metrics_enable' => 'Maße',
'HELP_SHOP_MODULE_jsonld_metrics_enable' => 'Gibt die Maße, so vorhanden, aus.',
'SHOP_MODULE_jsonld_image_enable' => 'Artikelbild',
'HELP_SHOP_MODULE_jsonld_image_enable' => 'Gibt das erste Artikelbild aus.',
'SHOP_MODULE_jsonld_link_enable' => 'ArtikelURL',
'HELP_SHOP_MODULE_jsonld_link_enable' => 'Gibt den URL des Artikels aus.',
'SHOP_MODULE_GROUP_price' => 'Preis',
'SHOP_MODULE_jsonld_price_enable' => 'Preisangaben',
'HELP_SHOP_MODULE_jsonld_price_enable' => 'Gibt den Bruttopreis aus.',
'SHOP_MODULE_GROUP_availability' => 'Verfügbarkeit',
'SHOP_MODULE_jsonld_availability_enable' => 'Verfügbarkeit',
'HELP_SHOP_MODULE_jsonld_availability_enable' => 'Gibt die Verfügbarkeit aus.',
'SHOP_MODULE_GROUP_condition' => 'Zustand',
'SHOP_MODULE_jsonld_new_enable' => 'neu (alle Produkte)',
'HELP_SHOP_MODULE_jsonld_new_enable' => 'Gibt den Zustand des Produktes als "neu" aus.',
'SHOP_MODULE_jsonld_used_enable' => 'gebraucht (alle Produkte)',
'HELP_SHOP_MODULE_jsonld_used_enable' => 'Gibt den Zustand des Produktes als "gebraucht" aus.',
'SHOP_MODULE_GROUP_rating' => 'Bewertungen',
'SHOP_MODULE_jsonld_rating_enable' => 'Bewertungen',
'HELP_SHOP_MODULE_jsonld_rating_enable' => 'Gibt aggregierte Bewertungen aus.',
'SHOP_MODULE_jsonld_rating_higher_than' => 'nicht unter',
'HELP_SHOP_MODULE_jsonld_rating_higher_than' => 'Definiert den Schwellenwert für die Ausgabe der Bewertungen.'
);
<?php
$sLangName = "English";
// -------------------------------
// RESOURCE IDENTITFIER = STRING
// -------------------------------
$aLang = array(
'charset' => 'UTF-8',
'SHOP_MODULE_GROUP_main' => 'general',
'SHOP_MODULE_jsonld_enable' => 'enable',
'HELP_SHOP_MODULE_jsonld_enable' => 'enables products data output in JSON-LD format.',
'SHOP_MODULE_GROUP_basic' => 'products basic data',
'SHOP_MODULE_jsonld_name_enable' => 'products name',
'HELP_SHOP_MODULE_jsonld_name_enable' => 'Prints products name.',
'SHOP_MODULE_jsonld_sku_enable' => 'article id',
'HELP_SHOP_MODULE_jsonld_sku_enable' => 'Prints products sku.',
'SHOP_MODULE_GROUP_price' => 'products prices',
'SHOP_MODULE_jsonld_price_enable' => 'prices',
'HELP_SHOP_MODULE_jsonld_price_enable' => 'Prints products price.',
'SHOP_MODULE_GROUP_availability' => 'products availability',
'SHOP_MODULE_jsonld_availability_enable' => 'availability',
'HELP_SHOP_MODULE_jsonld_availability_enable' => 'Prints products availability.',
'SHOP_MODULE_GROUP_condition' => 'products condition',
'SHOP_MODULE_jsonld_new_enable' => 'new (all products)',
'HELP_SHOP_MODULE_jsonld_new_enable' => 'Prints products condition as "new".',
'SHOP_MODULE_jsonld_used_enable' => 'used (all products)',
'HELP_SHOP_MODULE_jsonld_used_enable' => 'Prints products condition as "used".',
'SHOP_MODULE_GROUP_rating' => 'ratings',
'SHOP_MODULE_jsonld_rating_enable' => 'ratings',
'HELP_SHOP_MODULE_jsonld_rating_enable' => 'Prints products aggregated ratings.',
'SHOP_MODULE_jsonld_rating_higher_than' => 'nothing lower than',
'HELP_SHOP_MODULE_jsonld_rating_higher_than' => 'Defines the lowest value for printable ratings.'
);
\ No newline at end of file
<?php
/**
* Copyright 2017 by Hannes Peterseim
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Questions, job offers or simply wishes for this product are welcome, please use oxid@petit-souris.de or take a look @ https://gitlab.petit-souris.de for other peaces of software.
*/
if (!readfile('https://www.petit-souris.de/media/modules/image.php?module=jld')) {
readfile('../../jld.png');
}
\ No newline at end of file
[{$smarty.block.parent}]
[{oxid_include_widget nocookie=1 cl="jsonldWidget" noscript=1 aid=$oViewConf->getActArticleId()}]
\ No newline at end of file
[{assign var="oProduct" value=$oView->_getProduct()}]
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Product",
[{if $oView->jsonLdConf('jsonld_rating_enable')}]
[{if $oView->_productsAggregatedRatingsValue($oProduct) >= $oView->jsonLdConf('jsonld_rating_higher_than') || $oView->jsonLdConf('jsonld_rating_higher_than') == ''}]
"aggregateRating": {
"@type": "AggregateRating",
"ratingValue": "[{ $oView->_productsAggregatedRatingsValue($oProduct) }]",
"reviewCount": "[{ $oView->_productsAggregatedRatingsAmount($oProduct) }]"
},
[{/if}]
[{/if}]
[{if $oView->jsonLdConf('jsonld_shortdesc_enable')}]
"description": "[{ $oView->_productsShortdesc($oProduct) }]",
[{/if}]
[{if $oView->jsonLdConf('jsonld_sku_enable')}]
"sku": "[{ $oView->_productsSku($oProduct) }]",
[{/if}]
[{if $oView->jsonLdConf('jsonld_ean_enable')}]
[{if $oView->_productsEan($oProduct) != ''}]
"gtin13": "[{ $oView->_productsEan($oProduct) }]",
[{/if}]
[{/if}]
[{if $oView->jsonLdConf('jsonld_mpn_enable')}]
[{if $oView->_productsMpn($oProduct) != ''}]
"mpn": "[{ $oView->_productsMpn($oProduct) }]",
[{/if}]
[{/if}]
[{if $oView->jsonLdConf('jsonld_weight_enable')}]
[{if $oView->_productsWeight($oProduct) > 0}]
"weight": "[{ $oView->_productsWeight($oProduct) }]",
[{/if}]
[{/if}]
[{if $oView->jsonLdConf('jsonld_metrics_enable')}]
[{if $oView->_productsHeight($oProduct) > 0}]
"height": "[{ $oView->_productsHeight($oProduct) }] m",
[{/if}]
[{if $oView->_productsWidth($oProduct) > 0}]
"width": "[{ $oView->_productsWidth($oProduct) }] m",
[{/if}]
[{if $oView->_productsLength($oProduct) > 0}]
"depth": "[{ $oView->_productsLength($oProduct) }] m",
[{/if}]
[{/if}]
[{if $oView->jsonLdConf('jsonld_name_enable')}]
"name": "[{ $oView->_productsName($oProduct) }]",
[{/if}]
[{if $oView->jsonLdConf('jsonld_manufacturer_enable')}]
[{if $oView->_productsManufacturer($oProduct) != ''}]
"brand": "[{ $oView->_productsManufacturer($oProduct) }]",
[{/if}]
[{/if}]
[{if $oView->jsonLdConf('jsonld_category_enable')}]
[{if $oView->_productsCategory($oProduct) != ''}]
"category": "[{ $oView->_productsCategory($oProduct) }]",
[{/if}]
[{/if}]
[{if $oView->jsonLdConf('jsonld_image_enable') && $oView->_productsImage($oProduct)}]
"image": "[{ $oView->_productsImage($oProduct) }]",
[{/if}]
[{if $oView->jsonLdConf('jsonld_link_enable')}]
"url": "[{ $oView->_productsLink($oProduct) }]",
[{/if}]
[{if $oView->_productsHasVariants($oProduct) < 1}]
"offers": {
"@type": "Offer",
[{if $oView->jsonLdConf('jsonld_availability_enable')}]
[{if $oView->_productsBuyable($oProduct)}]
"availability": "http://schema.org/InStock",
[{else}]
"availability": "http://schema.org/OutStock",
[{/if}]
[{/if}]
[{if $oView->jsonLdConf('jsonld_new_enable')}]
"itemCondition": "http://schema.org/NewCondition",
[{/if}]
[{if $oView->jsonLdConf('jsonld_used_enable')}]
"itemCondition": "http://schema.org/UsedCondition",
[{/if}]
[{if $oView->jsonLdConf('jsonld_price_enable')}]
"price": "[{$oView->_productsPrice($oProduct)}]",
"priceCurrency": "[{$oView->_currencyName()}]"
[{/if}]
}
[{else}]
"offers": {
"offerCount": "[{$oView->_productsHasVariants($oProduct)}]",
"@type": "AggregateOffer",
[{if $oView->jsonLdConf('jsonld_price_enable')}]
[{if $oView->_productsHighPrice($oProduct) > 0}]
"highPrice": "[{$oView->_productsHighPrice($oProduct)}]",
[{/if}]
[{if $oView->_productsLowPrice($oProduct) > 0}]
"lowPrice": "[{$oView->_productsLowPrice($oProduct)}]",
[{/if}]
[{if $oView->jsonLdConf('jsonld_price_enable')}]
"priceCurrency": "[{$oView->_currencyName()}]",
[{/if}]
[{/if}]
"offers": [
[{assign var="articleList" value=$oView->_productsGetVariants($oProduct)}]
[{foreach from=$articleList key=index item="vProduct" name="productsVariants"}]
{
"@type": "Offer",
[{if $oView->jsonLdConf('jsonld_availability_enable')}]
[{if $oView->_productsBuyable($vProduct)}]
"availability": "http://schema.org/InStock",
[{else}]
"availability": "http://schema.org/OutStock",
[{/if}]
[{/if}]