Prototype error in Magento - magento

I'm using the HelloResponsive EE theme on a Magento 1.13 EE deployment.
In setting up an extention for the eWAY gateway, I was told there was an error in the Prototype.js file that was interfering with the JSON post.
Uncaught TypeError: Object.keys called on non-object prototype.js:126 addMethods prototype.js:126 create prototype.js:115 (anonymous function) wishlist.js:38
for (var i = 0, length = properties.length; i < length; i++) klass.addMethods(properties[i]);
The custom theme does use JQuery as well, so this may be a conflict issue. But when I try moving the JQuery call before the Prototype call, the JQuery functions stop working.
Can anyone help explain 1. whether or not the error is related to the Prototype / JQuery conflict (I am using a noConflict script) and 2. how best to fix this?
Thanks!
Randy

Take a look at the answer in this thread and see if it can help you. Essentially, I had an outdated template file in my theme that was missing some key variable definitions:
https://magento.stackexchange.com/questions/7682/error-in-prototype-js

Related

Vuepress oidc-client preventing build

It looks like Vuepress is made for public docs, but we decided to add client and server security to protect some of the doc pages. But unfortunately although oidc-client (https://github.com/IdentityModel/oidc-client-js/wiki) works during dev, it throws exception when build.
I get ReferenceError: window is not defined and when I try to trick the compiler with const window = window || { location: {} }; I get TypeError: Cannot read property 'getItem' of undefined
Any idea how to make this work?
This was driving me nuts also. I discovered the component I was trying to add was looking at window.location in its code - this was triggering the error.
My understanding is that the build process has not access to Browser things like window etc.
As soon as I removed the window.location bit from my code things built just fine and all is well.

Javascript Visualforce update object not working

I am new in visualforce apex development, and I am trying to update object of salesforce but its throwing error: "Refused to set unsafe header "User-Agent"".
Please help me out.
I am trying the below code:
function updateAccounts(terrId,accId){
var acc=[];
var contact = new sforce.SObject("ObjectTerritory2Association");
contact.objectid = accId;
contact.territory2id = terrId;
acc.push(contact);
sforce.connection.sessionId = "{!$Api.Session_ID}";
if(terrId!="")
sforce.connection.update(acc);
else
sforce.connection.delete(acc);
}
</script>
Thank you.
I remember running into this problem. I don't remember the exact reason it was happening - something about being a Community User vs. a Salesforce user.
I recommend using JavaScript Remoting instead.

“Object doesn't support property or method 'ready'”

Object doesn't support property or method 'ready'
I am getting this error while using custom dropdown list with js mootools slider. I have downloaded js slider and custom dropdown and while trying to merge it, I am facing this error.
I have downloaded the js slider plugin from here:
http://landofcoder.com/index.php?option=com_jdownloads&Itemid=372&task=view.download&cid=6
Can anyone tell me what's wrong with it ?
Make sure what you have mootool and jquery required. You can open Inspector in Google Chrome and type in console tab MooTools and jQuery.
This libraries has conflict on global variable $.
document.id('element_id') // Mootools' "$"
jQuery('selector or something') // jQuery's "$"
I hope in you situation this should help
jQuery(document).ready(function() {
// initialize you code
});

prototype.js issues

I am trying to migrate my application from prototype 1.5 to 1.7
However I get errors using getElementsByClassName
My piece of code looks something like this
this.top = Element.getHeight(Element.getElementsByClassName(cell.element,"Day")[0])
However I get javascript error "Element.getElementsByClassName is not a function"
Any idea how to resolve this error ?
Make your Prototype code more Prototype-y.
this.top = cell.element.down('.Day').getHeight();

How to override window.location in Firefox?

I am trying to override the window.location in Firefox, through the following code and keep getting an error (actually want to prevent the default behavior, but I think that's not relevant) :
Code :
window.__defineGetter__('location', function() {});
Error
redeclaration of var location
I started with the suggestions at Programatically disable window.location.reload?, but didn't work.
Thanks in advance,
Sunil
The location property of Window is non-configurable for security reasons, because some broken things out in the wild base security checks on the value of window.location.toString(), so you can't do this.

Resources