Announcement

Collapse
No announcement yet.

Initial Attribute State & Select One

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Initial Attribute State & Select One

    I need to have an attribute dropdown contain "Select One" but only for some products, not all. Is there a way to have a different setting for "Initial Attribute State:" other than creating a whole separate PROD page template?

    #2
    hmmm, how about a custom field, and then use the following in the Attribute template

    (pseudo code)

    IF "select-one-custom-field AND "this-attr-code">
    <option value=""> - Select One - </option>
    ENDIF
    Bruce Golub
    Phosphor Media - "Your Success is our Business"

    Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
    phosphormedia.com

    Comment


      #3
      Sorry I didn't clarify - Figuring out how to get the select one to appear wasn't the problem: it is the "Initial Attribute State:" setting under attribute machine that is the problem. If I keep it as "Drop-down lists do not contain Select One", then the product with "Select One" in the dropdown doesn't work. But if I change that setting to "Drop-down Lists Contain Select One", all of my other products break because they have dropdown attributes to that DO NOT need or have Select One.

      Conditional for getting Select One to appear:

      Code:
      <mvt:if expr="l.settings:attribute:code EQ 'holiday-keepsake'">
      <option value="" selected>Select One</option>
      </mvt:if>
      In case it helps this is my attribute machine code:

      Code:
      AttributeMachine.prototype.Generate_Swatch = function( product_code, attribute, option )
      {
          this.swatches   =  document.getElementById('swatch-' + attribute.id);    
          var swatch    = document.createElement( 'li' );
          var span    = document.createElement( 'span' ); // to vertically center the swatch images
          var img        = document.createElement( 'img' );
          img.src        = option.image;
      
          swatch.appendChild( span );
          swatch.appendChild( img );
      
          return swatch;
      }
      AttributeMachine.prototype.oninitializeswatches = function( attributes, possible )
      {
          $(".swatches").empty();
          this.Initialize_Swatches( attributes, possible );
      }

      Comment

      Working...
      X