Announcement

Collapse
No announcement yet.

Coding Bug or VM bug? And a catch -- which seems stupid.

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

    Coding Bug or VM bug? And a catch -- which seems stupid.

    Any ideas what's happening?

    The rendered code from this exert (product attribute template) seems to be incorrect and I don't see why. This same exact conditional branch of code works for the radio options.
    The catch is that the problem does NOT show up in MS Edge. The browser fun continues -- in reverse.

    I have to two band-aid fixes that IMO should not be necessary.

    For the SELECT attribute type, the options list is generating a
    <option></option>
    when the condition is true. The result is that Firefox and Chrome render the blank line in the list. So, the logic works as expected right up until the blank is generated. In Edge, there isn't a blank line or it's ignored.

    Code:
       <mvt:elseif expr="l.settings:attribute:type EQ 'select'">
          <mvt:comment> Are we hiding and attributes? Get the hide list from the custom field </mvt:comment>
          <mvt:item name="customfields" param="Read_Product_Code( l.settings:product:code, 'hideattr', g.thisattrcode )" />
    
          <div class="form-row">
             <select name="Product_Attributes[&mvt:attribute:index;]:value" id="&mvt:attributeID;" class="input-medium" data-attribute="&mvte:attribute:code;">          
                <option value="">&mvt:attribute:prompt;</option>
                <mvt:foreach iterator="option" array="attribute:options">
    
    <mvt:if expr="'|' $ toupper(l.settings:option:code) $ '|' CIN toupper(g.thisattrcode)">
       <mvt:foreachcontinue />
    <mvt:else>
    
                   <mvt:if expr="((g.Product_Attributes[l.settings:attribute:index]:value EQ 0) AND (l.settings:option:id EQ l.settings:attribute:default_id)) OR (g.Product_Attributes[l.settings:attribute:index]:value EQ l.settings:option:code)">
                      <option data-inventory="&mvt:global:attr_exclude;" id="invcontrol_&mvte:product:code;_&mvte:option:code;" value="&mvte:option:code;" data-option-price="&mvt:option:price;" data-regular-price="" selected>
                         &mvte:option:prompt; &mvte:pm:showPricing:select;
                      </option>
                   <mvt:else>
                      <option data-inventory="&mvt:global:attr_exclude;" id="invcontrol_&mvte:product:code;_&mvte:option:code;" value="&mvte:option:code;" data-option-price="&mvt:option:price;" data-regular-price="">
                         &mvte:option:prompt; &mvte:pm:showPricing:select;
                      </option>
                   </mvt:if>
    
    </mvt:if>
    
                </mvt:foreach>
    
             </select>
          </div>
       <mvt:elseif expr="l.settings:attribute:type EQ 'swatch-select'">
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    #2
    Just for fun turn off miva's compress white space at the beginning of the attribute template code

    <mvt:miva compresswhitespace="off" />

    See what the rendered code looks like after that.
    Colin Puttick
    Miva Web Developer @ Glendale Designs

    Comment


      #3
      That was a good thought. No change, however.
      My first thought was that Edge might render broken. That didn't happen either.

      I would have loved that band-aid. It would not have explained why the SMT is rendering incorrectly.

      Scott
      Need to offer Shipping Insurance?
      Interactive Design Solutions https://www.myids.net
      MivaMerchant Business Partner | Certified MivaMerchant Web Developer
      Competitive Rates, Custom Modules and Integrations, Store Integration
      AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
      My T-shirt Collection is mostly MivaCon T-shirts!!

      Comment


        #4
        Try this, there might be some crazy hidden characters messing things up:

        1. Paste the code into Notepad++ (or an equiv text editor that can CHANGE encoding an line breaks on the fly.)
        2. Convert the character encoding of the doc to ANSI
        3. Then Convert the character encoding of the doc to UTF-8
        4. Then Change the line breaks to Unix LF
        5. Look for any strange special characters that show up. There might be some crazy hidden stuff that's messing around.
        6. Copy that and paste back into Miva template. Test.


        Alt method is to manually type it out again, which doesn't sound fun to me but worth a try.
        Colin Puttick
        Miva Web Developer @ Glendale Designs

        Comment


          #5
          Note: It appears that the <option></option> code is being written in by jQuery...not outputted by miva.

          I determined this by using one of my favorite debugging tools--copy/paste the source into a static HTML file and view :)
          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


            #6
            What's the URL to see this happening in the first place. Sorry if I'm blind. Just curious.
            Colin Puttick
            Miva Web Developer @ Glendale Designs

            Comment


              #7
              So, it does NOT appear to be an SMT rendering issue. In the "view" source, as Bruce suggested, the "empty" option tag doesn't exist. However, and I didn't know this, the browser's inspector tool can show you the code used in the display. So, in this case, it's likely some javascript or Jquery I've added to the page is updating the HTML after the document is ready.

              As a side note, MS Edge is actually misleading even though it's displaying the LIST how I expect it to. Edge appears to be ignoring the instruction it should be following.

              Scott
              Need to offer Shipping Insurance?
              Interactive Design Solutions https://www.myids.net
              MivaMerchant Business Partner | Certified MivaMerchant Web Developer
              Competitive Rates, Custom Modules and Integrations, Store Integration
              AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
              My T-shirt Collection is mostly MivaCon T-shirts!!

              Comment

              Working...
              X