File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
AreanetDefaultProductLayout
src/Core/Content/Product/Subscriber Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 88use Shopware \Core \Content \Product \AbstractPropertyGroupSorter ;
99use Shopware \Core \Content \Product \ProductDefinition ;
1010use Shopware \Core \Content \Product \SalesChannel \Price \AbstractProductPriceCalculator ;
11+ use Shopware \Core \Framework \Api \Context \AdminApiSource ;
12+ use Shopware \Core \Framework \Api \Context \SalesChannelApiSource ;
1113use Shopware \Core \Framework \DataAbstractionLayer \Entity ;
1214use Shopware \Core \Framework \DataAbstractionLayer \Event \EntityLoadedEvent ;
1315use 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 );
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments