Copied to clipboard

Flag this post as spam?

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


  • Keith R Hubbard 175 posts 403 karma points
    May 26, 2011 @ 18:29
    Keith R Hubbard
    0

    List Products like a Fancy Box gallery

    I have the http://lynchburgpawnshop.com site and they want products under each services section. I have created a working model but cannot get the xslt to produce it. 

     

     

    This is what it looks like for the product http://lynchburgpawnshop.com/services/jewelry/14k-white-gold-neil-lane-diamond-ring/

     

    Now I want this to output 3 or 4 of the boxes inline. 

     

    This is the Product Template

     

    <%@ Master Language="C#" MasterPageFile="~/masterpages/ContentMaster.master" AutoEventWireup="true" %>

    <asp:content ContentPlaceHolderId="ContentMasterContentPlaceHolder" runat="server">
     <h1><umbraco:Item runat="server" field="pageName"/></h1>
    <umbraco:Item runat="server" field="bodyText"/>
    <div id="Box">
      <div class="Photo">
        <div class="first item left"><a id="gallery" href='<umbraco:Item field="fullImage" runat="server"></umbraco:Item>'><img src='<umbraco:Item field="thumbnail" runat="server"></umbraco:Item>' alt="Lynchburg Pawn Shop"/></a><br/><br/>
          <a id="gallery" href='<umbraco:Item field="fullImage" runat="server"></umbraco:Item>'><umbraco:Item field="featuredProductDescription" runat="server"></umbraco:Item></a><br/><br/>
          <a id="gallery" href='<umbraco:Item field="fullImage" runat="server"></umbraco:Item>'><umbraco:Item field="featuredProductPrice" runat="server"></umbraco:Item></a></div>
      </div>
    </div>
    </asp:content>

     

    This is the ListProducts.xlst

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <div class="photoGrid clearfix">
        <xsl:for-each select="$currentPage/* [@isDoc][string(umbracoNaviHide) != '1']">
          <div>
            <xsl:attribute name="class">
              <xsl:choose>
                <xsl:when test="position() mod 4 = 1">
                  <xsl:text>
                  first item left
             </xsl:text>
                </xsl:when>
                <xsl:otherwise>
                  <xsl:text>
                  item left
             </xsl:text>
                </xsl:otherwise>
              </xsl:choose>
            </xsl:attribute>
            <!-- get first photo thumbnail -->
            <a id="gallery" rel="gal">
              <xsl:attribute name="href">
                <xsl:value-of select="./fullImage"/>
              </xsl:attribute>
              <img src="{./Thumbnail}" alt="{@nodeName}"/>
            </a>
          </div>
          <xsl:if test="position() mod 4 = 0">
            <br class="clearBoth"/>
          </xsl:if>
        </xsl:for-each>
      </div>

    </xsl:template>

    </xsl:stylesheet>

     

    This is the Department Template that I want to list the products under each individual service offering.

     

    <%@ Master Language="C#" MasterPageFile="~/masterpages/ContentMaster.master" AutoEventWireup="true" %>
    <asp:Content id="TextPagecontent" ContentPlaceHolderID="ContentMasterContentPlaceHolder" runat="server">
    <div id="rotator">
    <umbraco:Macro ID="Macro1" Alias="InnerFadeImages" runat="server"></umbraco:Macro>
    </div>
      <div id="leftContent">
        <h2>
        <umbraco:Item field="PageTitle" runat="server"></umbraco:Item>.  
        <umbraco:Item runat="server" field="PageHeader"/>
        </h2>
        <br />
          <div id="FeaturedProduct">
             
            
            <umbraco:Macro Alias="ListProducts" runat="server"></umbraco:Macro>  
        
           
       
        </div>
        <umbraco:Item runat="server" field="bodyText"/>
      </div>
      <div id="facebook">
                <umbraco:Item field="facebook" runat="server" recursive="true"></umbraco:Item>
               </div>
    </asp:Content>

     

    Any Ideas?

  • Daniel Bardi 927 posts 2562 karma points
    May 26, 2011 @ 23:16
    Daniel Bardi
    0

    Try this in the ProductList.xslt  (note: ancestor-or-self/Product)

    <xsl:for-each select="$currentPage/ancestor-or-self/Product [@isDoc][string(umbracoNaviHide) != '1']">

     

  • Keith R Hubbard 175 posts 403 karma points
    May 27, 2011 @ 08:15
    Keith R Hubbard
    0

    I guess I am missing something.  If I only need it to show the product template?  What pulls that for the for-each? 

     

    Something like this?  <xsl:value-of disable-output-escaping="yes" select="umbraco.library:RenderTemplate(current()/.,umbraco.library:GetXmlNodeById(current()/.)/@template)"/>

     

    Product Template

     

    <%@ Master Language="C#" MasterPageFile="~/masterpages/ContentMaster.master" AutoEventWireup="true" %>

    <asp:content ContentPlaceHolderId="ContentMasterContentPlaceHolder" runat="server">
     <h1><umbraco:Item runat="server" field="pageName"/></h1>
    <umbraco:Item runat="server" field="bodyText"/>
    <div id="Box">
      <div class="Photo">
        <div class="first item left"><a id="gallery" href='<umbraco:Item field="fullImage" runat="server"></umbraco:Item>'><img src='<umbraco:Item field="thumbnail" runat="server"></umbraco:Item>' alt="Lynchburg Pawn Shop"/></a><br/><br/>
          <a id="gallery" href='<umbraco:Item field="fullImage" runat="server"></umbraco:Item>'><umbraco:Item field="featuredProductDescription" runat="server"></umbraco:Item></a><br/><br/>
          <a id="gallery" href='<umbraco:Item field="fullImage" runat="server"></umbraco:Item>'><umbraco:Item field="featuredProductPrice" runat="server"></umbraco:Item></a></div>
      </div>
    </div>
    </asp:content>

     

    ListProducts.xslt

     

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets"
      exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets ">


    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

     <!-- The fun starts here -->
      
     <xsl:for-each select="$currentPage/ancestor-or-self/Product [@isDoc][string(umbracoNaviHide) != '1']">
        
        </xsl:for-each>
      

    </xsl:template>

    </xsl:stylesheet>

  • Daniel Bardi 927 posts 2562 karma points
    May 27, 2011 @ 21:20
    Daniel Bardi
    0
    <xsl:for-each select="$currentPage/Product [@isDoc][string(umbracoNaviHide) != '1']">
      <div id="Box">
        <div class="Photo">
          <div class="first item left">
            <
    id="gallery" href='{fullImage}'>
              <
    img src='{thumbNail}' alt="Lynchburg Pawn Shop"/></a><br/><br/>
              <id="gallery" href='{fullImage}'><xsl:value-of select="featuredProductDescription"></a><br/><br/>
              <id="gallery" href='{fullImage}'><xsl:value-of select="featuredProductPrice"/></a>
           </
    div>
         </div>
       </div
    </
    xsl:for-each>
Please Sign in or register to post replies

Write your reply to:

Draft