× Got a CSS, HTML or webdesign question? Ask it here!

Advanced Javascript edits

1 year 11 months ago #15521 by infrared
Advanced Javascript edits was created by infrared
Hi All,

I have been modifying and overriding the Prototype classes used for Deconetwork's designer.

For example, I wanted the Product filter menu to have different size Header tags and innerHTML.

So I overrode the SPCategory class function buildDropDownHtml()
SPCategory.prototype.buildDropdownHtml = ( function( old ) {
    return function(){
      var returnValue = old.apply( this, arguments );
    
    if(!this.hasChildren()) return null;
    var opts = [];
    
    opts.push('<option value="">' + ml('Select Category') + '</option>');
    
    for(var i=0; i < this.categories.list.length; i++) {
      var cat = this.categories.list[i];
      opts.push('<option value="' + cat.id + '">' + cat.name + '</option>');
    }
			
		var h3s2 = '<h3>Type of Apparel<h3>';
    var h3s3 = '<h3>Style of Apparel<h3>';
			
   
			 if(this.categories.list[0].name === "Basic"){//may need an `or` for youth here.
				return h3s3 + '<select id="sp_cat_' + this.id + '">' + opts.join("\n") + '</select><div id="sp_cat_c_' + this.id + '"></div>';
			}else{
				 return h3s2 + '<select id="sp_cat_' + this.id + '">' + opts.join("\n") + '</select><div id="sp_cat_c_' + this.id + '"></div>';
			}
       
    }
  })(SPCategory.prototype.buildDropdownHtml)

If anyone wants to make Major changes to the default designer's html and functionality, respond here.


thanks,

Please Log in or Create an account to join the conversation.

Time to create page: 0.088 seconds
Powered by Kunena Forum