Skip to content

Commit

Permalink
Add weight data
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicMo43 committed Jul 22, 2024
1 parent 7977e24 commit 3518053
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Config/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<language>en_US</language>
<language>fr_FR</language>
</languages>
<version>2.2.3</version>
<version>2.2.4</version>
<authors>
<author>
<name>Nicolas Barbey</name>
Expand Down
10 changes: 8 additions & 2 deletions Smarty/Plugins/BetterSeoMicroDataPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
use Thelia\Model\Category;
use Thelia\Model\CategoryQuery;
use Thelia\Model\ConfigQuery;
use Thelia\Model\Content;
use Thelia\Model\ContentQuery;
use Thelia\Model\Folder;
use Thelia\Model\FolderQuery;
Expand Down Expand Up @@ -251,6 +250,8 @@ protected function getProductMicroData(Product $product, Lang $lang, $relatedPro
$microData['gtin13'] = $pse->getEanCode();
}

$brandTitle = null;

if ($brand = $product->getBrand()) {
$brandTitle = BrandI18nQuery::create()
->filterById($brand->getId())
Expand All @@ -263,6 +264,11 @@ protected function getProductMicroData(Product $product, Lang $lang, $relatedPro
$microData['brand']['name'] = $brandTitle;
}


if ($weight = $pse->getWeight()) {
$microData['shipping_weight'] = $weight . ' ' .'kg';
}

if ($relatedProducts) {
foreach ($relatedProducts as $relatedProductId) {
$relatedProduct = ProductQuery::create()->filterById($relatedProductId)->findOne();
Expand Down Expand Up @@ -368,4 +374,4 @@ protected function getContentMicroData($contentId, Lang $lang)

return $microData;
}
}
}

0 comments on commit 3518053

Please sign in to comment.