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.

0
votes
2answers
1k views

Add js in head in magento 1.9

All js script are loaded in footer in magento 1.9. I want them in head. Can Anyone let how to do this ?
2
votes
1answer
3k views

Magento 2 - Enabled show/hide functionality on header search

I've currently got the following phtml file in my theme: Vender/Theme/Magento_Search/templates/form.mini.phtml and the following js file inside of my theme as well: Vender/Theme/Magento_Search/...
0
votes
0answers
12 views

Magento2 How do I see the raw files, I'm just on the admin

I'm very new to this, I'm doing this for a client. I see there is a content section where I can edit the blocks. I suppose I can edit the custom js to add a javascript file to call my API. I'm try to ...
0
votes
0answers
13 views

Magento 2 Assign customer group name to externally calling JavaScript file variable

PreRequisites: MageVersion - Magento 2.3.x External JavaScript - http://domain.com/external-js.js var mage_customer_group = ''; //other code related to the customer group Pages - Category page and ...
2
votes
1answer
933 views

Drag and drop category error

I get There was a category move error. on moving(drag and drop) subcategory to another root category. How I debug this? on console I get Expected to start loader but did not find one in the dom this ...
2
votes
3answers
71 views

How to hide fields with toggle checkbox in ui_component Magento 2

I have a toggle checkbox at product edit form: Created as: <field name="open_amount" formElement="checkbox"> <argument name="data" xsi:type="array"> &...
3
votes
0answers
292 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\...
1
vote
0answers
37 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 ...
0
votes
1answer
871 views

Magento : Get Configurable Product Price From Simple Products

Is it possible to get simple product price without manually updating associated fixed price or percentage? We have more than 3000 configurable products, so it's not possible to do it manually. Can ...
1
vote
2answers
1k views

Magento 2.1.6 - Extending the dropdownDialog (lib/web/mage/dropdown.js) not working

I am trying to extend the default dropdown.js of Magento 1) Created a new JS file at app/design/frontend/<vendor>/<theme-name>/web/js/mage/dropdown.js define([ "jquery", "jquery/...
6
votes
3answers
157 views

Magento 2 Advanced Js Bundling

Can any one worked on Advanced JS Bundling? We would like to apply this concept to one of our client projects. Could you please explain about Advanced JavaScript bundling in detailed step by step &...
0
votes
2answers
1k views

Fixed Header and Mega Menu

I'm new at magento. I'm using luma theme as a blank. I want to fix header and mega menu when page scroll down. Thanks for your helps.
0
votes
1answer
975 views

Get quantity in stock for items added in cart in JS

I need the quantity available for each product in cart in my custom javascript file. Does anyone know how to do this?
2
votes
1answer
1k views

Magento 2 : How to Implement Swiper Plugin

I'm trying to convert html template to Magento 2.1.3. I started my conversion using blank-sass from Snowdog. Some CSS was sucessfully implemented but I can't figure out many points. One of them is how ...
0
votes
1answer
27 views

how to add js in custom form in backend magento 2

I have used this code in my form to manage the field id_pdt that is a foreign key so i will put a text from bar code and then search in mu custom table to find if the sku exists in table product and ...
11
votes
9answers
18k views

Magento 2: Not loading CSS and JS after successful installation in windows

CSS and JS not loading after installation of Magento 2 default template OS: Windows 10 Xampp Control panel V3.2.2 PHP version: 5.6.28 Server: Apache/2.4.23 (Win32) phpmyadmin Version information: 4....
1
vote
1answer
28 views

How to add 3rd party js library to Magento 2

I am trying to install the following slider to my own Module https://owlcarousel2.github.io/OwlCarousel2/demos/demos.html. But unfortunately, Magento has its own complicated mechanism to manage its ...
0
votes
1answer
16 views

How to include script with out using document.write function [closed]

Hi I want to include the external script inside the another script. Like : <script type='text/javascript'> function callScript() { var test = Math.random()+''; test = test * 1000000; ...
1
vote
1answer
1k views

Knockout JS removes jQuery change event

I don't know if it is specific to Magento 2 but an already set up HTML node with jQuery change event attached to it will lose its change event when run inside a knockout component with attached VM (...
0
votes
1answer
23 views

Add onclick function to input

I want to add a js function to an input field located in a phtml page on my magento 2 I have write my function like below: <script> function qtyzn() { ..... }...
0
votes
0answers
26 views

Magento2 add js custom conversion tracking on thank you page on first time load

I'm editing a client's site and I need to add custom javascript for our purchase tracking, on a success or thank you page. Oh shopify we put it on the checkout input box custom script input window ...
2
votes
1answer
32 views

Overriding function from the modal.js file

How can I override a function from the modal.js file in the path vendor/magento/module-ui/view/base/web/js/modal/modal.js ? In this file, line 307, is a function with name closeModal() that I want to ...
3
votes
4answers
16k views

Call a PHP file with AJAX in Magento

Seems like I can't make Ajax to call the PHP file and I can't figure out what or where the problem is. I`m trying to make a module that reads from database and it should display a form with options to ...
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....
0
votes
2answers
2k views

Uncaught DOMException: Blocked a Frame with origin from accessing a cross origin-frame

I have a Magento 1.9 site that uses TinyMCE. Everything worked fine until I added a cdn. The script wouldn't load because it was on a different domain. I went ahead and added a subdomain but it still ...
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 ...
8
votes
4answers
22k views

Use require-config.js to load files needed on all pages

I know how to use require-config.js in custom theme, but I would like to use custom javascript file (myfile.js) on all pages. In which directory should I add require-config.js and how to use it, so ...
1
vote
0answers
17 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
2
votes
2answers
23 views

Magento2 : I am getting this error when i upload two custom module and css and js file

I am getting this error on my live site as production mode and I uploaded only two custom module and js and css and two overwrite file in our theme.Below share error as warning showing I apply all ...
1
vote
1answer
925 views

styles and js not found 404 magento2

I installed magento2 on openserver created my custom theme developer mode is enabled content deployed When i try to load home page browser showed errors in pub/static i have only wNumb.min.js and ...
1
vote
0answers
41 views

Magento 2 Issue with JavaScript and CSS Merge

I have checked my site for speed and it was requesting 258 requests. I have merged all JavaScript and CSS files and again tested it but still 251 requests are there. While in view page source I can'...
0
votes
1answer
1k views

mage/translation not working magento 2 (translation issue)

I am working on pdp page (mobile view), in drop down i need to show out of stock if qty is out of stock and low stock if qty is low stock, it is working as expected but it is not getting translated to ...
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 ...
2
votes
3answers
29 views

Magento bad execution on js and css

i have a issue when a try to access to my Magento Admin Panel and frontend default page. the admin panel always shows epmty And the frontend default page show content but without CSS and JS: how to ...
0
votes
1answer
13 views

How can active accordion tab on click

I want to active an accordion tab on button click with activate() method https://devdocs.magento.com/guides/v2.1/javascript-dev-guide/widgets/widget_tabs.html#fedg_tabs_methods-activate This is my ...
1
vote
2answers
1k views

Adding custom js and css to Product grid in Magento 2

Can we add custom JavaScript and CSS to the Product grid. I've created a product_listing.xml within my own module, and it's working, but can we add custom JS and CSS to product_listing.xml like we do ...
1
vote
2answers
39 views

MagenImage Upload File Extention JS Validation?

I'm new to Magento 2.3, i want to validate file upload field. Allowed file formats: jpeg. I put a method in lib\web\mage\validation.js require([ 'jquery', 'jquery/ui', '...
3
votes
1answer
3k views

Modify checkout step navigation magento 2

I'm customizing the checkout process in magento 2 by adding a custom step between Shipping and Payment steps and by adding a checkbox in Shipping step. The problem When going to checkout page for ...
4
votes
1answer
4k views

Password Requirements Complexity - Magento

I would like to increase password security for customer and admin accounts in Magento. In addition to minimum password length, contain uppercase, lowercase, special characters, and digits. I found ...
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,...
5
votes
1answer
2k views

how to extend default javascript

I try to extend standard magento javascript configuration but I just get nothing. I'm following this: http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/custom_js.html and this: ...
3
votes
1answer
2k views

How to track product list impressions/clicks and related sales?

We have products in several different categories in our Magento shop. And with enhanced ecommerce tracking we want track the product list performance. I used this Google dev docs. Eg.: Product is in ...
1
vote
4answers
1k views

magento 2 Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option'

I am having an issue on my website the issue Error: cannot call methods on priceBox prior to initialization; attempted to call method 'option' My website https://www.cartaroo.com.cy/?...
0
votes
0answers
15 views

Magento 2 + NGINX + REDIS + VARNISH + SSL Changing to Developer mode

in Production Mode everything is fine. When i change to Developer Mode i have this Problem because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is ...
3
votes
2answers
2k views

Uncaught ReferenceError: define is not defined in extension custom js

i created the custom js for backend extension module like this: custom.js: define([ 'jquery', 'underscore', 'mage/url', 'jquery/ui' ], function ($, _,urlBuilder) { 'use ...
0
votes
0answers
454 views

Executing JS function onclick button which is present inside form

We have button "create" and onclick "Create" button, it will create product programmatically and assign custom image to that product. app/design/frontend/rwd/Theme3/template/aitcg - js_styles1.phtml ...
1
vote
1answer
57 views

Magento 2 custom module set the css and js file using the check the particular product attribute is enable or not

I have a custom module.I want to the add the css and js file if my custom product attribute value is available. In xml I can't check product attribute value is available or not. so what i do? ...
5
votes
1answer
1k views

All product images missing from admin but show in DB and front end

Using Magento v1.9.2.2 with patches SUPEE-7405 v1, SUPEE-7405 v1.1, SUPEE-8788, SUPEE-9652. Browsers: Safari & Chrome on Mac OSX. I'm having an issue where none of the images in the product admin ...