<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Microdata for Products</title>
</head>
<body>
<?php
require_once("MicrodataGenerator.php");
$product = new Microdata\Product();
$product->setName("example name");
$product->setUrl("principeorazio.wordpress.com");
$product->setDescription("short description for the product");
$product->setBrand("Principe Orazio");
$product->setManufacturer("Princex");
$product->setModel("Microdata Tag Generator");
$product->setProductId("1");
$product->setRatingValue(4);
$product->setReviewsCount(8);
$product->setPrice("100 €");
$product->setCondition(\Microdata\iMicrodata::CONDITION_NEW, "new");
echo $product->getCompleteCode();
?>
<hr />
Example using single terms
<?=$product->openSchemaCode()?>
<?=$product->getUrlCode()?>
<?=$product->getDescriptionCode()?>
<?=$product->getBrandCode("Brand: ")?>
<?=$product->getManufacturerCode("Manufactor: ")?>
<div>Model: <?=$product->getModelCode()?></div>
<div>Product ID: <?=$product->getProductIdCode()?></div>
<div>
<?=$product->getAggregateRating()->openSchemaCode()?>
<span>Stars <?=$product->getAggregateRating()->getRatingValueCode()?></span>
<span>Based on <?=$product->getAggregateRating()->getReviewCountCode()?> reviews</span>
<?=$product->getAggregateRating()->closeSchemaCode()?>
</div>
<div>
<?=$product->getOffer()->openSchemaCode()?>
Price
<?=$product->getOffer()->getPriceCode()?>
<?=$product->getOffer()->closeSchemaCode()?>
</div>
<?=$product->closeSchemaCode()?>
</body>
</html>
|