Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • bob baty-barr 1180 posts 1294 karma points MVP
    Feb 18, 2013 @ 22:27
    bob baty-barr
    0

    how do i add a top variant - ie, -- please select--

    we don't want our variants to default to the first size or color -- how can we have it be a --- please select ---? i added it to the macro code, but it still switches to small even though i have --- please select -- hard coded. where is this being set?

    thanks,

  • Rune Grønkjær 1303 posts 2895 karma points
    Feb 19, 2013 @ 08:26
    Rune Grønkjær
    0

    Hi Bob,

    The --please select-- is just an option you should add to the variants select.

    Just set it's value="0". You might then have to change some JavaScript int the advanced js, to ignore the onChange event when the value is 0.

    How does that sound?

    /Rune

  • bob baty-barr 1180 posts 1294 karma points MVP
    Feb 19, 2013 @ 15:22
    bob baty-barr
    0

    but that is what i am doing... however, it selects the first actual variant -- are you saying i need to add a variant called --- select -- ?

    <select name="nodeId" class="productVariants" id="productVariants">
    <option value="0">--- Select ---</option>
                      <!-- loop through each of the variant products -->
                      <xsl:for-each select="$product/Product">
                        <!-- do whatever you like here -->
                        <option value="{@id}">
                          <!-- <xsl:if test="$variant/@id = @id">
                            <xsl:attribute name="selected">true</xsl:attribute>
                          </xsl:if> -->
                          <xsl:value-of select="@nodeName" />
                        </option>
                      </xsl:for-each>
                    </select>
  • Anders Burla Johansen 2560 posts 8256 karma points
    Feb 19, 2013 @ 15:35
    Anders Burla Johansen
    0

    Hi Bob

    No you need to just add the ---Select--- to the html.

    Then when its in the html you will have to fix the javascript to not auto select the first variant. I cant remeber where it is in the JS but try and debug it :)

    Kind regards
    Anders

  • bob baty-barr 1180 posts 1294 karma points MVP
    Feb 19, 2013 @ 15:40
    bob baty-barr
    0

    the only thing i can find is here... and i dont' think this is what does it?

    function updateProduct(productEle) {
      var variant = productEle.find('select.productVariants').val(),
          chosenProductId = variant ? variant : productEle.attr('productid'),
          xsltFile = productEle.children('.invokeXSLT').text(),
          htmlFromServer = TeaCommerce.invokeXSLT(xsltFile, chosenProductId,
          {
            umbracoLanguageId: _languageId,
            async: false
          });
  • Rune Grønkjær 1303 posts 2895 karma points
    Feb 19, 2013 @ 15:57
    Rune Grønkjær
    0

    This is the code you're looking for in the teaCommerce_Advanced.js:

    jQuery('select.productVariants').live('change', function () {
      //Update a single product in the UI
      updateProduct(jQuery(this).closest('.productToUpdate'));
    });

    Check the value of jQuery(this) and do nothing if it's zero.

    Have you purchased your tickets for this years Code Garden in Copenhagen? Hope to be seing you there again.

    /Rune

  • bob baty-barr 1180 posts 1294 karma points MVP
    Feb 19, 2013 @ 16:01
    bob baty-barr
    0

    Rune, my ticket for the event is purchased... now to get travel and room squared away!

    thanks for the pointer on the piece of javascript... let me see what i can figure out from here... stay tuned.

  • bob baty-barr 1180 posts 1294 karma points MVP
    Feb 19, 2013 @ 16:08
    bob baty-barr
    0

    hmmm... that did not appear to do anything...

     

    /*
    PRODUCT VARIANTS CHANGE
    */
    jQuery('select.productVariants').live('change', function () {
      //Update a single product in the UI
        if (jQuery(this)== '0') {
            // do nothing
         } else {
            updateProduct(jQuery(this).closest('.productToUpdate'));
         }
    });
    
  • bob baty-barr 1180 posts 1294 karma points MVP
    Feb 19, 2013 @ 16:09
    bob baty-barr
    0

    if it is at all helpful... here is the page.

    http://iouelocal30.org.ourdevsite.com/local-30-store.aspx

     

  • Rune Grønkjær 1303 posts 2895 karma points
    Feb 20, 2013 @ 07:57
    Rune Grønkjær
    0

    Hi Bob,

    Here you go:
    http://api.jquery.com/val/

    And cool that you're coming to Copenhagen. Then I can give you a few jQuery pointers ;)

    /Rune

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies