File tree Expand file tree Collapse file tree 4 files changed +55
-2
lines changed
Review/view/frontend/layout Expand file tree Collapse file tree 4 files changed +55
-2
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \Catalog \Block \Product \View ;
10
+
11
+ /**
12
+ * Product details block.
13
+ *
14
+ * Holds a group of blocks to show as tabs.
15
+ *
16
+ * @api
17
+ */
18
+ class Details extends \Magento \Framework \View \Element \Template
19
+ {
20
+ /**
21
+ * Get sorted child block names.
22
+ *
23
+ * @param string $groupName
24
+ * @param string $callback
25
+ * @throws \Magento\Framework\Exception\LocalizedException
26
+ *
27
+ * @return array
28
+ */
29
+ public function getGroupSortedChildNames (string $ groupName , string $ callback ): array
30
+ {
31
+ $ groupChildNames = $ this ->getGroupChildNames ($ groupName , $ callback );
32
+ $ layout = $ this ->getLayout ();
33
+
34
+ $ childNamesSortOrder = [];
35
+
36
+ foreach ($ groupChildNames as $ childName ) {
37
+ $ alias = $ layout ->getElementAlias ($ childName );
38
+ $ sortOrder = (int )$ this ->getChildData ($ alias , 'sort_order ' ) ?? 0 ;
39
+
40
+ $ childNamesSortOrder [$ sortOrder ] = $ childName ;
41
+ }
42
+
43
+ ksort ($ childNamesSortOrder , SORT_NUMERIC );
44
+
45
+ return $ childNamesSortOrder ;
46
+ }
47
+ }
Original file line number Diff line number Diff line change 136
136
</arguments >
137
137
</block >
138
138
</container >
139
- <block class =" Magento\Catalog\Block\Product\View\Description " name =" product.info.details" template =" Magento_Catalog::product/view/details.phtml" after =" product.info.media" >
139
+ <block class =" Magento\Catalog\Block\Product\View\Details " name =" product.info.details" template =" Magento_Catalog::product/view/details.phtml" after =" product.info.media" >
140
140
<block class =" Magento\Catalog\Block\Product\View\Description" name =" product.info.description" as =" description" template =" Magento_Catalog::product/view/attribute.phtml" group =" detailed_info" >
141
141
<arguments >
142
142
<argument name =" at_call" xsi : type =" string" >getDescription</argument >
143
143
<argument name =" at_code" xsi : type =" string" >description</argument >
144
144
<argument name =" css_class" xsi : type =" string" >description</argument >
145
145
<argument name =" at_label" xsi : type =" string" >none</argument >
146
146
<argument name =" title" translate =" true" xsi : type =" string" >Details</argument >
147
+ <argument name =" sort_order" xsi : type =" string" >10</argument >
147
148
</arguments >
148
149
</block >
149
150
<block class =" Magento\Catalog\Block\Product\View\Attributes" name =" product.attributes" as =" additional" template =" Magento_Catalog::product/view/attributes.phtml" group =" detailed_info" >
150
151
<arguments >
151
152
<argument translate =" true" name =" title" xsi : type =" string" >More Information</argument >
153
+ <argument name =" sort_order" xsi : type =" string" >20</argument >
152
154
</arguments >
153
155
</block >
154
156
</block >
Original file line number Diff line number Diff line change 6
6
7
7
// @codingStandardsIgnoreFile
8
8
9
+ /** @var \Magento\Catalog\Block\Product\View\Details $block */
9
10
?>
10
- <?php if ($ detailedInfoGroup = $ block ->getGroupChildNames ('detailed_info ' , 'getChildHtml ' )):?>
11
+ <?php if ($ detailedInfoGroup = $ block ->getGroupSortedChildNames ('detailed_info ' , 'getChildHtml ' )):?>
11
12
<div class="product info detailed">
12
13
<?php $ layout = $ block ->getLayout (); ?>
13
14
<div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'>
Original file line number Diff line number Diff line change 19
19
</referenceContainer >
20
20
<referenceBlock name =" product.info.details" >
21
21
<block class =" Magento\Review\Block\Product\Review" name =" reviews.tab" as =" reviews" template =" Magento_Review::review.phtml" group =" detailed_info" ifconfig =" catalog/review/active" >
22
+ <arguments >
23
+ <argument name =" sort_order" xsi : type =" string" >30</argument >
24
+ </arguments >
22
25
<block class =" Magento\Review\Block\Form" name =" product.review.form" as =" review_form" ifconfig =" catalog/review/active" >
23
26
<container name =" product.review.form.fields.before" as =" form_fields_before" label =" Review Form Fields Before" />
24
27
</block >
You can’t perform that action at this time.
0 commit comments