Announcement

Collapse
No announcement yet.

Canonical Category Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Re: Canonical Category Code

    Am I missing something? There's a standard SMT field called "Canonical Category Code." Yet there's no way to retrieve it without a third party module, and only then through a programming rigmarole? Why? Please tell me I'm missing something.

    Kevin Garrett

    Comment


      #17
      Re: Canonical Category Code

      Hey Kevin -


      Unfortunately only the canonical category id is available in the template language. I'll work with development so the code is also available. Right now, the only way to get the code is to look it up using toolkit.


      The reason it is not there now is the canonical category code was designed to be purely for Miva breadcrumb functionality. It was not intended to be used as the SEO canonical meta tag, even though they share the same name. The Miva Canonical Category code was designed to be used from pages like search or a direct link to a product (without a category code). If a canonical category code was defined for a product this category is used to populate the category tree and breadcrumb data.


      Here is the order of operations for Miva on determining which breadcrumb path to use:


      1. Use Category_Code parameter defined in url, if that does not exist...
      2. Look at the page referrer and try and determine category visitor came from
      3. Look up products canonical category if it exists


      When Miva built in the "Smart Breadcrumbs" the canonical category code was one of the components to making them "smart" or the ability to figure out which category code to use. This allowed you to setup your URL structure without having the category code in the URL structure and Miva just knows what category you came from.


      However, I can see the use case where you would also want to use Miva's Canonical Category to populate the canonical meta tag which is why having the code available in the template language would be useful.
      Brennan Heyde
      VP Product
      Miva, Inc.
      [email protected]
      https://www.miva.com

      Comment


        #18
        Re: Canonical Category Code

        Indeed, it would be useful and only expected that a prominently displayed field would be accessible to SMT coding. I revisited this thread because I had another need (besides canonical meta tag) for the canonical category for a product. I'm doing a rearchitecture of my store in a way that I'm sure was not envisioned by Miva's coders. The fewer custom fields and toolkit calls the better.

        Kevin Garrett

        Comment


          #19
          Re: Canonical Category Code

          I spoke with development today about this and they filed a bug on it. It should make it into the Version 9 release.
          Brennan Heyde
          VP Product
          Miva, Inc.
          [email protected]
          https://www.miva.com

          Comment


            #20
            Re: Canonical Category Code

            Has the Canonical Category Code become available without using the Toolkit?
            Leslie Kirk
            Miva Certified Developer
            Miva Merchant Specialist since 1997
            Previously of Webs Your Way
            (aka Leslie Nord leslienord)

            Email me: [email protected]
            www.lesliekirk.com

            Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

            Comment


              #21
              Re: Canonical Category Code

              Originally posted by Brennan View Post
              Dan is correct, only the canonical category id is available in the template code:

              Code:
              &mvt:product:cancat_id;
              and
              l.settings:product:cancat_id
              You could then use toolkit's catinfo function to look up the code:

              Code:
              <mvt:item name="toolkit" param="catinfo|catvar||l.all_settings:product:cancat_id" />
              <mvt:item name="toolkit" param="vassign|cat_code|g.catvar:code" />
              &mvt:global:cat_code;

              I used this to generate the Canonical Category Code - it was working when I tested it, now it's not:

              Code:
               <mvt:if expr="NOT ISNULL l.all_settings:product:cancat_id">
                          <mvt:item name="toolkit" param="catinfo|catvar||l.all_settings:product:cancat_id" />
                          <mvt:item name="toolkit" param="vassign|cat_code|g.catvar:code" />
                          <h2 class="text-center"><a href="http://&mvt:global:domain:name;/&mvt:global:cat_code;/&mvta:product:code;.html">&mvt:product:name;</a></h2>
                          <mvt:else>
                          <h2 class="text-center"><a href="http://&mvt:global:domain:name;/&mvta:category:code;/&mvta:product:code;.html">&mvt:product:name;</a></h2>
                        </mvt:if>
              Why would it work, then quit?

              Leslie
              Leslie Kirk
              Miva Certified Developer
              Miva Merchant Specialist since 1997
              Previously of Webs Your Way
              (aka Leslie Nord leslienord)

              Email me: [email protected]
              www.lesliekirk.com

              Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

              Comment


                #22
                Re: Canonical Category Code

                Hi Leslie -

                I just checked and we still have an open bug for this. I'll try to get it in the next update.

                Nothing should have changed with the code above. Is toolkit still active on the page?
                Brennan Heyde
                VP Product
                Miva, Inc.
                [email protected]
                https://www.miva.com

                Comment


                  #23
                  Re: Canonical Category Code

                  It seems to work when I remove the conditional to test for the Canonical Category Code. Not sure why the conditional stopped working.
                  Leslie Kirk
                  Miva Certified Developer
                  Miva Merchant Specialist since 1997
                  Previously of Webs Your Way
                  (aka Leslie Nord leslienord)

                  Email me: [email protected]
                  www.lesliekirk.com

                  Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                  Comment


                    #24
                    Re: Canonical Category Code

                    Originally posted by lesliekirk View Post
                    It seems to work when I remove the conditional to test for the Canonical Category Code. Not sure why the conditional stopped working.
                    Were you ever able to figure this out Leslie? I can get the Category ID to print but not convert/display the Category Code.

                    Thanks,
                    Chris

                    Comment


                      #25
                      Re: Canonical Category Code

                      Originally posted by chrisjumpusa View Post
                      Were you ever able to figure this out Leslie? I can get the Category ID to print but not convert/display the Category Code.

                      Thanks,
                      Chris
                      Chris, if you're using engine 5.21 or greater you can do this

                      Code:
                      <mvt:do name="l.return" file="g.Module_Library_DB" value="Category_Load_ID( l.settings:product:cancat_id, l.category )" />
                      <mvt:eval expr="l.category:code" />
                      David Carver
                      Miva, Inc. | Software Developer

                      Comment


                        #26
                        Re: Canonical Category Code

                        This issue has been fixed and will be released in 9.4
                        David Carver
                        Miva, Inc. | Software Developer

                        Comment


                          #27
                          Re: Canonical Category Code

                          Originally posted by dcarver View Post
                          This issue has been fixed and will be released in 9.4
                          Hi David,

                          So now what is the way to pull in the correct category link on Alternate Page Displays?

                          Code:
                          <link rel="canonical" href="&mvte:category:link;" />
                          It seems to be pulling in the Page code instead of the Category Code.

                          Thanks,
                          Leslie
                          Last edited by lesliekirk; 09-29-15, 12:58 PM.
                          Leslie Kirk
                          Miva Certified Developer
                          Miva Merchant Specialist since 1997
                          Previously of Webs Your Way
                          (aka Leslie Nord leslienord)

                          Email me: [email protected]
                          www.lesliekirk.com

                          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

                          Comment

                          Working...
                          X