Skip to content

Commit

Permalink
Merge pull request #28 from LoicMo43/main
Browse files Browse the repository at this point in the history
Fix Brand JSON Product Data
  • Loading branch information
NicolasBarbey authored Jul 5, 2024
2 parents 06b49e4 + 5473b1d commit 8c41b78
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 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.1</version>
<version>2.2.2</version>
<authors>
<author>
<name>Nicolas Barbey</name>
Expand Down
10 changes: 9 additions & 1 deletion Smarty/Plugins/BetterSeoMicroDataPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Thelia\Core\Event\Image\ImageEvent;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Exception\TaxEngineException;
use Thelia\Model\BrandI18nQuery;
use Thelia\Model\Category;
use Thelia\Model\CategoryQuery;
use Thelia\Model\ConfigQuery;
Expand Down Expand Up @@ -248,8 +249,15 @@ protected function getProductMicroData(Product $product, Lang $lang, $relatedPro
}

if ($brand = $product->getBrand()) {
$brandTitle = BrandI18nQuery::create()
->filterById($brand->getId())
->findOne()
->getTitle();
}

if ($brandTitle) {
$microData['brand']['@type'] = 'Brand';
$microData['brand']['name'] = $brand->getTitle();
$microData['brand']['name'] = $brandTitle;
}

if ($relatedProducts) {
Expand Down

0 comments on commit 8c41b78

Please sign in to comment.