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.

18
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
250 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
42 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
50 views

Magento 2.3.1 CE Tinymce Error

We have upgraded Magento from 2.2.3 CE to 2.3.1 CE successfully. But we are facing few issues with the Tinymce js from admin end product edit page and cms pages etc.. when using Show/Hide Editor.. ...
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
130 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
77 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
241 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
180 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
375 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
95 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
862 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
155 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
297 views

Magento2 : Override Admin Js file

I am working on Magento 2.1 CE. My current active Theme is the Default LUMA Theme I wish to override the CORE Modules "bundle-input-type.js" located in "vendor\magento\module-bundle\view\adminhtml\...
3
votes
0answers
107 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
607 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
807 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
51 views

How to translate “ This is a required ” in Magento 2

I want translate error message required field like this I used de_DE.csv but the get fields from data it does not translate, please help me! Thanks all
2
votes
0answers
22 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
175 views

Magento 2.3.1 not loading correct javascript files (tinymce)

I've upgraded from Magento 2.2.6 with Theme Ves Fresh 2. I have tried to clean all caches delete static folder and restart Varnish, but had no luck so far. The errors include: GET https://shop....
2
votes
0answers
47 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
51 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
31 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
62 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
259 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
93 views

Magento2 error after theme upload: Invalid template file

After uploading new theme files (Hebes) to Magento 2.3 installation I receive the following error: 1 exception(s): Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file:...
2
votes
0answers
94 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
62 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
40 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
620 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
123 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
101 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
446 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
187 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
500 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
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
105 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
378 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
369 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
236 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
407 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
749 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
544 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
655 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
13 views

React Router Breadcrumbs use page titles instead of url dynamically

I've got a magento 2.3.1 site with venia storefront a react front end and I'm trying to get the breadcrumbs to pull the page titles dynamically rather than pulling the url. My current code for the ...
1
vote
0answers
41 views

Magento2.3 : How do I programmatically submit a form generated via a UIComponent?

I created a UI Component form, but I am unable to find the element in the source. I would like to click a button and then inspect a field in the form and dependent on what value is selected submit ...
1
vote
0answers
13 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 ...