Guest User

Untitled

a guest
May 5th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.11 KB | None | 0 0
  1. <?xml version="1.0"?>
  2. <!--
  3. /**
  4. * Copyright © 2015 Magento. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. -->
  8. <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  9. <body>
  10. <referenceBlock name="checkout.root">
  11. <arguments>
  12. <argument name="jsLayout" xsi:type="array">
  13. <item name="components" xsi:type="array">
  14. <item name="checkout" xsi:type="array">
  15. <item name="children" xsi:type="array">
  16. <item name="steps" xsi:type="array">
  17. <item name="children" xsi:type="array">
  18. <item name="mynewstep" xsi:type="array">
  19. <item name="component" xsi:type="string">Sugarcode_Test/js/view/checkout/my-step-view</item>
  20. <!--To display step content before shipping step "sortOrder" value should be < 1-->
  21. <!--To display step content between shipping step and payment step 1 < "sortOrder" < 2 -->
  22. <!--To display step content after payment step "sortOrder" > 2 -->
  23. <item name="sortOrder" xsi:type="string">2</item>
  24. <item name="children" xsi:type="array">
  25. <!--add here child component declaration for your step-->
  26. </item>
  27. </item>
  28. </item>
  29. </item>
  30. </item>
  31. </item>
  32. </item>
  33. </argument>
  34. </arguments>
  35. </referenceBlock>
  36. </body>
  37. </page>
  38.  
  39. <!--The 'step_code' value from the .js file should be used-->
  40. <li id="mynewstep" data-bind="fadeVisible: isVisible">
  41. <div class="step-title" data-bind="i18n: 'Step Title'" data-role="title"></div>
  42. <div id="checkout-step-title"
  43. class="step-content"
  44. data-role="content">
  45.  
  46. <form data-bind="submit: navigateToNextStep" novalidate="novalidate">
  47. <div class="actions-toolbar">
  48. <div class="primary">
  49. <button data-role="opc-continue" type="submit" class="button action continue primary">
  50. <span><!-- ko i18n: 'Next'--><!-- /ko --></span>
  51. </button>
  52. </div>
  53. </div>
  54. </form>
  55. </div>
  56. </li>
  57.  
  58. define(
  59. [
  60. 'ko',
  61. 'uiComponent',
  62. 'underscore',
  63. 'Magento_Checkout/js/model/step-navigator'
  64. ],
  65. function (
  66. ko,
  67. Component,
  68. _,
  69. stepNavigator
  70. ) {
  71. 'use strict';
  72. /**
  73. *
  74. * mystep - is the name of the component's .html template,
  75. * my_module - is the name of the your module directory.
  76. *
  77. */
  78. return Component.extend({
  79. defaults: {
  80. template: 'Sugarcode_Test/checkout/mystep'
  81. },
  82.  
  83. //add here your logic to display step,
  84. isVisible: ko.observable(false),
  85.  
  86.  
  87. initialize: function () {
  88. this._super();
  89. // register your step
  90. stepNavigator.registerStep(
  91. //step code will be used as step content id in the component template
  92. 'mynewstep',
  93. //step alias
  94. 'mynewstep',
  95. //step title value
  96. 'My Step Title',
  97. //observable property with logic when display step or hide step
  98. this.isVisible,
  99.  
  100. _.bind(this.navigate, this),
  101.  
  102. /**
  103. * sort order value
  104. * 'sort order value' < 10: step displays before shipping step;
  105. * 10 < 'sort order value' < 20 : step displays between shipping and payment step
  106. * 'sort order value' > 20 : step displays after payment step
  107. */
  108. 15
  109. );
  110.  
  111. return this;
  112. },
  113.  
  114. /**
  115. * The navigate() method is responsible for navigation between checkout step
  116. * during checkout. You can add custom logic, for example some conditions
  117. * for switching to your custom step
  118. */
  119. navigate: function () {
  120. var self = this;
  121. //getPaymentInformation().done(function () {
  122. self.isVisible(true);
  123. // });
  124.  
  125. },
  126.  
  127.  
  128. navigateToNextStep: function () {
  129. stepNavigator.next();
  130. }
  131. });
  132. }
  133. );
Add Comment
Please, Sign In to add comment