Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 7 of 7

Thread: How can I get the SKU and use that in a line of <iframe> code?

  1. #1
    macecase is offline Member
    Join Date
    Feb 2011
    Posts
    44

    Default How can I get the SKU and use that in a line of <iframe> code?

    I want to dynamically yield something like this:

    <iframe src="/descriptions/productspecs/FL005.html" frameborder="0" SCROLLING="NO" HEIGHT="550" WIDTH="600"></iframe>

    I don't want to use the built-in product specs function.

    I'd like to have this line in my XML package so I can insert an iframe on the page consisting of an html page that is named the product's SKU + .html

    Question being.... How do I get the "<iframe src=/descriptions/productspecs/" + SKU + ".html frameborder="0" SCROLLING="NO" HEIGHT="550" WIDTH="600"></iframe>" to be generated within the XML package.
    Last edited by macecase; 09-19-2011 at 04:41 AM.

  2. #2
    ROBB is offline Senior Member
    Join Date
    Jun 2011
    Location
    United States
    Posts
    107

    Default SKU Iframe Code

    macecase,

    There are a couple of ways to embed a dynamic value into your src attribute tag. The method I prefer, is using the xsl attribute tag. Here is an example of how I would include the SKU value in the src tag:

    Code:
    <iframe frameborder="0" SCROLLING="NO" HEIGHT="550" WIDTH="600">
    <xsl:attribute name="src">
              <xsl:value-of select="concat('/descriptions/productspecs/',SKU,'.html')"/>
    </xsl:attribute>
    </iframe>
    Replace "SKU", if necessary, with the appropriate value reference.

    Let me know if you have any other questions.

  3. #3
    macecase is offline Member
    Join Date
    Feb 2011
    Posts
    44

    Default Great

    Ok, thank! That helps a lot.

    Quote Originally Posted by ROBB View Post
    macecase,

    There are a couple of ways to embed a dynamic value into your src attribute tag. The method I prefer, is using the xsl attribute tag. Here is an example of how I would include the SKU value in the src tag:

    Code:
    <iframe frameborder="0" SCROLLING="NO" HEIGHT="550" WIDTH="600">
    <xsl:attribute name="src">
              <xsl:value-of select="concat('/descriptions/productspecs/',SKU,'.html')"/>
    </xsl:attribute>
    </iframe>
    Replace "SKU", if necessary, with the appropriate value reference.

    Let me know if you have any other questions.

  4. #4
    omairkha is offline Member
    Join Date
    Aug 2011
    Posts
    89

    Default

    Hi, does this work on all html tags?

    I cannot get the following to work:

    Code:
    <a>Request Quote
         <xsl:attribute name="href">
              <xsl:value-of select="concat('quote.aspx?ID=',SKU)" />
         </xsl:attribute>
    </a>
    It keeps displaying the "Unable to Process Request" message.

    Thanks,

  5. #5
    omairkha is offline Member
    Join Date
    Aug 2011
    Posts
    89

    Default

    ok nm, got it to work...

    the xsl tag needs to immediately follow the html tag like so...

    Code:
    <a>
         <xsl:attribute name="href">
              <xsl:value-of select="concat('quote.aspx?ID=',SKU)" />
         </xsl:attribute>Request Quote
    </a>

  6. #6
    macecase is offline Member
    Join Date
    Feb 2011
    Posts
    44

    Default How to check to see if file exists

    So, with this calling the iframe file, how do I check and handle it if it doesn't exist?

    I'd like to check and see if that file exists that I'm trying to iframe... If not, do something else.... Maybe show another iframe file (standard, generic "does not exist") or something.

    Thanks!

  7. #7
    DotNetDevelopments is offline Senior Member
    Join Date
    Jul 2008
    Location
    Harlow / Essex / UK
    Posts
    619

    Default

    Code:
    <xsl:choose>
    <xsl:when test="aspdnsf:FileExists(concat('/descriptions/productspecs/', SKU, '.html')) = 'true'">
    <!-- It works! show the iframe here -->
    </xsl:when>
    <xsl:otherwise>
    <!-- not found! show a default something here -->
    </xsl:otherwise>
    </xsl:choose>
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience