Schema.org products in OpenCart


In the product card file of your theme /catalog/view/theme/default/template/product/product.tpl you need to add a semantic markup code for the product in the end of the template.

<div itemscope itemtype="http://schema.org/Product" style="display: none;"> <!-- Hide block -->
	<meta itemprop="name" content="<?php echo $heading_title; ?>" /> <!-- Name product -->
  	<link itemprop="image" href="<?php echo $thumb; ?>" /> <!-- Url product image -->
  	<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" style="display: none;">
    	<meta itemprop="price" content='<? echo str_replace(array(" "," руб.","руб."), "", $price); ?>'> <!-- Price -->
    	<meta itemprop="priceCurrency" content="USD"> <!-- Currency -->
    	<?php
    		if ($quantity > 0){ /* If quantity of product > 0 so product in stock or if < 0 out of stock */
				echo "<link itemprop='availability' href='http://schema.org/InStock'>";
			} else {
				echo "<link itemprop='availability' href='http://schema.org/OutOfStock'>";
			}
    	?>
  	</div>
  	<meta itemprop="description" content="<?=strip_tags($description);?>" /> <!-- Product description -->
</div>



Connect

If you have any questions, want to get individual advice or you have an interesting offer, you can contact via the feedback form.

Or write to the email info@bobreod.ru





By submitting the form, you agree to our privacy policy