Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [knockoutjs]

Denotes questions related to Knockout use in Magento2

2
votes
1answer
27 views

Require custom checkout field from extension

I am using a zipcode(postcode) check extension that adds a custom zipcode and house number field. Now I want those to be required so they have to be filled in before going to the next step. ...
1
vote
0answers
13 views

How to update shipping methods on change of custom dropdown on cart page

I have created a custom dropdown above country dropdown on cart page. Now I want to update shipping methods list. I followed Devdocs to show custom field on address form (cart page). All in all I ...
0
votes
0answers
24 views

Magento2: how to add/remove a form field using javascript

I have created a custom form in admin in which I need to show buttons such as "Add more" and "Remove". The scenario is exact that which is discussed here: https://stackoverflow.com/questions/...
0
votes
0answers
28 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
71 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
votes
1answer
39 views

Add custom jQuery code after checkout page load

I added some jquery code on checkout page but its not working as because the knockout component load after the page load and my jquery code not able to find that element(class or id) on which I have ...
0
votes
1answer
25 views

Magento 2 get store configuration in js

I'm trying to get admin store configuration (core_config_data) in mincart.js file. Is there any method to get this ? like define([ 'storeConfiguration' 'uiComponent', 'Magento_Customer/js/...
1
vote
3answers
68 views

Magento 2 override minicart.phtml in custom module

I'm trying to override minicart.phtml file from Magento2\vendor\magento\module-checkout\view\frontend\templates\cart\minicart.phtml to my custom module Magento2\vendor\XXXX\YYYY\view\frontend\...
1
vote
1answer
33 views

Magento 2 knockout js dynamic button title in minicart

I'm trying to add dynamic checkout button title in minicart using knockout js. Button title will be configured in admin configs. I configured in minicart.js But I dont know how to use/call in template ...
0
votes
0answers
31 views

Custom live chat script not working in Magento 2.2.4

I have tried adding the chat script on .phtml of the custom extension which I have created for integrating my own live chat. But the libraries are showing undefined when the chat plugin loads the ...
0
votes
0answers
30 views

Magento 2 - (Shipping Address) Custom city dropdown validation not working in checkout page

I followed this link. I created a custom shipping method and I need the city to be required for my shipping rates to be calculated. My problem is my shipping-rates-validation doesn't get trigger it ...
1
vote
2answers
101 views

Magento 2 How to bind knockout event on ajax html response

I have created custom functionality on item form on cart page like increment/decrement qty, remove product with a custom popup, custom move to wishlist by knockout js. For knockout events, I created ...
0
votes
1answer
40 views

Magento 2.3 | Knockout.js - Unexpected end of input

I've installed the latest Magento Version (2.3) and everythign went well. The installation was completed and i was able to view and frontend aswell the backend. For some reason i get the following ...
0
votes
0answers
15 views

How to specify image path relative to module in Knockout HTML view?

I'm making a magento 2, usign 2.2.6, module trying to display certain information at the checkout and I'm stuck when trying to add an image relative to the module path. I'm NOT using PHTML in this ...
0
votes
0answers
13 views

How to add Ui file-upload on chceckout purchaseorder ofline payment

I'm trying to add file upload file thru ajax when user is on offline payment purchaseorder. I can put additional input overwriting Magento_OfflinePayments/js/view/payment/method-renderer/...
0
votes
0answers
51 views

Decode HTML Knockout JS - Minicart

I use HTML Code inside Custom Options. The Radio Option titles are for example <p class="style1">Option1</p> This way I can style my custom options in css, instead just plain text. ...
0
votes
0answers
19 views

Uncaught Error: Unable to process binding

In my Magento 2.1 website, I didn't change anything but suddenly getting this error in my console. Because of JS mini cart and checkout process is not working knockout.js:3012 Uncaught Error: Unable ...
0
votes
1answer
115 views

Autocomplete form field using Knockout Js on Magento2 Checkout

I have created a module to which autocompletes the city field of Magento. I am facing an issue which says TypeError: Unable to process binding "shippingAutoComplete: function(){return { ...
1
vote
0answers
28 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
29 views

Magento CE 2.2.2: How to add images to my custom payment plugin module?

I am creating a custom payment plugin for Magento 2.2.2 For the plugin I need to add the payment icons and some other images. How can I add images for my custom payment plugin? I tried all the ...
0
votes
0answers
31 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.
0
votes
1answer
41 views

Magento 2 Auto added product's image missing in the checkout page

I have created a small module to add a product automatically at cart when a specific coupon code is applied. All is working fine except the product image is missing for the first time, but it shows ...
0
votes
0answers
58 views

Magento 2 how to write in data-mage-init

Magento uses below way to show Requistition list using "x-magento-init". <div class="block block-requisition-list social-button" data-bind="scope: 'requisition_ - 111'"> <!-- ko template: ...
0
votes
1answer
35 views

Magento 2: Details in checkout formatted with HTML-tags

For the title of an article, I am using HTML-code. Unfortunately, the HTML-code in the cart is not written as formatted in HTML – it is written with the HTML-tags, like: "This is a title.<br>...
1
vote
0answers
33 views

How to use javascript in ko template in magento 2?

I have a custom module which will overrride vendor\magento\module-checkout\view\frontend\web\template\shipping-address\shipping-method-item.html, here is the code <!-- /** * Copyright © Magento, ...
2
votes
1answer
39 views

How to return value from knouckout js Ajax call

I have a knouckout js to return data to html template. But I can't able to return values from ajax call done function. My knouckout js like below, define( [ 'jquery', 'mage/url', ...
0
votes
1answer
37 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
0answers
39 views

Magento2: custom javascript not called when using with text/x-magento-init

In list.phtml (product listing) I am showing requistition lsit for every product using type="text/x-magento-init" in loop as: <script type="text/x-magento-init"> { "*": { "...
5
votes
2answers
148 views

How to debug in ko template in magento 2?

Here is the code in \vendor\magento\module-checkout\view\frontend\web\template\shipping-address\custom-method-item-template.html <tbody collapsible="as: '$collapsible_' + method.method_code"> &...
0
votes
0answers
54 views

Knockout foreach afterRender

how can I call afterRender after generating all foreach elements? I want to initialize slider after rendering all slides. I've tried: <div class="order__picker-dates owl-carousel" data-bind="...
1
vote
0answers
21 views

How to list Parent & Child Category BY Knockoutjs

I want to list category block By knockoutjs. Currently I Implemented By Direct PHP Code But I want to do by Knockout js. My Block code ---------- namespace QuickLearn\Knockout\Block; class ...
1
vote
2answers
132 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
1answer
58 views

Magento2: Unable to reload customer cart section

I am using welpixel quick view extension for quick view on product listing, but due to some customizations I am unable to use it as it is. So I just used its url to get html and appended data using ...
0
votes
0answers
11 views

M2 js getUrl links randomly absolute or relative

I am not used to frontend development... We have a link like this: <a class="primary button" data-bind="attr: { href: getUrl('my-special-page') } href="my-special-page"> <span data-bind="...
0
votes
0answers
14 views

Magento 2 Custom JS Component detect/Observe changes from any form input in the DOM

I have ny Component as so: define(['uiComponent', 'jquery', 'ko', 'jquery/ui', 'mage/translate', 'Magento_Ui/js/modal/modal', '...
0
votes
1answer
82 views

Magento2: Get product date in Knockout Js

How to get special delivery end date in ko js I have implemented KO templated with Js How can I get Value of Product Special delivery date in JS for countdown <referenceContainer name="content"&...
1
vote
1answer
127 views

How to translate knockout string variables in Magento 2

I'm extending and translating a third party module which has the following in a template: <!--ko foreach: options--> <div class="option"> <label data-bind="i18n: label"></...
0
votes
1answer
48 views

Magento 2 - display custom product attribute instead of the price in minicart

I try to display a custom product attribute instead of the price in minicart. I saw that the html file that I have to override is price.html from module_checkout. price.html : <!-- ko ifnot: ...
1
vote
0answers
87 views

Magento 2 Knockout Js Customer Name update issue after changing customer name

I am having strange issue. In header, along with Welcome message i am showing Customer full name. For that i am using knockout.js concept. <?php if($block->customerLoggedIn()): ?> <li ...
0
votes
0answers
179 views

knockout-js-uncaught-typeerror-unable-to-process-binding-isloading-is-not-defined

I am working on one step checkout, i searched but unable to find its solution, shipping address is not loading properly and console shows this error Uncaught ReferenceError: Unable to process ...
0
votes
1answer
25 views

Magento2: Translate knockout variable with odd beahaivor

I want to translate a variable in Knockout <span id="sales_unit" data-bind="i18n:sales_unit"></span> sales_unit has the value pair. The value should be translated to a different language ...
0
votes
1answer
159 views

Magento 2: Cannot read property 'dialog' of undefined, 'timepicker' of undefined,'RFC_2822' of undefined

Sometimes I'm getting following errors in the console after reloading the page:- Cannot read property 'dialog' of undefined Cannot read property 'timepicker' of undefined Cannot read property '...
0
votes
1answer
28 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 ...
0
votes
1answer
98 views

Magento 2 Add error/success message with knockout

I get error: Cannot read property 'addSuccessMessage' of undefined When I want to add a success or error message via knockout js to magento 2. I did: define([ 'jquery', 'Magento_Ui/js/...
0
votes
2answers
147 views

Knockout.js What is the correct way to reference $parent on js file?

I am new on Knockout.js, especially on how to use it in the Magento way. I create a custom ViewModel with a js file called storepickup-select.js and an HTML template called storepickup-select.html. ...
4
votes
2answers
220 views

Magento 2 : How to call text/x-magento-init on Ajax success

I am in need to trigger some script with "text/x-magento-init" on ajax call but I am unable to do so. trigger('contentUpdated') contentUpdated is also not working in my case. I am using ...
4
votes
1answer
172 views

How to pass a Magento 2 variable to KnockoutJS

I want to pass $vendor_city to knockoutJS: <?php $vendor_city = $vendor->getData('city'); ?> <div id="m2-component" data-bind="scope:'ko'"> <script type="text/x-magento-init"&...
2
votes
1answer
180 views

How to extend sidebar.js to perform action on Qty change in Minicart Magento 2

I added a text field Box in minicart that need to perform some calculation on keyup to update Qty. I Added box field by modifying module-checkout/view/frontend/web/template/minicart/item/default....
1
vote
1answer
266 views

Magento 2 How to set value to UI component hidden field using Jquery or Javascript

I want to fill value in to ui component hidden field using Jquery or Javascript. Below is my code. Namespace/Modulename/view/adminhtml/ui_component/sampleimageuploader_image_form.xml <field ...
1
vote
4answers
169 views

I want to translate “Buy” and “save” word in tier_price.phtml file. magento 2

I want to translate "Buy" and "Save" word in tier_price.phtml file.I have added the word in translation csv file but it is not working form me. Refer screenshot PATH : vendor/magento/module-...