Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit 50117b8

Browse files
authored
Merge branch 'master' into dobooth-patch-1
2 parents 4210899 + 75edca4 commit 50117b8

File tree

3 files changed

+121
-125
lines changed

3 files changed

+121
-125
lines changed

src/guides/v2.3/graphql/queries/directory-country.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,10 @@ The query returns a single `Country` object.
112112

113113
* [countries query]({{page.baseurl}}/graphql/queries/directory-countries.html)
114114
* [currency query]({{page.baseurl}}/graphql/queries/directory-currency.html)
115+
116+
## Errors
117+
118+
Error | Description
119+
--- | ---
120+
`Country \"id\" value should be specified"` | The Country ID value must be specified to find the mapped country.
121+
`The country isn't available` | There is no country mapped to the given country ID.

src/guides/v2.3/howdoi/checkout/checkout_new_step.md

Lines changed: 112 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -29,99 +29,89 @@ To create the view part of the new checkout step:
2929

3030
1. Add a module directory (not covered in this topic). See [Build your module]({{ page.baseurl }}/extension-dev-guide/build/build.html) for details). All custom files must be stored there. For your checkout customization to be applied correctly, your custom module should depend on the `Magento_Checkout` module. Do not use `Ui` for your custom module name, because `%Vendor%_Ui` notation, required when specifying paths, might cause issues.
3131
1. [Create the `.js` file implementing the view model](#component).
32-
1. [Create an `.html` template for the component](#html-template).
32+
1. [Create a `.html` template for the component](#html-template).
3333

3434
### Add the JavaScript file implementing the new step {#component}
3535

3636
A new checkout step must be implemented as UI component. That is, its [JavaScript](https://glossary.magento.com/javascript) implementation must be a JavaScript module.
3737

3838
The file must be stored under the `<your_module_dir>/view/frontend/web/js/view` directory.
3939

40-
{:.bs-callout-info}
40+
{:.bs-callout-info}
4141
`<your_module_dir>` notation stands for the path to your module directory from the root directory. Usually it will be one of the following: `app/code/<YourVendor>/<YourModule>` or `vendor/<yourvendor>/module-<module>-<name>`. For more details see [Conventional notations for paths to modules and themes]({{ page.baseurl }}/frontend-dev-guide/conventions.html)
4242

4343
A sample `my-step-view.js` with comments follows:
4444

4545
```js
46-
define(
47-
[
48-
'ko',
49-
'uiComponent',
50-
'underscore',
51-
'Magento_Checkout/js/model/step-navigator'
52-
],
53-
function (
54-
ko,
55-
Component,
56-
_,
57-
stepNavigator
58-
) {
59-
'use strict';
46+
define([
47+
'ko',
48+
'uiComponent',
49+
'underscore',
50+
'Magento_Checkout/js/model/step-navigator'
51+
], function (ko, Component, _, stepNavigator) {
52+
'use strict';
53+
54+
/**
55+
* mystep - is the name of the component's .html template,
56+
* <Vendor>_<Module> - is the name of your module directory.
57+
*/
58+
return Component.extend({
59+
defaults: {
60+
template: '<Vendor>_<Module>/mystep'
61+
},
62+
63+
// add here your logic to display step,
64+
isVisible: ko.observable(true),
65+
66+
/**
67+
* @returns {*}
68+
*/
69+
initialize: function () {
70+
this._super();
71+
72+
// register your step
73+
stepNavigator.registerStep(
74+
// step code will be used as step content id in the component template
75+
'step_code',
76+
// step alias
77+
null,
78+
// step title value
79+
'Step Title',
80+
// observable property with logic when display step or hide step
81+
this.isVisible,
82+
83+
_.bind(this.navigate, this),
84+
85+
/**
86+
* sort order value
87+
* 'sort order value' < 10: step displays before shipping step;
88+
* 10 < 'sort order value' < 20 : step displays between shipping and payment step
89+
* 'sort order value' > 20 : step displays after payment step
90+
*/
91+
15
92+
);
93+
94+
return this;
95+
},
96+
97+
/**
98+
* The navigate() method is responsible for navigation between checkout steps
99+
* during checkout. You can add custom logic, for example some conditions
100+
* for switching to your custom step
101+
* When the user navigates to the custom step via url anchor or back button we_must show step manually here
102+
*/
103+
navigate: function () {
104+
this.isVisible(true);
105+
},
106+
60107
/**
61-
*
62-
* mystep - is the name of the component's .html template,
63-
* <Vendor>_<Module> - is the name of the your module directory.
64-
*
65-
*/
66-
return Component.extend({
67-
defaults: {
68-
template: '<Vendor>_<Module>/mystep'
69-
},
70-
71-
//add here your logic to display step,
72-
isVisible: ko.observable(true),
73-
74-
/**
75-
*
76-
* @returns {*}
77-
*/
78-
initialize: function () {
79-
this._super();
80-
// register your step
81-
stepNavigator.registerStep(
82-
//step code will be used as step content id in the component template
83-
'step_code',
84-
//step alias
85-
null,
86-
//step title value
87-
'Step Title',
88-
//observable property with logic when display step or hide step
89-
this.isVisible,
90-
91-
_.bind(this.navigate, this),
92-
93-
/**
94-
* sort order value
95-
* 'sort order value' < 10: step displays before shipping step;
96-
* 10 < 'sort order value' < 20 : step displays between shipping and payment step
97-
* 'sort order value' > 20 : step displays after payment step
98-
*/
99-
15
100-
);
101-
102-
return this;
103-
},
104-
105-
/**
106-
* The navigate() method is responsible for navigation between checkout step
107-
* during checkout. You can add custom logic, for example some conditions
108-
* for switching to your custom step
109-
* When the user navigates to the custom step via url anchor or back button we_must show step manually here
110-
*/
111-
navigate: function () {
112-
113-
this.isVisible(true);
114-
},
115-
116-
/**
117-
* @returns void
118-
*/
119-
navigateToNextStep: function () {
120-
stepNavigator.next();
121-
}
122-
});
123-
}
124-
);
108+
* @returns void
109+
*/
110+
navigateToNextStep: function () {
111+
stepNavigator.next();
112+
}
113+
});
114+
});
125115
```
126116

127117
### Add the .html template {#html-template}
@@ -133,7 +123,7 @@ A sample `mystep.html` follows:
133123
```html
134124
<!--The 'step_code' value from the .js file should be used-->
135125
<li id="step_code" data-bind="fadeVisible: isVisible">
136-
<div class="step-title" data-bind="i18n: 'Step Title'" data-role="title"></div>
126+
<div class="step-title" data-bind="i18n: 'Step Title'" data-role="title"></div>
137127
<div id="checkout-step-title"
138128
class="step-content"
139129
data-role="content">
@@ -163,39 +153,39 @@ A sample `checkout_index_index.xml` follows:
163153
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
164154
<body>
165155
<referenceBlock name="checkout.root">
166-
<arguments>
167-
<argument name="jsLayout" xsi:type="array">
168-
<item name="components" xsi:type="array">
169-
<item name="checkout" xsi:type="array">
170-
<item name="children" xsi:type="array">
171-
<item name="steps" xsi:type="array">
172-
<item name="children" xsi:type="array">
173-
<!-- The new step you add -->
174-
<item name="my-new-step" xsi:type="array">
175-
<item name="component" xsi:type="string">%Vendor%_%Module%/js/view/my-step-view</item>
176-
<!--To display step content before shipping step "sortOrder" value should be < 1-->
177-
<!--To display step content between shipping step and payment step 1 < "sortOrder" < 2 -->
178-
<!--To display step content after payment step "sortOrder" > 2 -->
179-
<item name="sortOrder" xsi:type="string">2</item>
180-
<item name="children" xsi:type="array">
181-
<!--add here child component declaration for your step-->
182-
</item>
156+
<arguments>
157+
<argument name="jsLayout" xsi:type="array">
158+
<item name="components" xsi:type="array">
159+
<item name="checkout" xsi:type="array">
160+
<item name="children" xsi:type="array">
161+
<item name="steps" xsi:type="array">
162+
<item name="children" xsi:type="array">
163+
<!-- The new step you add -->
164+
<item name="my-new-step" xsi:type="array">
165+
<item name="component" xsi:type="string">%Vendor%_%Module%/js/view/my-step-view</item>
166+
<!--To display step content before shipping step "sortOrder" value should be < 1-->
167+
<!--To display step content between shipping step and payment step 1 < "sortOrder" < 2 -->
168+
<!--To display step content after payment step "sortOrder" > 2 -->
169+
<item name="sortOrder" xsi:type="string">2</item>
170+
<item name="children" xsi:type="array">
171+
<!--add here child component declaration for your step-->
183172
</item>
184173
</item>
185174
</item>
186175
</item>
187176
</item>
188177
</item>
189-
</argument>
190-
</arguments>
178+
</item>
179+
</argument>
180+
</arguments>
191181
</referenceBlock>
192182
</body>
193183
</page>
194184
```
195185

196186
## Step 3: Create mixins for payment and shipping steps (optional) {#create-mixin}
197187

198-
If your new step is the first step, you have to create mixins for the payment and shipping steps. Otherwise two steps will be activated on loading of the checkout.
188+
If your new step is the first step, you have to create mixins for the payment and shipping steps. Otherwise, two steps will be activated on the loading of the checkout.
199189

200190
Create a mixin as follows:
201191

@@ -219,28 +209,27 @@ Create a mixin as follows:
219209
1. Create the mixin. We'll use the same mixin for both payment and shipping:
220210

221211
```js
222-
define(
223-
[
224-
'ko'
225-
], function (ko) {
226-
'use strict';
227-
228-
var mixin = {
229-
230-
initialize: function () {
231-
this.isVisible = ko.observable(false); // set visible to be initially false to have your step show first
232-
this._super();
233-
234-
return this;
235-
}
236-
};
237-
238-
return function (target) {
239-
return target.extend(mixin);
240-
};
241-
}
242-
);
212+
define([
213+
'ko'
214+
], function (ko) {
215+
'use strict';
216+
217+
var mixin = {
218+
219+
initialize: function () {
220+
// set visible to be initially false to have your step show first
221+
this.isVisible = ko.observable(false);
222+
this._super();
223+
224+
return this;
225+
}
226+
};
227+
228+
return function (target) {
229+
return target.extend(mixin);
230+
};
231+
});
243232
```
244233

245-
{:.bs-callout-info}
234+
{:.bs-callout-info}
246235
For your changes to be applied, you might need to [clean layout cache]({{ page.baseurl }}/config-guide/cli/config-cli-subcommands-cache.html ) and [static view file cache]({{ page.baseurl }}/frontend-dev-guide/cache_for_frontdevs.html#clean_static_cache). For more info on mixins, see [JS Mixins]({{ page.baseurl }}/javascript-dev-guide/javascript/js_mixins.html).

src/guides/v2.3/javascript-dev-guide/javascript/js-resources.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ JS resources are accessed using relative paths.
3737
**Example 1:**
3838

3939
* File actual location: `app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js`
40-
* File published to `pub/static`: `pub/static/frontend/Magento/<theme>/<locale>/Magento_ConfigurableProduct/js/configurable.js`. Here `<theme>` and `<locale>` are the currently applied in your instance [theme](https://glossary.magento.com/theme) and [locale](https://glossary.magento.com/locale).
40+
* File published to `pub/static`: `pub/static/frontend/<Vendor>/<theme>/<locale>/Magento_ConfigurableProduct/js/configurable.js`. Here `<theme>` and `<locale>` are the currently applied in your instance [theme](https://glossary.magento.com/theme) and [locale](https://glossary.magento.com/locale).
4141
* Called in script:
4242

4343
```javascript
@@ -59,7 +59,7 @@ JS resources are accessed using relative paths.
5959
**Example 3:**
6060

6161
* File actual location: `lib/web/jquery.js`
62-
* File published to `pub/static`: `pub/static/<area>/Magento/<theme>/<locale>/jquery.js`
62+
* File published to `pub/static`: `pub/static/<area>/<Vendor>/<theme>/<locale>/jquery.js`
6363
* Called in script:
6464

6565
```javascript

0 commit comments

Comments
 (0)