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

Thread: Invocation Skin Token not available in MultiStore

  1. #1
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default Invocation Skin Token not available in MultiStore

    We used the Invocation skin token in ML8, looks like it was dropped for v9? Is that true or am I missing something. Is there an alternative?

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

    Default AspDotNetStorefront V9 Skin Tokens


  3. #3
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default

    Quote Originally Posted by ROBB View Post
    Thanks Rob, already read that. Invocation is not in there.

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

    Default Invocation

    It appears that the PAGEINFO token will be your closest bet.

    <%$ Tokens:PAGEINFO %> - Outputs the full page info (invocation, currency, locale, etc). This is only viewable by viewing the page source, does not display.

    Will that do the trick?

  5. #5
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default

    Quote Originally Posted by ROBB View Post
    It appears that the PAGEINFO token will be your closest bet.

    <%$ Tokens:PAGEINFO %> - Outputs the full page info (invocation, currency, locale, etc). This is only viewable by viewing the page source, does not display.

    Will that do the trick?
    Nah, that won't work either. I'm using Invocation to generate a rel canonical tag so I need the bare URL.

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

    Default

    In that case you could try adding adding the Literal to the master page. Then setting the value of the Literal in the masterpagebase codebehind. The value would be HttpContext.Current.Server.HtmlEncode(CommonLogic. PageInvocation())).

  7. #7
    BFG 9000 is offline Senior Member
    Join Date
    Oct 2006
    Location
    South UK
    Posts
    882

    Default

    Quote Originally Posted by jnichols View Post
    Nah, that won't work either. I'm using Invocation to generate a rel canonical tag so I need the bare URL.
    It's a really bad idea to use Invocation to generate a rel canonical tag - & it completely defeats the purpose of rel canonical...


    As an example - all 3 of these links take you to exactly the same page, but only the first one is 'correct' :-

    http://www.3mselect.co.uk/c-247-comm...-products.aspx
    http://sap213.channeladvisor.com/c-2...-products.aspx
    http://68.171.165.3/c-247-command-strip-products.aspx

    If you take a look in the source code of any of them - you'll see the following rel canonical tag :-

    C#/VB.NET Code:
    <link rel="canonical" href="http://www.3mselect.co.uk/c-247-command-strip-products.aspx" /> 



    TTFN

    BFG

  8. #8
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default

    Quote Originally Posted by BFG 9000 View Post
    It's a really bad idea to use Invocation to generate a rel canonical tag - & it completely defeats the purpose of rel canonical...


    As an example - all 3 of these links take you to exactly the same page, but only the first one is 'correct' :-

    http://www.3mselect.co.uk/c-247-comm...-products.aspx
    http://sap213.channeladvisor.com/c-2...-products.aspx
    http://68.171.165.3/c-247-command-strip-products.aspx

    If you take a look in the source code of any of them - you'll see the following rel canonical tag :-

    C#/VB.NET Code:
    <link rel="canonical" href="http://www.3mselect.co.uk/c-247-command-strip-products.aspx" /> 



    TTFN

    BFG
    Do you have an alternative solution?

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

    Default Alternate solution

    What exactly are you trying to achieve (the overall picture)?

  10. #10
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default

    Quote Originally Posted by ROBB View Post
    What exactly are you trying to achieve (the overall picture)?
    I would like to generate a rel canonical tag on my category pages using this URL:

    http://www.domain.com/s-1-category.aspx

    This tag would also appear on URLs below so they are not indexed:

    http://www.domain.com/s-1-category.aspx?pagenum=2
    http://www.domain.com/s-1-category.aspx?pagenum=3

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

    Default Canonical LinkTag

    Here is how I would approach it.

    1. Create XmlPackage reference in the head section of your template.

    Example:
    Code:
         <asp:Literal ID="ltrCanonicalLink" runat="server" Text='<%$ Tokens:XMLPACKAGE, CanonicalLink.xml.config %>'></asp:Literal>
    2. Create XmlPackage that will create the Canonical link tag

    Example:

    Code:
          <xsl:template match="/">
            <link rel="canonical">
              <xsl:attribute name="href">
                <xsl:value-of select="concat(/root/System/StoreUrl,/root/System/PageName)"></xsl:value-of>
              </xsl:attribute>
            </link>
          </xsl:template>

    Does that work for you?

  12. #12
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default

    Quote Originally Posted by ROBB View Post
    Here is how I would approach it.

    1. Create XmlPackage reference in the head section of your template.

    Example:
    Code:
         <asp:Literal ID="ltrCanonicalLink" runat="server" Text='<%$ Tokens:XMLPACKAGE, CanonicalLink.xml.config %>'></asp:Literal>
    2. Create XmlPackage that will create the Canonical link tag

    Example:

    Code:
          <xsl:template match="/">
            <link rel="canonical">
              <xsl:attribute name="href">
                <xsl:value-of select="concat(/root/System/StoreUrl,/root/System/PageName)"></xsl:value-of>
              </xsl:attribute>
            </link>
          </xsl:template>

    Does that work for you?
    Thanks for sharing this but it didn't work for me - broke my site. (8.0.0.0)

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

    Default Version 8

    Yes, that xml package reference works for version 9.

    Use the following for 8:

    (!XmlPackage Name="CanonicalLink.xml.config"!)

  14. #14
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default

    Quote Originally Posted by ROBB View Post
    Yes, that xml package reference works for version 9.

    Use the following for 8:

    (!XmlPackage Name="CanonicalLink.xml.config"!)
    No, this doesn't work, either. The URL generated in the link is the actual template rather than the full query.

    For example, for a category page it displays:
    http://www.domain.com/showsection.aspx

    Instead of:
    http://www.domain.com/s-1-category.aspx

    -JN

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

    Default Use RequestedPage Instead

    Use RequestedPage instead.

    Code:
    <xsl:template match="/">
            <link rel="canonical">
              <xsl:attribute name="href">
                <xsl:value-of select="concat(/root/System/StoreUrl,/root/System/RequestedPage)"></xsl:value-of>
              </xsl:attribute>
            </link>
          </xsl:template>
    I have tested this, and it works.

  16. #16
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default

    Quote Originally Posted by ROBB View Post
    Use RequestedPage instead.

    Code:
    <xsl:template match="/">
            <link rel="canonical">
              <xsl:attribute name="href">
                <xsl:value-of select="concat(/root/System/StoreUrl,/root/System/RequestedPage)"></xsl:value-of>
              </xsl:attribute>
            </link>
          </xsl:template>
    I have tested this, and it works.
    I will try it again - when I create the xml.config file what other code besides what you've written is required in that file? I've never created one of these from scratch.

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

    Default Sample XML Package

    The complete XML Package would look like so:

    Code:
    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="Entity Grid" debug="false" includeentityhelper="true">
    
        <PackageTransform>
        
            <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                            xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
              <xsl:output method="html" omit-xml-declaration="yes" />
    
            
                    <xsl:template match="/">
                      <link rel="canonical">
                        <xsl:attribute name="href">
                          <xsl:value-of select="concat(/root/System/StoreUrl,/root/System/RequestedPage)"></xsl:value-of>
                        </xsl:attribute>
                      </link>
                    </xsl:template>
    
            </xsl:stylesheet>
        </PackageTransform>
    </package>

  18. #18
    jnichols is offline Junior Member
    Join Date
    Mar 2009
    Posts
    19

    Default

    Thanks ROBB, that worked for both the 8.0.0.0 site and was able to use it on a v9 site as well!!

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

    Thumbs up It Works

    No problem!

    BTW: In regards to the XML Package, entity helpers are not needed - you can set includeentityhelper to false.
    Last edited by ROBB; 08-30-2011 at 09:21 AM.

  20. #20
    ebijs is offline Junior Member
    Join Date
    May 2010
    Posts
    26

    Default

    Nice code! I have an issue. Somehow the generated canonical url is always a https

    Something like:

    <link rel="canonical" href="https://www.domain.com/c-106-portable-radio-en-cd-spelers.aspx">

    Any ideas? I run V92

    Ebijs

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

    Default

    One of our clients is on version 9 and found all the URL's where in https as well so we changed it to this.

    Code:
    <link rel="canonical" href="http://www.mydomain.com{/root/System/FullPageName}"></link>
    Simply hardcode the first section.

    Or you could always do a replace like so
    Code:
    <link rel="canonical">
      <xsl:attribute name="href">
        <xsl:value-of select="concat(aspdnsf:StrReplace(/root/System/StoreUrl,'https:','http:'),/root/System/RequestedPage)"></xsl:value-of>
      </xsl:attribute>
    </link>
    Either or depending on your setup.
    Last edited by DotNetDevelopments; 10-25-2011 at 02:36 AM. Reason: Corrected code.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  22. #22
    ebijs is offline Junior Member
    Join Date
    May 2010
    Posts
    26

    Default

    Hi,

    That was quick! Thanks.

    It ran into the following error. Can you please assist?

    Sijbe.

    Expected token ')', found ':'.
    ...ot/System/StoreUrl,'https:',http -->:<-- '),/root/System/RequestedPage)

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Xml.Xsl.XslLoadException: Expected token ')', found ':'.
    ...ot/System/StoreUrl,'https:',http -->:<-- '),/root/System/RequestedPage)

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

    Default

    Whoops!

    Code:
    <link rel="canonical">
      <xsl:attribute name="href">
        <xsl:value-of select="concat(aspdnsf:StrReplace(/root/System/StoreUrl,'https:','http:'),/root/System/RequestedPage)"></xsl:value-of>
      </xsl:attribute>
    </link>
    Lets pretend that didn't happen I was missing a '.
    =====
    Version (Code/DB): AspDotNetStorefront MSx 9.1.0.1/9.1.0.0
    Execution Mode: 64 Bit
    Dot Net Developments - E-commerce By Experience

  24. #24
    ebijs is offline Junior Member
    Join Date
    May 2010
    Posts
    26

    Default

    That did the trick. Thnkx!