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.

3
votes
1answer
8k views

Add Javascript File To Head For Create Block

I need to create a block programatically (for various reasons): $myblock = Mage::app()->getLayout()->createBlock('namespace_module/path', 'my_block', $params); This works fine, but the ...
-2
votes
1answer
877 views

Slider Images not Showing [closed]

I have a new site - http://crystelleclothing.co.uk/ and the slider images are not showing... I thought it might be an issue with a .htaccesss file in the Media folder, but there isn't one there... ...
2
votes
2answers
867 views

Send a Magento order to third-party API when placed

I'm looking on an example of where I should place for Magento orders to be sent to a third-party API. I have all documentation and all proper code that I've tested. I just don't know where these API ...
3
votes
1answer
2k views

Switch Image Acording To Custom Options

I would like to be able to let my clients select the product they want using a thumbnail defined in Custom Options. If I have "White" selected in my dropdown menu. I would like the product image to ...
0
votes
1answer
4k views

Help connecting Magento to a third-party REST API

I need to update Magento products using a third party API. What is the best method of doing so. Should I trigger an API call when an event/observer hits on product detail page? There is no OAuth yet, ...
3
votes
1answer
2k views

Changing the address book drop down (for shipping) from drop down list to radio buttons

I need to know how to change the address book drop down on a registered account checkout to radio buttons (similar to Amazon)
2
votes
2answers
1k views

'optionsPrice' is null or not an object in IE7 & IE8

I have been brought onto this Magento site which has configurable products staring at £0.00. There's a JavaScript error concerning the 'optionsPrice' object which only occurs in IE7 & 8. I cannot ...
1
vote
2answers
6k views

Setting Configurable product select options

I have the following requirement. Shop sells varnish with litres/sheen product variations. However, not every product will have same attributes - a 5ltr can may have two sheen options, a 10ltr can may ...
1
vote
3answers
9k views

How to Update a Configurable Attribute by Javascript

On this website there is a very clear explanation how I could trigger the configurable product dropdowns when I use jQuery. But when I do this: .. var element=$('attribute140'); spConfig....
2
votes
1answer
6k views

Onepage checkout error: Uncaught TypeError: Cannot read property 'style' of null

Does anyone know what is causing this error in Onepage Checkout? I can't progress to the billing step when I click continue: 'Uncaught TypeError: Cannot read property 'style' of null ' Shows in ...
4
votes
3answers
4k views

Mass action in widgets

A while back I found a question on stackoverflow about allowing multiple products via a widget. I thought to myself that it would be a great option and surely could not be that difficult. Sadly I was ...
3
votes
1answer
626 views

Magento customer registration not saving selected state/region

So for some reason my Magento install (1.5) stopped saving new customers state/region name, both inside admin and outside. Magento's registration form has a dropdown select, with a name of "region_id"...
0
votes
2answers
12k views

Add to cart error : ReferenceError: productAddToCartForm is not defined [closed]

I am stuck here when i click on add to cart button the firefox console is giving the following error. ReferenceError: productAddToCartForm is not defined i have tried adding the $.noConflict() and ...
6
votes
2answers
7k views

Setting AJAX URL for custom module

I have a JavaScript file in /js/mds/mds_collivery.js. In it I have an AJAX call that should go to magento_install_url/collivery/ajax/cptypes. It will only be used in /checkout/onepage/. However, if I ...
18
votes
2answers
9k views

Google CDN jQuery with Local Fallback in Magento Layout XML

I've done the following to include jQuery from Google CDN in Magento: <default> <reference name="head"> <block type="core/text" name="google.cdn.jquery"> <...
2
votes
3answers
1k views

Integrating chosen.js Prototype or jQuery

Has anyone got chosen.js working on Magento 1.7x? I've seen one thread talking about problems with it and Magento validation. If someone knows if it works can he show me how to do it?
2
votes
2answers
6k views

How to refresh Cart using PHTML file with AJAX Magento?

In following File, there is a file "reload.php" But i want to use "myajaxcart.phtml" in Magento, How ?? Is it possible to use .phtml there, as magento doesn't allow direct access to .phtml files ?? ...
1
vote
2answers
254 views

Jquery prototype conflict IE7 and 9 already using noConflict()

I am using noConflict() function within a template page on a Magento site and I'm pretty sure my code is in the correct order on the following page (view page source): http://animalnecessity.com/...
2
votes
1answer
3k views

How to validate dynamically created forms on same page with VarienForm?

I'm creating onepage customer account and I need to validate dynamically created additional address forms, all on same page. I understand that in Magento you should use new VarienForm to validate ...
0
votes
2answers
9k views

Another prototype jquery conflict issue I think

I am working within the configurable options block on the product page and inserting some javascript right in the bottom of it. I wasn't having any issues but suddenly I'm getting an error in console: ...
1
vote
1answer
700 views

Show Attribute selection upon button click only when prior attribute selected

The following is edited code from the configurable products block on the detail page of each configurable product. It is the block that populates with the select drop downs such as "color". I am ...
3
votes
1answer
2k views

Get Store View info in JS

Is it possible to get the current store view data in a js file. I mean is that info is stored somewhere in the js environment?
0
votes
1answer
485 views

Is it possible to display an attribute from an associated product in magento?

I am working on an ecommerce website. We are showing the nutrition facts for each product and most products are configurable products and these products have different flavors. Since they have ...
1
vote
1answer
337 views

Simulate click and set guest in checkout/onepage/ (skipping first step)

I was wondering, can we (and how) emulate a click and set guest in checkout/onepage/ (skipping first step) Ofcourse there is a plugin, but we have had some bad experiences with this (Crius skipstep) ...
15
votes
3answers
20k views

Magento adding CSS and JS includes to the footer

I'm doing some Yslow optimization of my Magento site and am trying to add the CSS and Js to the footer of the site. At the moment I'm using a head reference tag in the layout XML and using addJs and ...
1
vote
1answer
983 views

Javascript validation for international char-sets

I have a several store views for different languages and we're having some trouble with the new customer sign up forms. We have added the character set init statement for our database as follows: ...
4
votes
1answer
181 views

Can't find callbackFunction

I've been looking all over the place and I can't find what this is: updateCallback : function(elm, status) { if (typeof elm.callbackFunction != 'undefined') { eval(elm.callbackFunction+'(\...
2
votes
1answer
952 views

Magento remove prices from Downloadable products

We have downloadable products without price (0.00€) and added the mysterious price.phtml. Everything works fine, except that the price isn't showed. I checked with xdebug and the price is printed, ...
1
vote
3answers
82 views

Limiting javascript includes by store within a module

I have a payment module that requires a bit of javascript on the checkout page for stores where it is enabled. The good news is that it is correctly including the link on the checkout page. ...
9
votes
1answer
6k views

How to access the Magento API from native client with JavaScript

I need to access the Magento API from a local JavaScript based application (Titanium Desktop) and wondering what's the best way to do so. What I found out so far: The only authentication mechanism ...
2
votes
2answers
2k views

Slidesjs pagination image is always hidden but can on the function if mouse hovers over [closed]

Using Magento Go due to other users lack of developer knowledge. Slidesjs has been added relatively simply and works except for the pagination, the image has been stored in the media storage system, ...
4
votes
1answer
463 views

Magento Go, referencing a JS file attached to a theme in a CMS static block? [closed]

If I want to reference a JS file in a CMS block and the js file has been attached to the theme, how is it done? The CMS block has the script: <script> Galleria.loadTheme('galleria/themes/...
3
votes
3answers
1k views

AJAX validation form in custom backend module

I create custom module and would like to validate the input fields such date. I tried in Form.php public function _prepareForm() { $form = new Varien_Data_Form(array( 'id' =&...
35
votes
7answers
34k views

Move all Javascript includes to before </body>

Does anyone know how to have all of Magento's JS script tags e.g. <script type="text/javascript" src="http://sitename.com/js/prototype/prototype.js"></script> render out before the closing ...
2
votes
5answers
581 views

How can I easily test variations of the “Add to cart” button?

It seems most of the A/B and multivariate experiments ask you to create entirely new pages, which is not possible for 10,000 products. I only want to try different add to cart buttons, so wouldn't it ...
6
votes
3answers
3k views

How do I GZIP the merged JS file?

I noticed when I merge the CSS/JS files then enable Gzip in the htaccess, JS doesn't compress. Does anyone have an idea how to fix this? Update: Htaccess File Content ################################...
15
votes
2answers
11k views

When merging CSS or JS, a new file is generated for each page type

We have a lot of small CSS and JS files and enabling merging seems to be a good choice. Many of the CSS and JS files are used on every page (home page, category page, product detail page). Whenever, ...