Cant get the current postcode The Next CEO of Stack Overflowjquery ajax callback gets null dataGet the current page url in Magento 2.0Get current currency symbol in Magento2Get current theme in magento 2Magento 2 Checkout Missing Postcodeget subtotal value in magento 2.2How to get access token using oauth_consumer_key in Magento 2?Getting error 'Area is already set' while changing theme for Magento 2.2.4Magento 2 Amasty Layered Navigation. Remove display of current applied filtersGet Category URL multistore and multisite
Grabbing quick drinks
0 rank tensor vs 1D vector
How to check if all elements of 1 list are in the *same quantity* and in any order, in the list2?
How to avoid supervisors with prejudiced views?
Why does standard notation not preserve intervals (visually)
Domestic-to-international connection at Orlando (MCO)
Reference request: Grassmannian and Plucker coordinates in type B, C, D
A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See
Is it okay to majorly distort historical facts while writing a fiction story?
Prepend last line of stdin to entire stdin
Why, when going from special to general relativity, do we just replace partial derivatives with covariant derivatives?
Writing differences on a blackboard
Proper way to express "He disappeared them"
Solving system of ODEs with extra parameter
If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?
Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?
Would be okay to drive on this tire?
Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?
Can we say or write : "No, it'sn't"?
WOW air has ceased operation, can I get my tickets refunded?
Is there a way to save my career from absolute disaster?
Why didn't Khan get resurrected in the Genesis Explosion?
How to install OpenCV on Raspbian Stretch?
Rotate a column
Cant get the current postcode
The Next CEO of Stack Overflowjquery ajax callback gets null dataGet the current page url in Magento 2.0Get current currency symbol in Magento2Get current theme in magento 2Magento 2 Checkout Missing Postcodeget subtotal value in magento 2.2How to get access token using oauth_consumer_key in Magento 2?Getting error 'Area is already set' while changing theme for Magento 2.2.4Magento 2 Amasty Layered Navigation. Remove display of current applied filtersGet Category URL multistore and multisite
im having some issues getting the current or changed postcode from checkout input postcode and also trying to fired again the method from my component "getKiosPoints".
Basically the work flow is to check if a postcode is filled in the input, and if it is use it to make a call to a API to get the locations.
This works fine when the page is loaded with the information of postcode filled.
The problem is to get the postcode when is changed in the page, and than fire the method 'getKiospoints' with the postcoded that was inserted.
I was using the "quote.shippingAddress._latestValue.postcode" or the "quote.shippingAddress().postcode", but the problem is since is going to get in the storage, i always get the previous postcoded and not the actual that was just inserted.
Here is my code:
define([
'jquery',
'ko',
'Magento_Checkout/js/model/quote',
'uiComponent'
], function ($,ko,quote,Component)
'use strict';
var listLocations = ko.observableArray([]);
$(document).on('change',"[name='postcode']",function()
console.log("what postcalcode");
console.log(quote.shippingAddress().postcode);
);
return Component.extend(
defaults:
template: 'Cloud_Vasp/checkout/shipping/pickup-points'
,
getCode: function()
return 'cloud_vasp_cloud_vasp';
,
initObservable: function ()
this._super();
this.selectedMethod = ko.computed(function()
var method = quote.shippingMethod();
var selectedMethod = method != null ? method.carrier_code + '_' + method.method_code : null;
return selectedMethod;
, this);
return this;
,
getKiosPoints: function ()
var postalCode = quote.shippingAddress._latestValue.postcode;
console.log(postalCode);
$.ajax
(
type: "POST",
beforeSend: function (xhr)
xhr.setRequestHeader('Authorization', 'Bearer eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDc');
,
url: '...api/va.pt/GetServiceDeliveryPoints',
dataType: 'json',
contentType: 'application/json',
async: true,
//json object to sent to the authentication url
data: JSON.stringify(
"PostalCodeOrLocality": postalCode
),
success: function (data)
if(data.statusCode == 200)
var locations = data.response;
listLocations(data.response);
//return locations;
,
error: function( jqXhr, textStatus, errorThrown )
return errorThrown;
)
return listLocations;
);
);
Am i missing something?
magento knockout.js magento2 magento2.2
add a comment |
im having some issues getting the current or changed postcode from checkout input postcode and also trying to fired again the method from my component "getKiosPoints".
Basically the work flow is to check if a postcode is filled in the input, and if it is use it to make a call to a API to get the locations.
This works fine when the page is loaded with the information of postcode filled.
The problem is to get the postcode when is changed in the page, and than fire the method 'getKiospoints' with the postcoded that was inserted.
I was using the "quote.shippingAddress._latestValue.postcode" or the "quote.shippingAddress().postcode", but the problem is since is going to get in the storage, i always get the previous postcoded and not the actual that was just inserted.
Here is my code:
define([
'jquery',
'ko',
'Magento_Checkout/js/model/quote',
'uiComponent'
], function ($,ko,quote,Component)
'use strict';
var listLocations = ko.observableArray([]);
$(document).on('change',"[name='postcode']",function()
console.log("what postcalcode");
console.log(quote.shippingAddress().postcode);
);
return Component.extend(
defaults:
template: 'Cloud_Vasp/checkout/shipping/pickup-points'
,
getCode: function()
return 'cloud_vasp_cloud_vasp';
,
initObservable: function ()
this._super();
this.selectedMethod = ko.computed(function()
var method = quote.shippingMethod();
var selectedMethod = method != null ? method.carrier_code + '_' + method.method_code : null;
return selectedMethod;
, this);
return this;
,
getKiosPoints: function ()
var postalCode = quote.shippingAddress._latestValue.postcode;
console.log(postalCode);
$.ajax
(
type: "POST",
beforeSend: function (xhr)
xhr.setRequestHeader('Authorization', 'Bearer eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDc');
,
url: '...api/va.pt/GetServiceDeliveryPoints',
dataType: 'json',
contentType: 'application/json',
async: true,
//json object to sent to the authentication url
data: JSON.stringify(
"PostalCodeOrLocality": postalCode
),
success: function (data)
if(data.statusCode == 200)
var locations = data.response;
listLocations(data.response);
//return locations;
,
error: function( jqXhr, textStatus, errorThrown )
return errorThrown;
)
return listLocations;
);
);
Am i missing something?
magento knockout.js magento2 magento2.2
add a comment |
im having some issues getting the current or changed postcode from checkout input postcode and also trying to fired again the method from my component "getKiosPoints".
Basically the work flow is to check if a postcode is filled in the input, and if it is use it to make a call to a API to get the locations.
This works fine when the page is loaded with the information of postcode filled.
The problem is to get the postcode when is changed in the page, and than fire the method 'getKiospoints' with the postcoded that was inserted.
I was using the "quote.shippingAddress._latestValue.postcode" or the "quote.shippingAddress().postcode", but the problem is since is going to get in the storage, i always get the previous postcoded and not the actual that was just inserted.
Here is my code:
define([
'jquery',
'ko',
'Magento_Checkout/js/model/quote',
'uiComponent'
], function ($,ko,quote,Component)
'use strict';
var listLocations = ko.observableArray([]);
$(document).on('change',"[name='postcode']",function()
console.log("what postcalcode");
console.log(quote.shippingAddress().postcode);
);
return Component.extend(
defaults:
template: 'Cloud_Vasp/checkout/shipping/pickup-points'
,
getCode: function()
return 'cloud_vasp_cloud_vasp';
,
initObservable: function ()
this._super();
this.selectedMethod = ko.computed(function()
var method = quote.shippingMethod();
var selectedMethod = method != null ? method.carrier_code + '_' + method.method_code : null;
return selectedMethod;
, this);
return this;
,
getKiosPoints: function ()
var postalCode = quote.shippingAddress._latestValue.postcode;
console.log(postalCode);
$.ajax
(
type: "POST",
beforeSend: function (xhr)
xhr.setRequestHeader('Authorization', 'Bearer eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDc');
,
url: '...api/va.pt/GetServiceDeliveryPoints',
dataType: 'json',
contentType: 'application/json',
async: true,
//json object to sent to the authentication url
data: JSON.stringify(
"PostalCodeOrLocality": postalCode
),
success: function (data)
if(data.statusCode == 200)
var locations = data.response;
listLocations(data.response);
//return locations;
,
error: function( jqXhr, textStatus, errorThrown )
return errorThrown;
)
return listLocations;
);
);
Am i missing something?
magento knockout.js magento2 magento2.2
im having some issues getting the current or changed postcode from checkout input postcode and also trying to fired again the method from my component "getKiosPoints".
Basically the work flow is to check if a postcode is filled in the input, and if it is use it to make a call to a API to get the locations.
This works fine when the page is loaded with the information of postcode filled.
The problem is to get the postcode when is changed in the page, and than fire the method 'getKiospoints' with the postcoded that was inserted.
I was using the "quote.shippingAddress._latestValue.postcode" or the "quote.shippingAddress().postcode", but the problem is since is going to get in the storage, i always get the previous postcoded and not the actual that was just inserted.
Here is my code:
define([
'jquery',
'ko',
'Magento_Checkout/js/model/quote',
'uiComponent'
], function ($,ko,quote,Component)
'use strict';
var listLocations = ko.observableArray([]);
$(document).on('change',"[name='postcode']",function()
console.log("what postcalcode");
console.log(quote.shippingAddress().postcode);
);
return Component.extend(
defaults:
template: 'Cloud_Vasp/checkout/shipping/pickup-points'
,
getCode: function()
return 'cloud_vasp_cloud_vasp';
,
initObservable: function ()
this._super();
this.selectedMethod = ko.computed(function()
var method = quote.shippingMethod();
var selectedMethod = method != null ? method.carrier_code + '_' + method.method_code : null;
return selectedMethod;
, this);
return this;
,
getKiosPoints: function ()
var postalCode = quote.shippingAddress._latestValue.postcode;
console.log(postalCode);
$.ajax
(
type: "POST",
beforeSend: function (xhr)
xhr.setRequestHeader('Authorization', 'Bearer eyJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDc');
,
url: '...api/va.pt/GetServiceDeliveryPoints',
dataType: 'json',
contentType: 'application/json',
async: true,
//json object to sent to the authentication url
data: JSON.stringify(
"PostalCodeOrLocality": postalCode
),
success: function (data)
if(data.statusCode == 200)
var locations = data.response;
listLocations(data.response);
//return locations;
,
error: function( jqXhr, textStatus, errorThrown )
return errorThrown;
)
return listLocations;
);
);
Am i missing something?
magento knockout.js magento2 magento2.2
magento knockout.js magento2 magento2.2
asked Mar 8 at 15:46
CodeJamCodeJam
275
275
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have another suggestion. You can use onepage.html and apply the following code :-
require(
[
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/model/shipping-rate-processor/new-address',
'Magento_Checkout/js/model/shipping-rate-processor/customer-address',
'Magento_Customer/js/model/customer'
],
function ($, quote, shippingService, rateRegistry, defaultProcessor, customerAddressProcessor, customer)
$(document).on('change',"#shipping-new-address-form [name='postcode']",function(e)
var elementValue = $(this).val();
//Apply your code here
);
);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55066595%2fcant-get-the-current-postcode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have another suggestion. You can use onepage.html and apply the following code :-
require(
[
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/model/shipping-rate-processor/new-address',
'Magento_Checkout/js/model/shipping-rate-processor/customer-address',
'Magento_Customer/js/model/customer'
],
function ($, quote, shippingService, rateRegistry, defaultProcessor, customerAddressProcessor, customer)
$(document).on('change',"#shipping-new-address-form [name='postcode']",function(e)
var elementValue = $(this).val();
//Apply your code here
);
);
add a comment |
I have another suggestion. You can use onepage.html and apply the following code :-
require(
[
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/model/shipping-rate-processor/new-address',
'Magento_Checkout/js/model/shipping-rate-processor/customer-address',
'Magento_Customer/js/model/customer'
],
function ($, quote, shippingService, rateRegistry, defaultProcessor, customerAddressProcessor, customer)
$(document).on('change',"#shipping-new-address-form [name='postcode']",function(e)
var elementValue = $(this).val();
//Apply your code here
);
);
add a comment |
I have another suggestion. You can use onepage.html and apply the following code :-
require(
[
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/model/shipping-rate-processor/new-address',
'Magento_Checkout/js/model/shipping-rate-processor/customer-address',
'Magento_Customer/js/model/customer'
],
function ($, quote, shippingService, rateRegistry, defaultProcessor, customerAddressProcessor, customer)
$(document).on('change',"#shipping-new-address-form [name='postcode']",function(e)
var elementValue = $(this).val();
//Apply your code here
);
);
I have another suggestion. You can use onepage.html and apply the following code :-
require(
[
'jquery',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/model/shipping-service',
'Magento_Checkout/js/model/shipping-rate-registry',
'Magento_Checkout/js/model/shipping-rate-processor/new-address',
'Magento_Checkout/js/model/shipping-rate-processor/customer-address',
'Magento_Customer/js/model/customer'
],
function ($, quote, shippingService, rateRegistry, defaultProcessor, customerAddressProcessor, customer)
$(document).on('change',"#shipping-new-address-form [name='postcode']",function(e)
var elementValue = $(this).val();
//Apply your code here
);
);
answered Mar 11 at 7:00
Rakesh JakharRakesh Jakhar
43638
43638
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55066595%2fcant-get-the-current-postcode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown