Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

Filter by
Sorted by
Tagged with
5
votes
1answer
3k views

How is product data passed from a Block to knockout template?

I'm investigating loading some product images via knockout templates. While looking for an example from the core I saw the minicart has this behaviour but right now i don't fully understand how the ...
0
votes
0answers
20 views

Magento 2 : How to add value to shipping address from

I am facing issue to add Dynamic value (Via Ajax) in shipping address I was trying to do so with JQuery but validations are failing But my text box has dynamic data assigned to it. please find some ...
3
votes
2answers
609 views

Magento 2 - Add success message with knockout

I need add an errorMessage or successMessage on checkout/cart after an jquery validation. I tried require file 'Magento_Ui/js/model/messageList' for this but not have success. My code: define( [ ...
0
votes
1answer
23 views

Call Function Inside Another In Knockout Js [on hold]

How to call a function inside another function in KnockoutJS Does anyone know how i can call one function inside another function in knockout js?
1
vote
1answer
24 views

Magento2 : How can i scroll up to first input error validation message on checkout

I saw some simillar questions, but they wanted to remove this feature. They suggested to comment some code in MAGENTO_ROOT/vendor/magento/magento2-base/lib/web/mage/validation.js file if (firstActive....
0
votes
0answers
20 views

magento 2 - admin create order authorize.net not working

I want to create order from admin/backend with authorize.net accept payment method. Here when we submit order first time it always gives me invalid request to gateway and found that opaqueData ...
0
votes
1answer
23 views

Magento2: How to call js function in custom file

I want to call a particular third party js function in my custom js file. XXX/YYY/view/frontend/web/js/view/payment/method-renderer/cashondelivery-method.js. define([ 'Magento_Checkout/js/...
0
votes
2answers
36 views

Magento 2 : How to get DefaultBillingAddress using knockout?

In core using KO address is get like this in details.html file <!-- ko text: currentBillingAddress().prefix --><!-- /ko --> <!-- ko text: currentBillingAddress().firstname -->&...
1
vote
0answers
131 views

Render getTemplate() in nested foreach

I am trying to update checkout page layout. What I want to do is to merge progress bar and checkout steps templates. I have updated my app/code/Vendor/Module/view/frontend/web/template/onepage.html ...
0
votes
1answer
594 views

Debugging Magento Checkout- Property getType of Null, when messing around with Billing and Shipping Address

I am doing some heavy customization on the checkout (pulling billing address to the first position, next to shipping address). If have added a plugin to view/shipping.js: define( [ '...
1
vote
1answer
1k views

Validation Error with jQuery-UI Autocomplete and KnockoutJs - Magento 2

The Problem: I've implemented jQuery-ui Autocomplete with Knockout Js in Checkout Page but some input fields that are binded to my Component throw a validation error ("Required Field") when i update ...
0
votes
0answers
13 views

How to show in mini cart only when there is at least one product in cart?

I had to add a text from admin configuration( some custom fields) on the mini cart section in frontend. I overrided minicart.phtml and in it I called the method from my Block which returns the ...
0
votes
1answer
22 views

Magento 2 Knockout JS - nested arrays

I've got nested arrays in my config JSON: Each Step node contains own products array. Foreach binding in a template for steps array works fine (the title value is displayed). However, I can't list ...
0
votes
0answers
9 views

Knockout subscribe activates onblur not on change for admin product SKU input

I have 2 inputs on the product form working correctly and firing every time there is a change but any other input I access in the same way as the working 2 is firing onblur or when it loses focus. Is ...
1
vote
2answers
610 views

how to trigger click event in M2

In my header section I have user name and if user have access to different location then he has button saying click me. I want to send ajax call on this button. But JS is not working. Can anybody help ...
0
votes
2answers
86 views

Magento 2.3.2 Failed to load the “Magento_Checkout/js/view/billing-address/list” component

I am using one-step checkout and getting an error in checkout console. and also page redirects to /noroute/ 404 page. [ERROR] Failed to load the "Magento_Checkout/js/view/billing-address/list" ...
0
votes
1answer
24 views

Magento 2 shipping method radio button not display selected on checkout

I have customized the checkout step to make one step checkout. everything is working fine but when I click on select shipping method radio button functionality is working but radio button not display ...
3
votes
3answers
2k views

Change Header Minicart container effect from dropdown to slide(right to left) in magento2

After added any product to cart we can see that item in minicart header. So when we click on minicart then it's show product with dropdown effect. I want to change this dropdown effect to slider from ...
0
votes
1answer
602 views

Magento2. Knockout. Translation doesn't work

Please advice is there any pre-requirements to translate in *.html files Works: <button type="submit" class="action primary"><span>Send link to a Friend</span></button> Don'...
0
votes
2answers
797 views

Binding Events On Dynamically Generated DOM Elements Knockout + Magento 2

I am working on a module where i have generated few DOM elements dynamically. But when i am trying to call certain function on some events then its not getting called. Here is the code sample. Here ...
4
votes
1answer
1k views

Magento 2.1. How to display select box instead of box in checkout shipping address?

As checkout page layout is mostly build in knockout.js and I have zero knowledge of knockout.js. I want to show shipping address in select box <select> instead of Box (ref to image - section 1) ...
0
votes
2answers
37 views

Magento 2: Translation is not working in html template using data-bind

I have inserted the string to translate into the app/i18n/lg_lG.csv file. I run the command to deploy static files, clean cache, but the string is not translated. The string is located in this file: ...
0
votes
0answers
23 views

Knockout observable admin form field in Magento 2

I would like to get the value of the SKU input in the admin product form. I am currently getting the value using jQuery but would like to start leveraging KnockoutJS. Simply put, instead of using ...
0
votes
1answer
34 views

Magento 2: Knockout JS dependent dropdowns

How can I create a pair of dropdowns such that when one is selected, the options for the other one are updated? The values for options for both dropdowns are coming from PHP. I have absolutely no ...
0
votes
1answer
53 views

Magento 2 : scope of knockout JS variable

Here's my code - define( [ 'ko', 'uiComponent', 'underscore', 'jquery', 'mage/url', 'Magento_Checkout/js/model/quote', 'Magento_Checkout/js/checkout-data', '...
0
votes
0answers
25 views

knockout js dropdown issue

I have 2 custom dropdowns. HTML: <div class="field"> <select name="addressGroup" data-bind="foreach: getAddressGroups(), value: phoenix"> <option data-bind="value: ...
0
votes
1answer
599 views

magento 2 custom component at checkout-step-shipping as shipping address child

I trying to add a custom template @ checkout between form customer login and shipping address inside div id="checkout-step-shipping" there are 2 forms : I've tried a few thing like 'before-form' etc....
1
vote
1answer
37 views

Knockout Js get value from Config

I want to see if my module is enabled in config are through html using Knockout JS. ko if: module_enabled ==1 show a button if not don't show a button But i get this following error Uncaught ...
1
vote
2answers
43 views

how to override core JS file in module

I am trying to override Magento_Braintree/js/view/payment/method-renderer/cc-form But i am not getting any progress. I have tried map 'Magento_Braintree/js/view/payment/method-renderer/cc-form': '...
0
votes
3answers
910 views

item count and subtotal in minicart in magento2

I want to display cart count and subtotal near Minicart. I have copied Minicart from Module_Checkout to my custom theme. It is displaying but i need use if condition for cart count if it is greater ...
0
votes
2answers
15 views

Magento 2: display shipping option initially

I have only one shipping method in my store (DHL). It comes with a lot of additional options. But those only show once I click on the method's radio button. This is where the magic somehow happens: ...
1
vote
0answers
29 views

How to get Order Id after place order in javascript?

I am defining placeOrder method in my payment method, here is my code: placeOrder: function (data, event) { var self = this; if (event) { event.preventDefault(); } if (this....
0
votes
1answer
28 views

Adding Minicart to custom header results in a empty cart in magento 2

I tried adding the mini cart phtml to my header like this <?php echo $this->getLayout()->createBlock('Magento\Checkout\Block\Cart\Sidebar')->setTemplate('Magento_Checkout::cart/minicart....
0
votes
1answer
113 views

Magento 2.x how to get ui-select selected value

I have place ui-select component and i want to get value in my custom component. How can i get selected value in custom component ? list.js file Here is my output.
7
votes
4answers
6k views

Magento 2 : Run/Execute Javascript after KnockoutJS has rendered all elements

I am trying to run custom Javascript code after the page is loaded completely with all the form elements/fields. I am trying this on Magento2 Admin while adding new product. For example: I ...
3
votes
2answers
98 views

Apply bindings and subscribe on change of discount amount totals.totals() in Magento 2

in my checkout page when promo code is applied, I am updating a text using some calculation using knockoutjs In my checkout page, on applying and removing promo code, it changes the discount key in ...
0
votes
1answer
638 views

Magento 2 EE Checkout Page not working (JS error)

I am facing an issue of knockout JS file on my site bixlercollegiate.com. My products are being added, but when I click on checkout, the page becomes blank. When I checked my console on Chrome, the ...
0
votes
2answers
643 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
1answer
19 views

Filter in custom grid doesn't work normally. Magento2

When I filter twice, it works fine after the third time display only one product in each row. grid_record_grid_list.xml <?xml version="1.0" encoding="UTF-8"?> <!-- /** * Grid record ...
2
votes
2answers
601 views

Get customer chosen shipping method with jQuery

How could i find out the shipping method that the customer has chosen right after click of change? I have tried to get shipping methods id or value that customer has chosen when he/she has clicked ...
1
vote
1answer
83 views

How to refresh shipping and billing address after checkout page load just like shipping Rates refresh using Knockout Js magento 2

Hi guys, i want to refresh shipping and billing address after checkout page load using Knockout Js magento 2. If you guys have any idea please guide me. Please check the code i tried below ...
0
votes
0answers
14 views

How to apply bindings and subscribe on change of discount amount totals.totals().items in Magento 2

In my checkout page, on applying and removing promo code, it changes the discount key in totals.totals().items. How to apply bindings and subscribe in knockoutjs, so that I can call my function which ...
0
votes
0answers
20 views

How to call a function on change of window.checkoutConfig data Magento 2

So, I am using window.checkoutConfig data in my js for some calculation. the function works well when called from HTML, but it doesn't run on itself when window.checkoutConfig data is changed. HTML ...
2
votes
1answer
711 views

Payment method with custom form in Knockout js

I've created a custom payment method successfully in Magento2. When this custom payment method selected, I need a form to display a text field and submit button that will hit some AJAX Api's using in ...
4
votes
1answer
834 views

Uncaught TypeError: Cannot read property 'apply' of undefined at Function.ko.observableArray.fn.(anonymous function) [as push]

I have created a custom attribute(multiselect) for product with the same filter type as category selection on Magento 2. Attribute selection is working fine when creating a new product however it is ...
2
votes
0answers
29 views

How to use ko.observable on change of data and run a js function Magento 2

How can I run a js function on change of data, So I have heard of knockoutjs ko.observable define([ 'uiComponent', 'ko', 'Magento_Checkout/js/model/totals' ], function (Component, ko, totals) { '...
0
votes
0answers
13 views

How to update product details(details.html) in checkout on applying promo code Magento 2

on the checkout page when the promo code is applied, I need to update the item details on the basis of some calculation of promo code for final sale I have to show final sale text dynamically when ...
0
votes
0answers
16 views

How to send data from cart page(phtml) to checkout page(html) for each item in knockout Magento 2

I am doing some calculation for final sale in cart page which is phtml, and I have show final sale in checkout page as well for each item. app/design/frontend/Mgs/yx_theme/Magento_Weee/templates/...
4
votes
2answers
340 views

Magento 2.2.4 = How to add new link on checkout page?

I have created 1 custom tab on the checkout page and it's working fine I follow below link to add the tab on cart page. Magento 2 - Add step on checkout I want to add a link name as "Create an ...
0
votes
1answer
41 views

Magento2: Knockout JS page in frontend give “404”

I have followed this tutorial link HOW TO USE KNOCKOUT JS ON A MAGENTO 2 FRONTEND PAGE. Magenest/KnockoutJs/etc/frontend/routes.xml : <?xml version="1.0"?> <config xmlns:xsi="http://www....