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 6 of 6

Thread: Category image Alt Tags

  1. #1
    MadStamper is offline Member
    Join Date
    Jan 2007
    Location
    Evansville, IN
    Posts
    57

    Default Category image Alt Tags

    I'm trying to display the category image. I'm using entity.grid.xml.config as a starting point.

    The 9.3 off-the-shelf-version calls aspdnsf:EntityPageHeaderDescription($EntityName, $EntityID) which, unfortunately, doesn't render alt tags or image sizes. So, I'm left to recreate that functionality which actually gives far more control of how I want the entity page header to be displayed.

    I've recreated it all just fine except for the one detail of the category image's alt text. For my db record in question, I have confirmed through MS SQL Server Management Studio Express that SEAltText does indeed contain data ( = "Indoor Signs - Point of Purchase - POP") so your first question is answered.

    Here are all of the various ways I've tried in the XMLPackage to retrieve the data I want:
    C#/VB.NET Code:
    <xsl:param name="AltText" select="$CurrentEntity/SEAltText" />
    <
    xsl:param name="AltText" select="aspdnsf:GetMLValue(SEAltText)" />
    <
    xsl:param name="AltText" select="/root/EntityHelpers/*[name()=$EntityName]/descendant::Entity[EntityID=$EntityID]/SEAltText" />
    <
    xsl:param name="AltText" select="/root/EntityHelpers/Category/descendant::Entity[EntityID=52]/SEAltText" /> 
    Each of those commands returns an empty string. So, how do I get SEAltText for a Category?

    Incidentally, using 'Name' in each of the above instead of 'SEAltText' does give me the expected information except for "aspdnsf:GetMLValue(Name)" which makes me think that maybe GetMLValue is for products and not entities since it returns the alt text of the products in my category just fine.

    Anyhow, does anyone have any suggestions for how to get the SEAltText for a category image to show?
    -----------------------------------------------------
    MadStamper
    9.3 VB - http://www.SignsOverAmerica.com

  2. #2
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Hi,

    Unfortunately, in their wisdom, the developers of ASPDNSF don't bring back all database fields in the EntityHelpers result set. SEAltText is one of these missing fields which is why you see nothing. (If you run your XML Package in debug mode, you'll be able to see the data that is returned).

    I can only imagine that the developers did this to try and reduce the amount of data being generated by the EntityHelpers package.

    So, you need another way to do this. Without writing a special XSLTExtension, one solution is to add another SQL Query at the top of your XML Package:

    Code:
     <query name="CategoryData" rowElementName="Category">
        <sql>
          <![CDATA[
    		select * from Category where categoryID = @CatID
    		]]>
        </sql>
        <queryparam paramname="@CatID" paramtype="runtime" requestparamname="CatID" sqlDataType="int" defvalue="0"  validationpattern="" />
      </query>
    ...now, you can retrieve the SEAltText value (and anything else related to this category) like this...

    Code:
    <xsl:value-of select="/root/CategoryData/Category/SEAltText"/>
    Adam

  3. #3
    MadStamper is offline Member
    Join Date
    Jan 2007
    Location
    Evansville, IN
    Posts
    57

    Thumbs up Thank you!

    Thanks for the code, it works perfectly!

    That's very sad. You're probably right, they had to draw a line somewhere.

    I have access to the code but I was hoping to avoid modifying it for something so simple. Do you have any thoughts on the overhead cost of adding another sql query? Is it really that big of a deal or should I modify the code?
    Last edited by MadStamper; 07-23-2012 at 01:57 PM. Reason: mispelling fixed.
    -----------------------------------------------------
    MadStamper
    9.3 VB - http://www.SignsOverAmerica.com

  4. #4
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    I would have said that the overhead of bringing back one row of the Category table is minimal. If you like, rather than a select *, just bring back the fields you need.

  5. #5
    MadStamper is offline Member
    Join Date
    Jan 2007
    Location
    Evansville, IN
    Posts
    57

    Default

    Sounds good. I'll just grab that one field. Quick and easy solution to implement.

    Thanks for your help and insight (will have to remember to look at the debug output too).
    -----------------------------------------------------
    MadStamper
    9.3 VB - http://www.SignsOverAmerica.com

  6. #6
    mmcgeachy is offline Senior Member
    Join Date
    Sep 2008
    Posts
    174

    Default

    If you don't want to have the extra query and want to make use of the EntityHelper, you could always just add the SEAltText field. Adding the the field is done by altering the aspdnsf_EntityMgr stored procedure. Adding one column to isn't going to add that much more memory. Especially if you only add the field to the category entity.

    *edit* just did some double checking you may also need to edit EntityMgr.xml.config. This file is in the EntityHelper folder to add
    C#/VB.NET Code:
    <xsl:copy-of select="SEAltText"/> 
    to the copy tag. If you want to avoid having blank SEAltText tags add a if statement like the code like below
    C#/VB.NET Code:
    <xsl:if test="SEAltText!=''">
        <
    xsl:copy-of select="SEAltText"/>
    </
    xsl:if> 
    Last edited by mmcgeachy; 07-24-2012 at 02:55 PM.