Stack Exchange Network

Stack Exchange network consists of 175 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 [javascript]

JavaScript (JS) is a client side script language which allows to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed. By default Magento 1 comes with the prototype.js library and Magento 2 comes with jQuery. Use 'prototype-js' and 'jquery' tags for questions about those libraries.

17
votes
0answers
7k views

Magento 2: Uncaught TypeError: Cannot read property '*' of undefined in (section-config.js:33)

It's duplicate question but I am facing the same issue while adding the product & removing items from the cart page. I have spent almost a day to resolve but no luck hope someone could help me ...
5
votes
0answers
245 views

WYSIWYG in custom widget

I have tried adding a WYSIWYG editor to custom widget I have created using the approach outlined at: http://behrendtio.github.io/2013/04/12/using-a-wysiwyg-editor-in-a-magento-widget/ However, when I ...
4
votes
0answers
35 views

How to create a basic progress bar with ajax, when il click add to cart in Magento 2?

I try to make a basic progress bar with ajax , when I click button add to cart, but I don't know how catch the xhr on console,to put on alert() or prepend()function I follow a video example in ...
3
votes
0answers
24 views

js not loading properly in backend product edit while click on show/hide of description field magento 2.2.4 production mode

This issue specific to production mode of Magento 2.2.4. Js is appending in product edit url like : base_url/admin/catalog/product/edit/id/57473/set/12/key/...
3
votes
0answers
105 views

Launch Polyfill.io BEFORE Magento 2 scripts

I need to use the https://polyfill.io/v2/docs/ library for a Magento 2 project, so I called it in : htdocs/app/design/frontend/my_theme/default/Magento_Theme/layout/default_head_blocks.xml With this ...
3
votes
0answers
74 views

Overriding\Extending Magento_Sales js files

i need to add my custom function call at the end of function loadArea() which located at Magento_Sales/order/create/scripts.js. I already do this with overriding by requirejs-config.js var config = {...
3
votes
0answers
201 views

Magento 2.2.5: How to console.log() in js file

I'm trying to debug a js file in Magento 2. And I don't know how to do that. I've try console.log('something in here') but doesn't work, I've clear cache as well. Here is my problem: I've 3 ...
3
votes
0answers
179 views

How to combine JS files in Magento 2.2.4

I am using Magento 2.2.4 and want to combine external JavaScript files but, In the admin section I didn't find the options for it under the Developer section.
3
votes
0answers
369 views

Headers already send Magento 2 multistore addon domain

Multiple websites are working on Magento 2.2 with the addon domain method and symlinks. The theme is visible, etc. Only thing is that at the bottom I see the following message. Looking for advice. ...
3
votes
0answers
93 views

Check if Magento cart is empty using Javascript?

So I need to check if the cart on my magento site is empty or not. I can do this using php like this: <?php $count = $this->helper('checkout/cart')->getSummaryCount(); if($count==0){ ...
3
votes
0answers
828 views

magento 2 knockout js / require js subscribe to another files parameter

What I need to do is subscribe to another file / object via knockout js and require js. For example I have in File1.js: define( [ '/path/to/some/component', 'ko' ], function (Component, ko) ...
3
votes
0answers
152 views

What does the “initUnique” Method setup in uiElement Objects?

In Magento 2's uiElement objects, one of the initialization methods is named initUnique initialize: function () { this._super() .initObservable() .initModules() ....
3
votes
0answers
105 views

what does `compatible product` mean in product-media.js?

Can someone explain me what the following code says in product-media.js : getCompatibleProductImages: function(productFallback, selectedLabels) { //find compatible products var ...
3
votes
0answers
601 views

RequireJS Error - require.js:166 Uncaught Error: Mismatched anonymous define() module: function (){return Z}

I'm new to RequireJS and trying to figure out why this is happening. I have a custom file stickyNav.js in <vendor>/<theme>/web/js. I've added a requirejs-config.js file in <vendor>/...
3
votes
0answers
208 views

Magento 2: Admin grid table - add new row on the fly?

I created a custom UI grid table in admin. And I have a form on the same page to add new item to my custom database table(with ajax). After I added new item I need it to immediately appear in this ...
3
votes
0answers
800 views

Magento Backend issues (Extjs)

I have some issues in my backend : no product categories some buttons not working no editor In firebug console there are several JS errors. example for the categories page : SyntaxError: missing ) ...
2
votes
0answers
19 views

How to pass variable value from phtml JS to block.php?

I have a phtml (system.phtml) with <script> in it and a variable like console.log(data). <?php $checkcustomer = $block->Customerlogin(); ?> <script src="https://d3js.org/d3.v3.min....
2
votes
0answers
41 views

JavaScript Bundling Not working in Magento2

I have refered https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/js-bundling.html for javascript bundling: After doing all the step i have check Network in browser and it seems found ...
2
votes
0answers
47 views

Magento 2.2.7 checkout JS Components will not be loaded

After I updated from Magento 2.1.5 to 2.2.7 my checkout is not working any longer.When i click checkout button it continuously loading
2
votes
0answers
27 views

How to edit source of the index page in Magento

I am a professional PHP developer, it's been like 2-3 days since I am trying to work with magento. My task is to optimize the index page. Thing is, I can not edit the "actual" source of index page. ...
2
votes
0answers
36 views

Magento 2.2 x or 2.3 - to bundle or not to bundle

I've read so many conflicting write up's and blogs about whether to "Enable Javascript Bundling" or not. Some say it's slow and some say it's faster when enabled. From what I understand it takes all ...
2
votes
0answers
199 views

Should i use tinymce or tinyMCE in magento 2.3 and also usage for backward compatible

From magento 2.3 i see core team integrated new version of tinymce. It's a good thing. Maybe future they will add more editor for magento. But i have a confuse a bit when to use wysiwyg through below ...
2
votes
0answers
79 views

Mini Cart Update issue

I am facing mini cart update issue - to replicate the issue you need to browse the site and add a product to the cart - then continue shopping. If you press checkout (instead of continue shopping) the ...
2
votes
0answers
60 views

Node modules in theme

I am new to magento and i have researched this issue i am having for enough time to post it here. My goal is to understand how require-js works with node modules. Case: $themeDir = app/design/...
2
votes
0answers
38 views

Negation in the imports link (UI component)

I've got the fieldset component in my custom UI-form: <fieldset name="default"> <settings> <label>Default</label> <collapsible>true</collapsible&...
2
votes
0answers
590 views

Magento 2 : Disable RequireJS (and all JavaScript)

Is there a way to disable RequireJS completely in Magento 2? I want to build a theme from scratch and I do not want to include any of JavaScript that Magento automatically includes, Including ...
2
votes
0answers
113 views

minicart ko in magento2

Js file qtyOptions: ko.observableArray([]), initialize: function () { this._super(); for (var i = 1; i <= 4; i++) { this.qtyOptions.push(i); } return this; template file &...
2
votes
0answers
93 views

On mobile submenu 'All %categoryname' is not translated - Magento 2

I can't translate the string 'All' from the subcategory on mobile menu. The file where the string appears is menu.js located on public/lib/web/mage/ And it looks like this: .text($.mage.__('All ') + ...
2
votes
0answers
431 views

How to call a js function explicitly from phtml file in magento 2

I have the following file Vendor/Catalog/view/templates/product/view/type/options/configurable.phtml Content of that file as follows <?php /** * Copyright © 2013-2017 Magento, Inc. All rights ...
2
votes
0answers
178 views

Javascript file 404s when loaded via Require JS alias

I've ran into a strange problem where a custom javascript file 404s when loaded via a RequireJS alias but it works fine when loaded directly. This does not work Require JS var config = { map: { ...
2
votes
0answers
481 views

Async loading of javascript in Magento for PageSpeed

I'm trying to optimize my Magento 1.9.3 website, following Google PageSpeed hints, saying I have js and css that load synchrounously and block the page rendering. To solve this issue, I'm putting ...
2
votes
0answers
310 views

Magento 2: Recalculate shipping methods when State/Province changes

On step 1 (Shipping) of the checkout process, some of the fields - such as Zip/Postal Code - trigger re-evaluation of the list of available shipping methods. I have a custom plugin in place that ...
2
votes
0answers
135 views

JS mixin on a js file with a single return in Magento 2

I'm having trouble with mixin in Magento 2. I would like to override the following file to edit a function. Magento_Checkout/web/js/model/new-customer-address.js: define([ 'underscore' ],...
2
votes
0answers
103 views

Javascript load order

I need to load some JS libraries the last of all. I used to achieve this using data-group param, like this: <?xml version="1.0"?> <layout version="0.1.0"> <default> <...
2
votes
0answers
679 views

Magento 2 : How to Add Date Validator on Custom Input Form Js File

I have created a custom input on the checkout page, I want to add date validator from js but I can't. I already tried this custom js: $( "#co-shipping-method-form" ).validate({ rules: { ...
2
votes
0answers
375 views

Magento 2 : How do I hide a Customized Checkout Step

I have added a custom step in checkout. I would like to use some JS to hide or disable the step based on if the associated shipping option is selected or not. I tried to wrap it in if statement but ...
2
votes
0answers
362 views

Checkout Page - JavaScript can't target inputs

On my checkout page I'd like to do some JavaScript on Inputs and other elements. It seems like I can't access certain part of my page. To verify i tried $("form").html("these forms I could find"); ...
2
votes
0answers
232 views

Magento hangs when I click Save and Continue Edit

Windows 10, Magento 2.1, XAMPP, Stores > attributes > product > add new attribute > properties fill in [Default Label] and click — Save and Continue Edit. It says please wait... and the software ...
2
votes
0answers
395 views

Add full version of jquery mobile to magento2

Magento2 loads by default a custom build of jquery mobile library: deps: [ "jquery/jquery.mobile.custom", If I try to add the full version of the mobile library (require it in my theme): var ...
2
votes
0answers
1k views

Where to add Mailchimp Subscriber Popup code in magento

I apologize if this question has been posted before, but I checked all over google and could not find anything. I am trying to add the Mailchimp subscriber popup to my homepage, but cannot figure out ...
2
votes
0answers
735 views

Magento SOAP API: How to get SOAP response using JavaScript

I'm able to get SOAP response using Magento SOAP API by using PHP code. Now I want it using JavaScript/AJAX request. How can I accomplish this? What steps should I follow prepare my Magento to allow ...
2
votes
0answers
529 views

Adding custom xml to CMS page's Layout Update XML fails to load the script

I am trying to add Java script to a specific CMS page to be loaded in the <head> area. The scripts fails to load. name.min-1.0.js and name.Mode.js are placed in {magentoroot}/js. The ...
2
votes
0answers
3k views

Swatch customization issues

well we have heavily customized Magento 2 website. The swatch customizing is done in: app\code\My_Package\CustomSwatches\view\frontend\web\js\SwatchRenderer.js by overriding: vendor\magento\module-...
2
votes
0answers
653 views

Web service API SOAP v1 using java for connect?

In official site exists this faq http://www.magentocommerce.com/api/soap/introduction.html And in line As of v1.3, you may also use the following URL to access the Magento API v2, which has been added ...
1
vote
0answers
11 views

UI Components - pass ids selection to listing selection

How do i pass a selection of ids to an insert-listing component to preselect certain rows. I have a dynamic rows component with entries related to the current product I'm editing. When click on a ...
1
vote
0answers
16 views

Failed to load JS and other support files while trying to checkout

I am trying to add a product in cart and check out the product, page still loading and it shown error message. enter image description here
1
vote
0answers
12 views

Backend listing grid view page not opening order listing cms page & block listing etc

Backend listing grid view page not opening order listing cms page & block listing etc.. Admin panel not able to load multiselect.html, text.html, html.html, actions.html and js file as per console ...
1
vote
0answers
15 views

cms pages and block is not loading in backend

CMS pages and blocks won't load in the backend. It keeps loading and loading without not showing any pages or blocks. I reindex, compile, clear cache... But nothing changed. Any help would be much ...
1
vote
0answers
20 views

Add multiple products to cart using product ids

I am trying to add multiple products to my cart. I have product ids in the form of $productIds = implode(',', array_column($points, 'productId')); which gives me numeric product ids like this : 5330,...
1
vote
0answers
12 views

magento 1 checkout page gives error “checkout is not defined” in console prototype.js::5598

i am using firecheckout for magento 1 checkout page gives error "checkout is not defined" in console prototype.js::5598. because of that error sometimes customers can not place order. can anyone help ...