I am getting not a function error from javascript.
This is part of my object that I define:
Product.Config.prototype.configureSubscribe = function(funct)
{
this.configureObservers.push(funct);
};
After that I create another object:
Product.ConfigurableSwatches = Class.create();
Product.ConfigurableSwatches.prototype = {
initialize: function(productConfig, config) {
// redefine some default options if configured
if (config && typeof(config) == 'object') {
this.setConfig(config);
}
this.productConfig = productConfig;
// Store configurable attribute data
var attributes = [];
for (var i in productConfig.config.attributes) {
attributes.push(productConfig.config.attributes[i]);
}
this.configurableAttributes = attributes;
// Run it
this.run();
return this;
},
run: function() {
// HERE IT BREAKS
this.productConfig.configureSubscribe(this.onSelectChange.bind(this));
}
}
I am getting following error:
Uncaught TypeError: this.productConfig.configureSubscribe is not a function
Can someone advice what is the problem?
Product.ConfigurableSwatches.init?Product.ConfigurableSwatches. Can you add your answer so I can mark it as correct answer.