Skip to content

Commit aa3e4d9

Browse files
fixed #1
1 parent fa4045a commit aa3e4d9

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## [1.0.1 / 2.0.1] - 2024-03-01
2+
3+
- fixed bug #1
4+
15
## [1.0.0 / 2.0.0] - 2024-02-16
26

37
- Inital implementation, set default layout for products in plugin config

AreanetDefaultProductLayout/src/Core/Content/Product/Subscriber/AreanetProductSubscriber.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Shopware\Core\Content\Product\AbstractPropertyGroupSorter;
99
use Shopware\Core\Content\Product\ProductDefinition;
1010
use Shopware\Core\Content\Product\SalesChannel\Price\AbstractProductPriceCalculator;
11+
use Shopware\Core\Framework\Api\Context\AdminApiSource;
12+
use Shopware\Core\Framework\Api\Context\SalesChannelApiSource;
1113
use Shopware\Core\Framework\DataAbstractionLayer\Entity;
1214
use Shopware\Core\Framework\DataAbstractionLayer\Event\EntityLoadedEvent;
1315
use Shopware\Core\Framework\Feature;
@@ -35,7 +37,13 @@ public static function getSubscribedEvents(): array
3537

3638
public function loaded(EntityLoadedEvent $event)
3739
{
38-
$salesChannelId = $event->getContext()->getSource()->getSalesChannelId();
40+
41+
$source = $event->getContext()->getSource();
42+
if(!($source instanceof SalesChannelApiSource)){
43+
return;
44+
}
45+
46+
$salesChannelId = $source->getSalesChannelId();
3947

4048
foreach ($event->getEntities() as $product) {
4149
$this->setDefaultLayout($product, $salesChannelId);

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ ___
1919

2020
## Changelog
2121

22+
## [1.0.1 / 2.0.1] - 2024-03-01
23+
24+
- fixed bug #1
25+
2226
### [1.0.0 / 2.0.0] - 2024-02-16
2327

2428
- Inital implementation, set default layout for products in plugin config

0 commit comments

Comments
 (0)