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.

0
votes
2answers
660 views

Add a javascript file in Magento 1.9

I'm discovering magento since 1 week. But i have a problem now. I need to include a javascript file in my admin panel to sort a list according to another. I'm using magento 1.9 and i really don't find ...
2
votes
1answer
22 views

admin area getting error 'require is not a function at editor.js:6' after upgrading magento 2 from 2.1.1 to 2.1.17

After upgrading Magento from version 2.1.1 to 2.1.17, I am facing this error Uncaught TypeError: require is not a function at editor.js:6 across admin area especially in edit pages when I look ...
1
vote
4answers
2k views

How to disable JQMigrate Logging

We keep receiving this log and stack trace from JQMigrate, but it seems to just be a warning. Is there a way to just straight up disable logging in production?
3
votes
1answer
156 views

Magento 2: Proper way to utilize “ajax:addToCart” event

I found the following codes in /vendor/magento/module-catalog/view/frontend/web/js/catalog-add-to-cart.js at around line 100, when I was trying to find ways to add some custom JS handling after ...
0
votes
2answers
371 views

SyntaxError: missing ) after argument list

I have encountered a weird error, after some time of development and clearing cache I am getting the following error. SyntaxError: missing ) after argument list I have created several modules and ...
3
votes
0answers
27 views

Magento2: Local-Storage Mage-Storage and Mage-Cache Empty on every Reload

Many features in my web page break as when I investigated, I found out that many local storage keys don't even exist now which used to exist before. list of keys that don't exist: lo_session mage-...
1
vote
1answer
22 views

How to pass array value in url

Array :- foreach ($relatedProducts as $relatedProduct) { $_product = $objectManager->create('Magento\Catalog\Model\Product')->load($relatedProduct->getId()); $skus = $...
5
votes
0answers
32 views

Magento2.3: Display Custom text on Shipping Address

I would like to add custom text whenever shipping country is Sweden, Ive created Magento_Checkout module in my custom theme and added a phtml file <div class="free-shipping-info" data-bind="...
6
votes
2answers
651 views

TinyMCE Issues in Magento 2.3

I'm having some issues with TinyMCE, which is causing the editor not to work on CMS pages and causes products not to load when attempting to edit them. When these issues are happening, I see this in ...
0
votes
0answers
10 views

Magento 2: Failed to load resource: the server responded with a status of 404 (Not Found)

I am trying to override magento 2 core js ' require-config.js file at path Test/JsOverride/view/frontend/ var config = { "map": { "*": { "menu": "...
0
votes
2answers
1k views

Magento 2 - JS to fire once checkout page has fully loaded

I have the following if statement where I want to check to see whether the postcode input is empty however it fires before the input is loaded on the page and was wondering whether anyone could please ...
1
vote
1answer
28 views

Custom javascript is not loading through requirejs-config

I've been trying to add a custom script to my Magento stores, however I can't get it to load. I've created the js file in my web/js folder in my theme, and added it to the theme's requirejs file. It ...
2
votes
2answers
637 views

Magento 2.2 Add Masonry JS

I've a problem to include Masonry JS to my Magento 2.2 I've a custom theme in app/design/frontend/CustomVendor/CustomTheme In this folder I've a web/ folder and inside I've requirejs-config.js var ...
0
votes
2answers
1k views

Magento 2 checkout knockout.js in custom template error - telephone field

I'm trying to create a mask for telephone field in Magento 2.2.2 checkout. In order to do so. I placed a checkout_index_index.xml with a new template for telephone field at vendor/mytheme/...
2
votes
2answers
2k views

overriding/extending price-options.js does not work

I need to override/extend the file price-options.js. But it does not work, I always get the error TypeError: undefined is not a constructor on this line $.widget('myCompany.mypriceoptions', $....
0
votes
1answer
21 views

Why We Use RequireJS on Magento 2

Please tell me why we use requirejs and require-configjs files and purpose of these two files on magento 2.Complete Details if Possible.
0
votes
0answers
10 views

Why is guest customer billing information NULL - Magento 2 checkout and quote?

I'm trying to get guest customer billing information during the checkout session as I need to save it to the quote before redirecting to placeOrder but the billing information is always null. How do ...
2
votes
0answers
54 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
4
votes
1answer
1k views

Magento 2.2.1 Checkout page broken and Js fail to load error

I have installed Magento 2.2.1 and set up my custom theme but checkout page looks broken and consoles showing errors: Not sure how to resolve this issue. Need help how can this be resolved. How ...
1
vote
1answer
751 views

Magento 2 How to call a ajax function in x-magento-init type javascript?

It seems cannot use jquery lib inside the x-magento-init type javascript. How to call a ajax function in x-magento-init type javascript? Thanks
0
votes
2answers
29 views

menu.js:1 Uncaught TypeError: require is not a function

I am trying to add a jquery script to my site. I have updated the require-config so it has this- var config = { paths: { slick: 'js/slick.min', slaask: 'js/customscript', menu: 'js/menu....
0
votes
1answer
17 views

How to fix blank Minicart popup in custom navbar for Magento 2

I am creating a custom theme from the parent theme Luma. I've added this code to Magento_Theme/layout/default.xml to include the minicart. <block class="Magento\Checkout\Block\Cart\Sidebar" name="...
1
vote
1answer
110 views

Magento 2.2.2 Javascript bundle file size only 1Mb

I enabled bundle javascript file, but i saw in my local js file is 3.7Mb and my dev site just 1.0Mb. Here is my config 'dev' => array ( 'js' => array ( 'merge_files' => '1',...
0
votes
2answers
135 views

Magento 1.9 - problem with librabries conflict - nouislider.js and prototype.js

I have in code following libraries: <script type="text/javascript" src="http://localhost/js/lib/jquery/jquery-3.3.1.min.js"></script> <script type="text/javascript" src="http://...
0
votes
2answers
2k views

How to Magento 2 Enable JavaScript Bundling

I merged JS and CSS file Stores -> Configuration -> Advanced -> Developer -> Javascript Settings in production mode of magento2. Once, I check via view source of the page, I can see the Javascript is ...
0
votes
1answer
23 views

M2 Modal Widget - Variable for Link, Title, and Content

I want to have links that activate a modal window with dynamic content and title. I would assume there is a way to do this with variables. I can do it now as a separate script for each modal, but is ...
2
votes
1answer
335 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 ...
0
votes
1answer
809 views

Linking on button and open custom tab

Need to open custom tab on product view, from link. Magento 1.9.2.4 Custom theme. My tab, which is added just in one category by Custom Design <reference name="product.info.tabs"> <...
0
votes
0answers
18 views

Social login popup on custom url

We have installed Mageplaza social login popup(https://github.com/mageplaza/magento-2-social-login). The extension opens the popup when clicked on "Signup/Login" button on the home page. We need a ...
0
votes
0answers
279 views

Magento2 : Save Button Not Working in Admin Form Custom Module

I am Working on A magento 2 custom Module i have a Form as well a Product Grid in my form so i created tabs using block but Whenever i click on save button gives me Javascript Error TypeError: $....
1
vote
2answers
977 views

data-mage-init not working on CMS page

If I add this to a CMS page then it pull in the javascript to the page correctly: <script type="text/javascript"> requirejs(['jquery', 'bootstrap'], function (jQuery, jQueryBootstrap) { ...
0
votes
1answer
1k views

How to undo bundling, merging, and minifying the JavaScript and CSS in Magento 2.1.x

I attempted to speed up my website by bundling, merging, and minifying the JavaScript and CSS through the Admin. Stores> Settings> Configuration> Advanced> and then Developer, and changed ...
1
vote
3answers
930 views

My javascript doesn't run in a custom magento1.9 module

I try to use javascript for a dropdown list I've implemented into a grid as shown in the image. The renderer I use for this dropdown list is like <?php class ...
5
votes
1answer
815 views

Magento 2: Implementing a template through JS

I'm trying to add a javascript file with a HTML template at the end of the checkout page but it doesn't seem to be working. I tried to duplicate the way "Magento/SalesRule/view/frontend/web/template/...
0
votes
0answers
31 views

Magento 2.3.1 not allowing javascript code

I am setting up my store on latest Magento 2.3.1 CE edition. Apache version: Apache/2.4.39 PHP version: 7.2.18 MySQL version: 10.1.40-MariaDB. Also I am using Porto theme. There is a strange ...
0
votes
0answers
25 views

How to send a javascript variable to a PHP file in Magento project?

I have this file that contains a javascript variable: src/app/design/adminhtml/default/default/template/smv/order/sales/creditmemo/refund.phtml <p> <select name="creditmemo[reason]"> ...
0
votes
2answers
1k views

Confirm Password Validation Not Working

I have an issue with the confirmation password validation on creating the account and reset password pages and showing the following error although the passwords match? Please enter the same value ...
0
votes
1answer
937 views

Magento 2 How to add custom grid

How can I add this code in Magneto2 admin page. <html> <head> <link rel="Stylesheet" href="https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css" /> <script type="text/...
1
vote
2answers
4k views

Uncaught SyntaxError: Unexpected token } in JSON at position 199

I tried to add a main.js to my Magento theme using the answer on How To add JS file in frontend for all pages, however, it caused issues so I removed this, however, I still get console error for this. ...
0
votes
1answer
1k views

Lots of jQuery conflicts on Magento 2

I'm working on a new Magento 2 installation with the Porto theme and have noticed that when you first visit the site or have the browser cache disabled you get a lot of of jQuery conflict errors. ...
0
votes
2answers
18 views

Magento2.3.0 :When merge and minify js and css after set production mode not working my admin panel and frontend css lacking

I am using Magento2.3.0 community version When merge and minify js and css after set production mode not working my admin panel and front end css lacking if any one know what is actual issue reply me ...
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 ...
0
votes
1answer
22 views

How to override or extend proceed-to-checkout.js

I need to override or extend Magento's proceed-to-checkout.js file in my module. app/code/Magento/Checkout/view/frontend/web/js/proceed-to-checkout.js In my modules requirejs-config.js I have tried ...
0
votes
1answer
31 views

Magento 2 - Extend onepage.phtml to add custom JS

Magento 2 I have created a custom shipping method module and need to add custom JS to the checkout page where the shipping address and shipping method is set. But it is not working for me. I have ...
0
votes
0answers
44 views

Magento 2.3: How To Initialize Js…?

I'm new to Magento 2.3, I was trying to apply jQuery DataTable and it's done, after that, I want to add it's Button Extention, for that i need to add two more js,so i initialize it, now i'm getting ...
1
vote
2answers
74 views

Magento 2: jQuery Datatables Button Extentions Not Working

============================UPDATED 1.1============================ I'm new to Magento 2.3, I'm trying to apply jQuery DataTable(DONE), after than, I want to add it's Button Extension, for that i ...
3
votes
0answers
58 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.. ...
0
votes
1answer
32 views

Magento 2 | VueJs Framework

Is there a way to use VueJs Framework under Magento 2 ?
0
votes
0answers
49 views

Magento 2.2 - Uncaught TypeError: this.modal.zIndex is not a function

Am using Venus need theme, on mini cart's delete click and Checkout's Already have an account? Click here to login throws this issue. Uncaught TypeError: this.modal.zIndex is not a function modal....
0
votes
0answers
23 views

Error displaying the product name in magento 1.x

I'm having an error displaying the product name. if it is "dog" English then it will appear in the frontend. If it is Vietnamese "dog" it will not display. I am doing it in js file. Other products ...