Copied to clipboard

Flag this post as spam?

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


  • Streety 358 posts 568 karma points
    Mar 26, 2012 @ 11:41
    Streety
    0

    Show variants on the front page

    Hello I am trying to mod your XSLT for handling the DEAL of the DAY by including variants.

     

    I have found the block of code that does the magic:

    <xsl:choose>
    <xsl:when test="count($product/Product) &gt; 0">
    <div class="productVariants" >

    Select an Option:<br />
    <select name="nodeId">
    <!-- 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>

    </div>
    </xsl:when>
    <xsl:otherwise>
    <input name="nodeId" type="hidden" value="{@id}" />
    </xsl:otherwise>
    </xsl:choose>

    However when selecting a variant it loads the full description and I obvioulsy just wnat the price change. Presumably its handled in a bit of JS somewhere.

    Could you please point me in the right direction please.

  • Rune Grønkjær 1372 posts 3103 karma points
    Mar 26, 2012 @ 11:47
    Rune Grønkjær
    0

    Hi Streety,

    Yes, the variant javascript loads the entire product again. Switching both prices, texts and images. To change that you go to teaCommerce_Simple.js and the updateProduct method. You can change it in any way you like.

    /Rune

  • Streety 358 posts 568 karma points
    Mar 26, 2012 @ 12:05
    Streety
    0

    Found the method.

    function updateProduct(productEle) {
    var variant = productEle.find('.productVariants select').val(),
    chosenProductId = variant ? variant : productEle.attr('productid'),
    xsltFile = productEle.parent().hasClass('productList') ? 'productList-AjaxProduct.xslt' : 'product.xslt',
    htmlFromServer = TeaCommerce.invokeXSLT(xsltFile, chosenProductId,
    {
    umbracoLanguageId: _languageId,
    async: false
    });



    productEle.before(htmlFromServer).remove();
    }

    Sorry about the spoonfeeding...but where from here

     

    My xlst has the appropriate class

  • Rune Grønkjær 1372 posts 3103 karma points
    Mar 26, 2012 @ 12:32
    Rune Grønkjær
    0

    That depends on where we're going :)

    What do you exactly want it to do? Please spoonfeed me as well ;)

    /Rune

  • Streety 358 posts 568 karma points
    Mar 26, 2012 @ 13:03
    Streety
    0

    Sorry,

    I am using your old starterkit (not the new bike shop)  to display products as its rather good.

     

    The home page has TWO product sections both referencing product nodes via a picker control on the home page.

     

    The Second section passes in the productlist.xslt which loads in the required products from the picker. This is styled like the product category section parent of the product.

    The First section is similar except I have modded the styling to show one product with more information and a larger picture.

    Its html is coming form productListDealOfTheDay.xslt to get the home page picker reference

    which calls ...

    Might be simpler to show you.

     

    Can I email you the link?

     

     

  • Streety 358 posts 568 karma points
    Mar 26, 2012 @ 13:05
    Streety
    0

    Have sent the url to [email protected]

     

    Hope that is OK

     

     

  • Rune Grønkjær 1372 posts 3103 karma points
    Mar 26, 2012 @ 13:05
    Rune Grønkjær
    0

    Yes, please do: rg [at] teasolutions.dk

    /Rune

  • Streety 358 posts 568 karma points
    Mar 26, 2012 @ 13:07
    Streety
    0

    Oh OK?

  • Rune Grønkjær 1372 posts 3103 karma points
    Mar 26, 2012 @ 13:21
    Rune Grønkjær
    0

    Hi Streety,

    I got the mail. Looks like a pretty classic problem.

    It looks like a xslt problem of some kind. Remember that when the page is initiated this is done with the main product. When invokeXSLT is invoked the produt is then reloaded, but this time with the variant node.

    You have to check that your xslt's can handle that.

    /Rune

  • Streety 358 posts 568 karma points
    Mar 26, 2012 @ 13:33
    Streety
    0

    Well I want to mimic the behavoir of the working "section 2"panels.

    If I can see that I can correct problem as it should be indentical.

    I need to get visibility how you are updating the products. Do you have a diagram or flow diagram of the process. It would make more sense and I suspect be helpful to others using Tea Commerce.

    Thanks again.

  • Rune Grønkjær 1372 posts 3103 karma points
    Mar 27, 2012 @ 08:11
    Rune Grønkjær
    0

    It's actually pretty streight forward.

    As you can see in the javascript, it will find the div with the class invokeXSLT. In that div is stored information about what xslt to load, when the variant is changed. You must ensure that the right xslt is written there, and it actually looks like it's the wrong one in your case.

    It's loading the product.xslt, but it should be loading the same one that is loaded the first time.

    /Rune

  • Streety 358 posts 568 karma points
    Mar 27, 2012 @ 12:27
    Streety
    0

    Hmmm, I sure its simple for you Rune. I don't have the benefit of designing this.

    My templates look correct.

    For instance the only place I can find that invokeXSLT is within the calling xlt file.

    Lets take ProductListFeatured for example which calls productList-Product.xslt to get its HTML and styling. The line to invoke is:

    <div class="invokeXSLT">productListfeatured.xslt</div>

    I have this on my home page and it works fine.

    I have another section which is vertically identical calling productListDealOfTheDay.xslt and then productList-product-Dotd.xslt for the html and styling. The invoke XSLT is:

    <div class="invokeXSLT">productListDealOfTheDay.xslt</div>

     

    Unless its:

    getting its Invoke commenad elsewhere

    or

    You can only invoke on template per page

     

    It doesn't make sense that it works for the featured but not for the deal of the day.

     

  • Streety 358 posts 568 karma points
    Mar 27, 2012 @ 14:05
    Streety
    0

    I am getting there.

    It seems my invokeXSLT is writing twice first by my code then overwritten by the product one.

    I have debugged to a class causing the kerfuflle

  • Rune Grønkjær 1372 posts 3103 karma points
    Mar 28, 2012 @ 15:32
    Rune Grønkjær
    0

    How's it going with this problem? And yes, of cause it's easier for us. But only because we already made all the mistakes. :)

    /Rune

  • Rune Grønkjær 1372 posts 3103 karma points
    Mar 28, 2012 @ 15:33
    Rune Grønkjær
    0

    How's it going with this problem? And yes, of cause it's easier for us. But only because we already made all the mistakes. :)

    /Rune

Please Sign in or register to post replies

Write your reply to:

Draft