Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
W Wiki
  • Project overview
    • Project overview
    • Details
    • Activity
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
Collapse sidebar
  • Tutoriais
  • Wiki
  • Wiki
    • Magento
  • SimpleSchema

SimpleSchema · Changes

Page history
Create Magento/SimpleSchema authored Aug 27, 2019 by Jonatan Machado's avatar Jonatan Machado
Hide whitespace changes
Inline Side-by-side
Showing with 38 additions and 0 deletions
+38 -0
  • Magento/SimpleSchema.md Magento/SimpleSchema.md +38 -0
  • No files found.
Magento/SimpleSchema.md 0 → 100644
View page @ 021230ab
`
<?php
$priceSchema = $_product->getFinalPrice();
$nameSchema = $_product->getName();
$skuSchema = $_product->getSku();
$eanSchema = $_product->getEan();
$descriptionSchema = $_product->getShortDescription() ? $this->stripTags($_product->getShortDescription()) : $this->stripTags($_product->getDescription());
$urlProdSchema = $_product->getUrl();
$stockSchema = $_product->getIsInStock() ? 'https://schema.org/InStock' : 'https://schema.org/OutOfStock';
$imageSchema = '';
foreach ($_product->getMediaGalleryImages() as $image) {
$imageSchema .= '"' . $image->getUrl() . '",';
}
?>
<script type="application/ld+json">
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "<?php echo str_replace('"','',$nameSchema); ?>",
"image": [
<?php echo substr_replace($imageSchema, '', -1); ?>
],
"description": "<?php echo str_replace('"','',$descriptionSchema); ?>",
"sku": "<?php echo $skuSchema;?>",
"offers": {
"@type": "Offer",
"url": "<?php echo $urlProdSchema ?>",
"priceCurrency": "BRL",
"price": "<?php echo $priceSchema ?>",
"availability": "<?php echo $stockSchema ?>"
}
}
</script>
`
\ No newline at end of file
Clone repository
  • Gitlab
    • Comandos
  • Hotfix
    • og:image
  • Magento
    • Htaccess
    • MagentoCronChecker
    • Robots
    • SimpleSchema
    • Soap v2 Tester
    • gitignore
  • Migração
    • leg.br
  • Padrões
    • eslint
    • prettier
  • Plugins
    • Adicionar informações extras ao texto copiado da web
  • QueryCommerce
  • Servidores
    • Cloudways
    • DnsMadeEasy
View All Pages