@@ -11,7 +11,19 @@ $_paymentBlock = $block->getLayout()->getBlock('checkout.onepage.payment');
11
11
?>
12
12
13
13
<div class="opc-wrapper">
14
- <ol class="opc" id="checkoutSteps">
14
+ <ol class="opc"
15
+ id="checkoutSteps"
16
+ data-accordion='{
17
+ "collapsibleElement": " > li",
18
+ "openedState": "active"
19
+ }'
20
+ data-mage-init='{
21
+ "opcOrderReview": {
22
+ "checkoutAgreements": "#checkout-agreements",
23
+ "checkoutProgressContainer": "#checkout-progress-wrapper",
24
+ "methodDescription": ".items"
25
+ }
26
+ }'>
15
27
<?php $ i = 0 ; foreach ($ block ->getSteps () as $ _stepId => $ _stepInfo ): ?>
16
28
<?php if (!$ block ->getChildBlock ($ _stepId ) || !$ block ->getChildBlock ($ _stepId )->isShow ()): continue ; endif ; $ i ++ ?>
17
29
<li id="opc-<?php echo $ _stepId ?> " class="section<?php echo !empty ($ _stepInfo ['allow ' ]) ? ' allow ' : '' ?> <?php echo !empty ($ _stepInfo ['complete ' ]) ? ' saved ' : '' ?> ">
@@ -25,36 +37,11 @@ $_paymentBlock = $block->getLayout()->getBlock('checkout.onepage.payment');
25
37
</li>
26
38
<?php endforeach ?>
27
39
</ol>
28
- <script>
29
- require([
30
- "underscore",
31
- "accordion",
32
- "opcOrderReview",
33
- ], function(_, accordion, opcOrderReview){
34
- 'use strict';
35
-
36
- /**
37
- * @todo refactor opcCheckoutMethod
38
- *
39
- * Initializiation of this components can't be moved to a data-mage-init attribute
40
- * due to dependencies between instances of opcCheckoutMethod and mage.accordion.
41
- * Thus initializiation has to be synchronyous.
42
- */
43
- var elem = document.getElementById('checkoutSteps'),
44
- opcConfig;
45
-
46
- opcConfig = _.extend({
47
- 'checkoutAgreements': '#checkout-agreements',
48
- 'checkoutProgressContainer': '#checkout-progress-wrapper',
49
- 'methodDescription': '.items'
50
- },<?php echo $ this ->helper ('Magento\Core\Helper\Data ' )->jsonEncode ($ _paymentBlock ->getOptions ()); ?> );
51
-
52
- accordion({
53
- 'collapsibleElement': ' > li',
54
- 'openedState': 'active'
55
- }, elem);
56
-
57
- opcOrderReview(opcConfig, elem);
58
- });
59
- </script>
40
+ <script type="text/x-magento-init">
41
+ {
42
+ "#checkoutSteps": {
43
+ "opcOrderReview": <?php echo $ this ->helper ('Magento\Core\Helper\Data ' )->jsonEncode ($ _paymentBlock ->getOptions ()); ?>
44
+ }
45
+ }
46
+ </script>
60
47
</div>
0 commit comments