Questions tagged [knockout]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
0answers
30 views

How to pass value from template.html to js in magento 2 knockout js when complete entering the input field?

1) I need to pass the phone number value to the telephone.js when complete entering the number before the button click. 2)Below the phone number field, I added the OTP input field (i added it in the ...
1
vote
0answers
51 views

How to add selected items on a page to a separate block in Magento 2?

Please help with the implementation of this functionality. I have a separate module with a separate route. There will be elements on the page (picture and checkbox under it) as in the screenshot. ...
2
votes
1answer
50 views

How to call knockout functions from html (Magento 2)

I have functions defined in my knockout js, define([ 'Magento_Ui/js/form/form', 'ko' ], function (Component, ko) { 'use strict'; function viewedProducts() { let rvp = JSON....
0
votes
1answer
30 views

Magento2 : Show Three Products on Checkout page in Order Summary section

I have added 8 products in the cart and now I would like to show three products on Order Summary section on Checkout page with a Load More button. And, if we click on Load More button, it will show ...
1
vote
0answers
34 views

Show all error messages in one place in one page checkout

I want to show validation messages in one place. for example. <div class="checkout-error-message"> * Please fill address field * Please fill email field * Please check agreement and term </...
0
votes
0answers
11 views

Shipping amount is lost with call function estimateTotals Magento 2

In my module I have my own discount and when I load the pag custom discount doesn't load. I try to call function estimateTotals and after it shipping amount is lost but show my discount. That I do: ...
0
votes
0answers
18 views

Magento 2.3.2 Enterprise Banner Slider Issue

I am experiencing that the default banner slider is not compatible with the mobile devices in Magento 2.3.2 enterprise version. Slider is working fine for the desktop. Can anyone help me to understand ...
0
votes
2answers
95 views

How to call function from another function using magento knockout js?

I need quick help regarding calling a function within a function using Magento knockout js, I have tried this define([ 'ko', 'uiComponent' ], function (ko, Component) { 'use strict'; ...
0
votes
1answer
117 views

How to Write Knockout Js Code. Magento 2

I'm trying to Hide 3 Radio Buttons when Checkbox is unchecked when I checked it the all 3 buttons need to show in Jquery the code will be like show_hide_fun: function(){ window....
4
votes
1answer
207 views

How to make observable array in knockout js model and bind it to html via view js in magento2

I want to make one observable array in knockout js model and this array need updating on click event: That is what I have tried: js/model/test.js var testArray = ko.observableArray(); test : ...
2
votes
0answers
56 views

How to update data input on checkout page in magento2 (knockout.js)

On the checkout page in Magento 2 After search data by finder code, it auto fill customers data. But when I click the "Next" button. It will show "This is a required field." In this post https://...
1
vote
0answers
24 views

How do I get text value for span that is populated with KO?

inside a js file I need to get the value for $('.modal-custom.opc-sidebar.opc-summary-wrapper.custom-slide span.cart-price span.price').text() The probles is that span.cart-price span.price is ...
0
votes
3answers
82 views

Magento 2: How to add hyperlink on text in knockout template

Welcome message = "Welcome Sign-in". I want to add my account link on Sign-in text in the welcome message. sign-in text should be a link and direct the user to my account page. <?php $...
0
votes
0answers
19 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 ...
0
votes
1answer
69 views

How do you pass more / custom parameters to the customer bind / private data in knockout

So this is an extension of this question Magento 2.3 display logged in/out message using private content Default behavior is that data-bind="scope: 'customer' has a few properties eg data_id: ...
1
vote
2answers
117 views

Magento 2.3 display logged in/out message using private content

Does anyone have an example on how to display a logged in vs logged out message on frontend to customer that's not affected by cache without using the cache=false tag and hole punching the whole page ...
0
votes
0answers
467 views

After updating to Magento 2.3.2 checkout page throws error

After I update Magento version from 2.3.0 to 2.3.2 on checkout page I got knockout errors on my console and payments, product items do not show on-page. Before update, it works well. Uncaught ...
0
votes
0answers
15 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
44 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 ...
3
votes
0answers
83 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 ...
1
vote
1answer
172 views

Magento 2 - Add new attribute (delivery_time) to recently viewed widget

What files need to be changed to display additional attributes in recently view products widget? In the widget settings there is only name, price, image and learn_more available. For the product ...
0
votes
1answer
206 views

Get config value in html using knockoutjs

I am trying to get config value to html file. My aim is to check if the config value is enabled of it is show a button and if it’s continue normally with out button the button. I am not sure how to ...
1
vote
1answer
119 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 ...
0
votes
1answer
304 views

Magento 2 - Load knockout content in modal popup

I want to load knockout content in modal popup on the cart page. And to be able to bind button/click events.
1
vote
0answers
28 views

Magento 2 : on tab click ko js and template render

In my module, there are tab structure same like mentioned in this below image tab structure. I want to do like that, when on tab click at that time, ko template and ko js should be render. How to do ...
2
votes
1answer
53 views

Magento2 - How to apply new field without page refresh in checkout summary page?

I have added one field for extra charges, depends on radio button selection in checkout page, its working with page refresh, but I want it to get data without page refresh.
0
votes
0answers
58 views

Magento 2 : pagination using knockout

I want to develop pagination of custom collection using knockout. How to implement it? Any help would be appreciated. Thanks.
2
votes
0answers
77 views

How to move next button in checkout to sidebar and keep it's behaviour. Magento 2.3

As in question title. Button is placed in Magento_Checkout/view/frontend/web/template/shipping.html I need to move it under sidebar section or create new button which will act the same like old one. ...
0
votes
0answers
338 views

Magento 2: Knockout js dynamic content binding repeats the same element

I have created a custom form in checkout page. It contains a drop down field and one ul list. By default there is few li tags(For example,4). When we change the dropdown the li tags will be changed( ...
1
vote
1answer
1k views

Magento 2: Knockout js dynamic content binding issue

I have created a custom form in checkout page. Everything works fine except one ajax response binding Here is my code template.html <form id="cust-checkout-form" class="form" data-bind="attr: {...
1
vote
1answer
448 views

Knockout js : Read parent of parent's data

I want to read the parent of parent elements data. But, I can't able to read it properly. My Array Screenshot : My Code : <!-- ko foreach: { data: Object.keys($parent.optionParam()[main_id]), as:...
0
votes
1answer
2k views

Magento 2 : Access ko observable variable into other js file

I want to access ko observable variable from one js file to other js file. I apply some logic using below way. But, it's return undefined. kotemplate.js : define([ 'jquery', 'uiComponent', ...
0
votes
1answer
1k views

Magento 2 : knockout data-bind:click not working

I added phtml file using ajax response. There are two buttons available in that phtml file. Buttons.phtml : <div id="rh-buttons-temp" class="actions" data-bind="scope:'rh-buttons'"> <!--...
1
vote
2answers
137 views

Having trouble overwriting JS component in minicart dropdown

Having a tough time trying to overwrite the JS component and template around the product image in the minicart dropdown.Here's what I am trying to achieve: I have a custom Product Type depending on ...
1
vote
0answers
187 views

Magento 2 : add google map in checkout

I want to add google map in Magento 2 checkout page. Added API url and key to phtml using below code <referenceContainer name="after.body.start"> <block class="Test\Vendor\Block\...
0
votes
1answer
194 views

Add/Remove class from div if minicart hasitem/noitem

I want to add a class in parent div if minicart/cart is empty and remove same class if minicart/cart has an item(s).I made changes in minicart.phtml. below is my code for that. <div class="block ...
0
votes
1answer
36 views

How to understand KnowkOutJs in Magento 2?

How to understand KnockOut Js in Magento 2 ? I am working in Checkout and cart page, I debugged a lot but i am not able to understand any single line code of KnockOut Js But without Magento 2, I am ...
1
vote
0answers
88 views

Magento 2 Knockout Component after initialize hook or method

In the knockout component I have initialize: function () { this._super(); var self = this; ....some code.... } I want to move the ....some code.... part into afterInitilize() method, ...
1
vote
1answer
131 views

Checkout - can't go to Payment step

Getting ko_unique_1=flatrate_flatrate#shipping in URL as param when clicking Next button on Shipping step. The page gets redirected to shipping step and customers are unable to proceed.
2
votes
2answers
431 views

Can anyone explain <item name=“customEntry” xsi:type=“string”>shippingAddress.region</item> this line how workin checkout page in magento2?

Can anyone please explain below line in magento2 checkout page <item name="customEntry" xsi:type="string">shippingAddress.region</item>
0
votes
1answer
776 views

Magento2 : How to display custom values in checkout page

I am working on checkout page, I have pass some array values to checkout config provider. How to get those values in knockout JS and display by knockout html. Want to display all applied codes in ...
3
votes
1answer
1k views

Magento 2 : From where and how does knockout retrieve data on checkout

I know the following: That checkout is done with knockoutjs. Somehow data from PHP is passed to knockoutjs Where is this passing made ? If we look at project-root/vendor/magento/module-checkout/...
3
votes
1answer
696 views

How to change a qty text in Minicart?

How to change qty text box into dropdown in minicart place view/frontend/web/template/minicart/item/default.html file ?
1
vote
0answers
34 views

how to set dropdown in magento2?

How to set drop down field in minicart qty place file path view/frontend/web/template/minicart/item/default.html file if anyone knows please explain me
5
votes
1answer
776 views

Pass data to child template in cart-items of checkout page

My site is a market place site where vendors(sellers can sell their product). Now i want to customize the to group items in cart by each vendor like this: http://prntscr.com/hmsam6 ...
8
votes
1answer
6k views

magento2 check if customer is logged in or not in knockout template

How do I check if customer is logged in or not in knockout template? my template <!-- ko if: customer().firstname --> <!-- /ko --> my js define( [ 'ko', 'jquery', ...
2
votes
1answer
409 views

Magento 2 dynamically add rows to tier price

Task : To trigger Add button so that a new row is inserted in tier price block every time the loop runs via jquery I have loop which is triggering the click on Add button but the issue is that the ...
0
votes
0answers
44 views

Magento 2: How to use 2 minicarts with same knockout template?

In my site are use 2 minicarts (in header and sidebar) with same knockout template: app/design/frontend/Vendor/Theme/Magento_Checkout/web/template/minicart/content.html I want to adjust small fixes,...
2
votes
3answers
2k views

Magento 2 : External link in admin order grid not linking when click

I have an extra column in my Magento 2 admin order grid, with a column with external urls. This is working well (I see an overview of al my hyperlinks). But when I click on a url, I go to the order ...