Questions tagged [knockoutjs]
Denotes questions related to Knockout use in Magento2
819
questions
1
vote
1
answer
35
views
check condition in foreach loop with dynamic variable in knockout js
I have html file at the path
/var/www/html/nelson-avnet-app/code/vendor/module/view/frontend/web/template/shipping-address/list.html
<!-- ko if: (visible)-->
<div class="field addresses&...
0
votes
0
answers
14
views
Magento 2: Add custom value to $parent in checkout summary
I want to add a custom value to the items in the order summary during checkout ($parent).
I followed all the other howtos on how to do it:
Create plugin for Magento\Checkout\Model\...
0
votes
2
answers
34
views
Magento 2 / Knockout js add image in form field notice
I want to add html tags to the notice of a specific field, I tried in LayoutProcessor but it does not interpret the image tags, I know it is possible from the field.html file, but it did not work for ...
0
votes
1
answer
32
views
how to add Strike through on original price and show cart rule discounted price
add strike through on the price and show the discounted price after strick through price on the checkout shipping step summary section
0
votes
0
answers
44
views
How to update grandtotal using knockout JS in Magento 2 checkout page
I've added a text field where customers can enter a coupon code. When click the "Apply Coupon" button, I am fetching the value of the coupon. I want to use this coupon value to adjust the ...
0
votes
0
answers
14
views
Pre-Select checkboxes based on custom condition in Magento 2 using KnockoutJS
I want to override a third party module's knockoutJS template (below) and want to pre-select the checkboxes based on my custom condition. Can anyone help me with code to how to do that?
And if ...
1
vote
0
answers
34
views
totals.getSegment('giftcardaccount') returning null
I'm about at my whits end.
I still consider myself a relative novice with Magento, but this one literally has me baffled. I've also tossed it around to some senior devs at my work, and they are ...
0
votes
0
answers
34
views
Magento 2 getting errors on all page Unable to process binding "attr: function
I am getting errors on all pages anyone knows please give me solutions on how to fix it. Please check screenshot
Errors:-
Uncaught ReferenceError: Unable to process binding "attr: function(){...
0
votes
0
answers
14
views
Prefill billing address data with custom adress array for guest
Hi all is there a way that i can pass custom billing address array to prefill billing address data on review and payment page
$csutomerAddress = [
'firstname' => "testname"
];
currently i ...
0
votes
2
answers
44
views
Minicart: failed to load template
I'm using a custom template and having an issue with the minicart rendering.
The minicart pop-up renders, but does not gather any data with 2 errors in the console.
So the popup does open when you ...
0
votes
0
answers
36
views
How Add PO Number Field for All Payment methods
On checkout, there should be an input field for the PO number
Input needs to be available for all payment types and must be required.
Hide the default PO number in the Payment on Account payment ...
0
votes
0
answers
34
views
Magento 2 / Add Buy Now button in Recently Viewed Products
I want to add "Buy Now" button in Recently Viewed Products widget, the widget is made with knockout js.
The file involved in the widget is: /Magento_Catalog/web/template/product/list/listing....
0
votes
0
answers
58
views
Magento 2 / Add Buy Now button with knockout js (html template)
I am adding the Buy Now button in all sections.
I have been able to add it in almost all sections, but I have a block in one part of the home that brings the recently visited products and the front is ...
0
votes
2
answers
146
views
Magento 2 - Get location of view model of knockoutjs .html template
For example, how can I find out where the model / view model for this template is located at?
vendor/magento/module-checkout/view/frontend/web/template/minicart/item/default.html
0
votes
1
answer
140
views
Magento 2: How to show error inside payment method?
I am using Magento 2.3.5 and i need to show the error message on checkout page inside the payment method component, how can achieve that?
Actually shows this way (Top of the page)
I want to to show ...
1
vote
0
answers
129
views
How to get selected shipping address from js component in Magento 2?
I'm very new to the Magento world and I'm trying to figure out how do I get the currently selected shipping address in Magento 2.
The goal is to only display the selected shipping address in the ...
0
votes
0
answers
37
views
Caught TypeError: self.AnyFunction is not a function
I am trying to modify the default Magento 2 Checkout, basically I want to remove the "Payment and Review" step and put them all together.
Everything goes well but I have stuck intro an issue....
1
vote
2
answers
288
views
Magento 2: Custom component fails to load when implementing Magento_Checkout/js/model/totals
I have created a custom Knockout-Component that so far does not do anything. It is just the basic skeleton but it already fails to load.
Template:
<div class="my-module" data-bind="...
0
votes
0
answers
17
views
How to use js from library inside data-bind scope
I'm trying to use sortable with below code:
<ul id="sortable-list">
<li>
<div>
<span class="sort-handle">Sortable Item #1</span&...
0
votes
0
answers
27
views
JavaScript not executed when it has Magento_Customer/js/customer-data dependencia in define
I have a JS file like this:
define([
'jquery',
'underscore',
'matchMedia',
'text!ajaxcart/template/modal-slide.html',
'text!ajaxcart/template/modal-popup.html',
...
0
votes
0
answers
60
views
sometime all knockout js files can't initialize in magento 2 (examp: Magento_Checkout/js/view/minicart, ....)
I'm using magento community-edition ver 2.4.5
When I reload the page many times(any pages), there will come a time be all knockout js files not initialize, it doesn't run into initialize function.
...
0
votes
1
answer
80
views
How to make Shipping address search function in checkout?
I want to make a function where users can search for the address from the shipping address list at the checkout page.
Right now there are many B2B Magento stores globally. So Might they have a huge ...
2
votes
0
answers
211
views
Magento 2 : Codazon Fastest Theme js not loading propperly
I Have Installed Codazon Fastest Theme on my Manto2 site.i am facing an issue with js loading.
here is my system configuration below.
magento version : 2.4.5
PHP: 8.0
theme: Codazon Fastest Theme
...
0
votes
1
answer
26
views
How to add new section below shipping method and above next button on checkout page - Magento 2.4
I searched for the reference URL from that I can able to add above the "Shipping Method" or below "Next".
But Not able to add the text box between "Shipping Method" and &...
0
votes
1
answer
307
views
Translate dynamic text in magento 2 javascript
i have a text like within %1 days %1 is dynamic how to translate using data-bind:i18n in html template magento 2.4
<span data-bind="text:methoddata[key].delivery_days_text"></span&...
1
vote
0
answers
284
views
How to allow to upload mp4 video on page-builder in magento 2
I am trying to create a custom component for upload mp4 video like image uploading component. Video is uploading and save fine and also show on front cms-page but after the save video will be remove ...
0
votes
0
answers
25
views
Selected address is not showing in default ko template from Shipping address list drop-down select on checkout Magento2.4.5
We followed the link for creating shipping address drop-down on checkout page. I put all files under Custom theme's Magento_NegotiableQuote module.
Drop-down with shipping address showing correctly ...
0
votes
0
answers
60
views
Magento2 Add Custom Fields in Shipping and Billing address forms at checkout based on current country
We have setup multi-websites in magento, we want to add a field in checkout shipping and billing form only if customer is visiting particular country website.
Ex. if customer is visiting US website ...
0
votes
0
answers
29
views
What is the purpose of getTemplate() in knockout Js Magento 2?
I'm learning Knockout JS in Magento 2. There is a function getTemplate() whose syntax looks like this. I want to know its working and purpose.
FilePath: app/code/CloudyDigitals/LearnKnockout/view/...
0
votes
0
answers
13
views
Checkout DropDown Address Field based on another dropdown field
I am struggling in figuring out how to filter a drop down address field at checkout based on the selection of another one.
We have created an address table containing region, city and post code.
We ...
0
votes
1
answer
115
views
Magento 2.4.4: Attach event handler to Province dropdown to reload the checkout page
We developed a custom shipping module that displays shipping methods and the rates in Firecheckout page. The issue is the Shipping Method block in the firecheckout page doesn't refresh if one changes ...
0
votes
0
answers
83
views
Magento2 : How to save chosen dropdown list from template to the database
The selected option is not being save in the databse, please help what i did wrong? I'm running magento 2.4.4 with php 8.1
event.xml
<?xml version="1.0"?>
<config xmlns:xsi="...
0
votes
0
answers
418
views
Add knockout js condition using data from 'Magento_Customer/js/customer-data'
In magento 2.4.4p2
I want to add in new condition in
/vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.html
which are based on the item free gift data that I added ...
0
votes
0
answers
83
views
Failed to load the js file component in console
I am trying to show current time with running seconds on a page under adminhtml. I wrote the code for js in Namespace_Module/view/adminhtml/web/js/timejs.js And the code is
define(
['jquery', '...
0
votes
1
answer
184
views
can anyone find out the error in this knockout js code
this is phtml file located in Namespace_ModuleName/view/adminhtml/templates/js_time.phtml
<div>
<h4>Current Time is:</h4><span id="time_show" data-bind="text: ...
0
votes
1
answer
75
views
Base price, discounted price and percentage discount in the summary checkout
I need to have the discounted, base, and percentage off prices in the summary checkout.
I found the file that prints and it is this checkout/summary/item/price/row_excl_tax.html but I can't retrieve ...
0
votes
0
answers
194
views
How to Create Custom Image Uploader in Page-Buillder Magento 2?
I have created a Custom Image Uploader Component in Page-Builder, When am trying to drag and drop the component it gives error. Does anyone know how to fix it?
pagebuilder/content_type/example_video....
0
votes
0
answers
21
views
Magento2: Error message coming more than one time when adding exceed quantity
When the quota exceeds, in product details page quota exceed error message displaying 2 times. below is the code
<div data-bind="scope: 'messages'">
<!-- ko if: messagesList()....
0
votes
0
answers
94
views
Programmatically add row to DnyamicRows component
I'm trying to programmatically add a row to a dynamic-rows component by extending the dynamic-rows and form components.
When an inserted form is submitted, the form data is inserted into the ...
0
votes
0
answers
161
views
How to add a custom method which redirect to a custom controllers in knockout js in magento 2?
I have a custom block which render some information and button.I am rendering the data from knockout js. Data rendering works fine.
My template block is below.
<div class="ayakil-custom-...
0
votes
1
answer
44
views
How to learn knockout js. Please help to learn about js,
**How to learn knockout js. Please help to learn about js.
0
votes
0
answers
15
views
No response for Form validation
I tried to do form validation for a custom form through class and data-validation but no response from both methods. May I know what is the correct way to do it?
app/code/MyModule/Knockout/view/...
1
vote
1
answer
36
views
Magento 2 change the addtocart button text on detail page based on the product increment
I am doing customisation on PDP page as per my client requirement, For my requirement i am using the grouped product, also added a option to increase/decrease each product quantity count, when ...
0
votes
1
answer
92
views
How to initialise Magento Requisition over AJAX?
I have tried several ways to initialize Magento RequisitionList after AJAX call.
First I tried with data-mage-init
Please correct me if there is anything wrong.
I have used the underscore JS template ...
0
votes
0
answers
142
views
Datepicker binding error in Magento +2.4
I have upgraded from 2.3.7 to 2.4.5 and datepicker binding provokes an error:
jquery.js:4050 jQuery.Deferred exception: Unable to process binding "datepicker: function(){return { storage:...
0
votes
0
answers
155
views
Knockout js - Check Payment method if is only one
I was tried validate with knockout js if payment method is one default checked but not works, actually default is not checked:
This is my code:
view/frontend/web/template/payment/payu.html
<div ...
0
votes
1
answer
217
views
Find Javascript Merge Knockout Error In Extensions Uncaught Error: Cannot find closing comment tag to match: ko template:
Magento 2.4.3
Apache
Nginx
MariaDB
Hello Thanks for taking the time to read this.
We have a dev site we are trying to enable Swissup Pagespeed Extension however it is getting 1 error - the merge ...
0
votes
0
answers
86
views
Magento 2 virtual elements vs data-bind
In which cases we should use 'virtual elements' and 'data-bind' ?
For example, this code using virtual elements:
<div class="custom-configs">
<h2><!-- ko i18n: 'Custom ...
1
vote
1
answer
186
views
Unable to access custom data section using customerData.get() inside KnockoutJS component
I am following this in order to create new section https://developer.adobe.com/commerce/php/development/cache/page/private-content/
All is working if I request '{localhost}/customer/section/load', the ...
1
vote
1
answer
85
views
Customize Checkout Html Templates
Im customizing the checkout of Magento and having some issue in html templates. I copy the cart-items.html from the magento-checkout module in my theme but, when i change the template structure the js ...