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

Advanced Javascript edits

1 year 9 months ago #15521 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.117 seconds
Powered by Kunena Forum

Latest from our blog

DecoNetwork 8 - Update 3: GDPR Compliance (+56 tasks completed)

DecoNetwork 8 - Update 3: GDPR Compliance (+56 tasks completed) In this release, DecoNetwork updated its Privacy Policy and Terms of Use, effective May 23, 2018. These changes were made primarily in preparation...Read More

This Week in Catalog - May 18, 2018

This Week in Catalog - May 18, 2018 I have two big announcements to make in regards to the DecoNetwork catalogs. We read and listen to your complaints and suggestions. Recently, I...Read More

DecoNetwork 8 - Available Now!

DecoNetwork 8 - Available Now! After an incredible amount of work in design, development, and testing, DecoNetwork 8 is here! With version 8, we recommitted ourselves...Read More

This Week in Catalog: May 11, 2018

This Week in Catalog: May 11, 2018 Lately, we've been getting a lot of new products in each week. More than is typical. All those new products (mostly in the S&S Activewear...Read More

DecoNetwork 8 - Update 2 now available: SEO Improvements and more (+75 tasks implemented)

DecoNetwork 8 - Update 2 now available: SEO Improvements and more (+75  tasks implemented) DecoNetwork 8 was released just ten days ago, but we have already a second update (8.002) available for you with many improvements and fixes...Read More