Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

Filter by
Sorted by
Tagged with
0
votes
1answer
537 views

Open Popup in checkout page

I need to create a popup for coupon code in checkout page.. In discount.js: showPopup: function () { alert("popup"); var couponcodepopup = { type: 'popup', ...
2
votes
1answer
234 views

Adding events to input on checkout

I'm trying to add an event like 'keyup: validationSuccess' to all input fields on the checkout. I have overwritten input.html and added the Js to Shipping.js but now when i go to checkout/cart.html I ...
0
votes
2answers
683 views

Accessing a JS function from another JS file

I'm trying to access a function from 'create-validation-list.js'. define([ 'jquery' ], function ($) { return createValidationList = function () { // Code } shipping.js define([ 'jquery', '...
3
votes
1answer
403 views

Working around knockout without need to compile

How can we work with knockout without having to compile the Magento every time? I have disabled all cache and set Magento on developer mode but still, it needs to compile and clear cache.
1
vote
0answers
98 views

Theme without require.js, knockout.js, AngularJS

I'm evaluating a the moment Magento2 as a solution for our Shop and I looked into a lot of Shops based on Magento2 to test the frontend performance and to be honest, I'm shocked. Every Shop I saw ...
4
votes
3answers
179 views

Best source for Knockout js

As a beginner, can anyone tell me which is the best source to learn how the knockout js works in magento2? I have tried learning from http://knockoutjs.com/ but it does not give the detailed idea for ...
0
votes
1answer
1k views

Magento 2 knockout Select options not returning the value

I have Created custom component with select drop down when I select an option and alert the select option it spits out : function observable() { if (arguments.length > 0) { ...
1
vote
3answers
630 views

M2: How to get storeId in javascript?

I'am adding a new validation rule. The result should depend on storeview code. How can I get the storeId in the following javascript code? validator-mixin.js define([ 'jquery' ], function ($) {...
1
vote
1answer
625 views

Magento 2, why data-mage-init validation not working when I use knockout component

I have a phtml file with a form that used data-mage-init <form data-mage-init='{"validation": {}}' class="form" id="custom-form" method="post" autocomplete="off"> </form> and then I ...
1
vote
0answers
77 views

Magento2 : knock out js

I would like to change the changes in checkout page address fields, how to remove the fields or update, the code is knockout js. How to modify this. <div class="address-information address-info-...
2
votes
1answer
379 views

How the list.html(Magento_Checkout/web/template/payment-methods/list.html) is works to render and display the payment methods in checkout page

I wish to know how the list.html works while displaying the payment methods. 1)How it loops to display the payment methods using below template list.html <div if="isPaymentMethodsAvailable()" ...
1
vote
1answer
459 views

Magento 2 - how to load JS template from filesystem in jquery widget

For example, native Magento theme-frontend-blank\web\js\navigation-menu.js has such code: $.widget('mage.navigationMenu', { options: { ... collapsableDropdownTemplate: '&...
0
votes
1answer
928 views

Uncaught TypeError: Cannot read property 'top' of undefined at step-navigator.js

I am getting following error. Uncaught TypeError: Cannot read property 'top' of undefined at step-navigator.js:158 I have created a custom step using Magento 2 documentation http://devdocs....
1
vote
0answers
60 views

How do I edit KO template in magento 2

I wish to edit /var/www/html/xxx/vendor/magento/module-checkout/view/frontend/web/template/payment-methods/list.html Exactly in below line, Because which is the responsible file to render the ...
0
votes
1answer
704 views

Magento 2 : How Can I get Selected Payment Details on Next Step

Using knockout js, I have created a custom step, which I have place after payment method. I need to show which payment method was selected by the user. I am creating a custom step as summary step. I ...
0
votes
1answer
270 views

Not showing messages at onestepcheckout in magento 2.2.x

After the ajax process get the error from the payment api i can see that the Magento_Ui/js/model/messages.js it triggered and the message should be added to the list but I cant see anything in the ...
0
votes
1answer
376 views

Uncaught TypeError: utils.convertToMomentFormat is not a function

I am working on a Magento 2.1.7 shop. To achieve this, I have created a child-theme of Magento Blank. Whenever I go, within the Magento admin, to Content > Blocks, there is this error in the console: ...
0
votes
2answers
1k views

Magento 2 checkout knockout.js in custom template error - telephone field

I'm trying to create a mask for telephone field in Magento 2.2.2 checkout. In order to do so. I placed a checkout_index_index.xml with a new template for telephone field at vendor/mytheme/...
1
vote
2answers
1k views

Magento 2 : Remove Billing Address From Payment Step in Checkout

In the payment step under checkout in Magento 2, I'm trying to remove the address and the option: 'My billing and shipping address are the same '. Because I have added billing address to shipping step....
0
votes
1answer
256 views

Magento 2 : How Can I Override Step-Navigator File From Checkout

I want to override step-navigator js file. I had followed this method How to extend js class/method of checkout model class in magento 2 but it didn't work. any help. I want to override this method. ...
0
votes
1answer
94 views

How to replace knockout with old school layout xml and phtml

Let me be straight: knockout.js is a pain in my sitting device. It creates yet another layer of abstraction, is hard to debug, creates enormous overhead (more files, more code, more possibilities for ...
2
votes
1answer
967 views

Go to next step after submitting custom form in Magento 2 checkout

I created a module to add a new step to the Magento 2 checkout. This step has a custom form. On submitting the form I can't figure out how to go the the next step. checkout_index_index.xml <page ...
3
votes
1answer
1k views

How to get the Quote Id from Masked Quote Id (QuoteIdMask) in magento 2

I need to do something after applying the coupon code in the checkout page, So I have created the ajax call in the response of set-coupon-code.js in Sales Rule module. But I got the Masked quote Id ...
0
votes
1answer
215 views

How to access custom data from a customer session in JS file?

Is there any way to access custom data stored in a customer session from a JS file ( without Ajax call ). Here is the code for controller: <?php namespace Company\Vendor\Controller\Index; use ...
1
vote
1answer
834 views

Magento 2 - Display product collections some column using knockout js binding

I am trying to display product collection using knockout js binding. But not working. Please guide me. Also in Magento2 is require to manually applyBinding when using component.? Also please anyone ...
0
votes
2answers
629 views

Magento 2 - How to use 'if…elseif…else' condition in knockout html? [duplicate]

I want to add a condition if...elseif...else in a knockout HTML file. I tried to add the condition like this, <!-- ko if: condition 1 --> [...] <!-- /ko --> <!-- ko elseif: ...
1
vote
0answers
45 views

How to List out product collection in simple table using knowckout js [duplicate]

I have code like below i have tried to implement it with magento custom module.but didn't get it working as it should can any one please guide me how can i implement this.Here i just want to list down ...
0
votes
1answer
242 views

Add class to input element if field is required

In UIs ko template for an input field... theme\Magento_Ui\web\templates\form\element\input.html I would like it to have the class "required" depending on if the field's input actually IS required. ...
0
votes
1answer
204 views

How to show credit card details, address and cart items before placing order?

Is there any way to accomplish this at checkout in magento 2?
1
vote
0answers
174 views

What's the point/gain/advantage of knockout.js in Magento 2? [closed]

I am trying not to let this slide into a rant. I am a long time magento 1 developer and just recently started with m2. I was really excited about the prospects of greater performance and the absense ...
0
votes
1answer
228 views

Render minicart without dropdown dialog

I want to move the minicart to an offcanvas sidebar (foundation 6). I was able to move the minicart vial layout. But it keeps rendering as a dropdown dialog (magento ui) so I would like the cart's ...
2
votes
1answer
1k views

Magento 2: Minicart Failed to load the “Magento_SalesRule/js/view/payment/discount” component

I am working on MiniCart Extension in which I need a coupon code text box in my Minicart. For that I have overridden default.xml in my Custom Module but everytime It returns following error in the ...
2
votes
1answer
329 views

How to set discount value in .js file magento2

I have followed https://webkul.com/blog/set-custom-discount-fee-cart-magento-2/ to get dynamic value. I tried below code. define( [ 'jquery', 'Magento_Checkout/js/view/summary/...
0
votes
1answer
249 views

How to add defer to a custom JS script in magento 2.x

I need to add a custom script in my module and that script requires me to add defer in it. I have added the script in the requirejs-config.js file. But i am cannot see that script working. Although i ...
1
vote
1answer
213 views

Declare 'instance variables' in knockoutjs component?

I'm trying to create a variable in my knockoutjs component that I can reference later on, and it's not really working, and i'm not sure why, can anyone give me some tips on how to access the "text" ...
3
votes
0answers
67 views

Magento 2: Call extension on new checkout tab

To create the new tab on the checkout page I used this link and it is working How to add new steps or tab to the checkout page in Magento2 I want to display this extension on new created tab magento2-...
1
vote
0answers
278 views

Magento 2 knockout js check variable value to specific value

I want to check knockout variable value equal to 1 below is my code: But above code is not working. giving me console error Unable to process binding
2
votes
2answers
3k views

Magento2 : checkbox change function in knockout js

I need to add one checkbox on checkout and call one function on checkbox change event, how can I do that? Check this screenshot for better understanding exactly what I need.
5
votes
2answers
5k views

Knockout If-else condition inside html file in Magento 2

I am customizing the shopping cart page, Here I worked knockout js and html code file. I successfully wrote If statement by below code. <!-- ko if: isFreeShipping() --> //My Code goes here &...
1
vote
0answers
335 views

How add mask to input with knockout javascript?

I need to add a mask to postcode input (ex: 99.999-99), so I have Vendor/Theme/Magento_Checkout/web/template/form/element/zipcode.html with: <input class="input-text col s12 zipcode" type="text" ...
3
votes
2answers
1k views

Magento 2 update progress bar in check out page

What I've tried: i18n/en_GB I've changed this line "Review & Payments,Reviewssss & Paymentsssss" I've also changed this Shipping Methods, This Is my shipping methods and I was surprised to ...
0
votes
1answer
124 views

Cod Message in Magento2?

how to show custom configure message in cod payment method in magento2.. already refer these link.... How to display instructions for custom payment method Magento 2: add html in custom Payment ...
0
votes
1answer
463 views

Magento 2 : How to change input tags value dynamically which is rendered by knockout js?

I need to change product enable option to keep in disabled by default. I used data-index in css to hide the input which works fine but I need to change input tags value. My phtml to switch check box ...
3
votes
2answers
2k views

Magento 2: Shipping Methods not reload automatically

I have problem regarding Shipping Methods update. Shipping Methods value does not update automatically. I have to reload the page every time, so can anybody have a solution for this. I added a custom ...
1
vote
2answers
463 views

Magento 2 - Checkout aria-invalid=“false”

Im not sure if this is a bug, or it's me being silly. What I'm trying to achieve is in the checkout and on an input is the following: aria-invalid="null" However what I've noticed is on initial ...
2
votes
0answers
567 views

Magento 2 Knockout Shipping Method checked in shipping.html

I am looking for solution On checkout page where all shipping methods are loaded. File path is vendor/magento/module-checkout/view/frontend/web/template/shipping.html From above file we can see the ...
1
vote
2answers
2k views

Magento 2 : Display Loader While Ajax call in custom Knockout js

I am using this extension which adds extra fee to quote after select a particular payment. After selecting any payment option it is making an ajax call, I want to show loader until the ajax request is ...
1
vote
1answer
155 views

M2 Can't add new Checkout Step

I'm following the Magento dev docs Add a new checkout step how to guide. But I get the following error in my browser console once I go to the checkout... GET http://example.test/checkout/...
1
vote
0answers
483 views

Magento 2.2.1 : Add Custom Field in Login Form On Checkout Page

I have added custom field in checkout page using below code: $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children'] ['shippingAddress']['children']['...
3
votes
1answer
2k views

add custom js to the certain input element on the checkout page

My final goal adds custom js to the certain input element on the checkout page what i tried To get element with uiRegistry and on redner add needed code, but failed, i can work with tjis element ...