Adding category to product URI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • c3idesign
    Mivite


    • Apr 2006
    • 198

    #1

    Adding category to product URI

    I've searched, but can find the answer. My current product URI is:

    /<mvt:if expr="NOT ISNULL l.settings:product:code"><mvt:eval expr="l.settings:product:code" /></mvt:if>/index.html

    I want to add the category to the URI, such as:

    /my-category/my-product/index.html

    How can I do this on the URI management page?
  • Brennan
    Super Moderator









    • Jun 2009
    • 3481

    #2
    Because products are usually part of multiple categories, we usually recommend that you import URIs like this so you can choose the category you want to include in the URI.

    If you wanted to try to automate it, you would need to load the list of categories the product is assigned then "pick" one, typically the first or last.

    You would need to use a function like this to load the assigned categories.

    https://docs.miva.com/code-samples/assigned-categories


    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    • Miss Kate
      Mivite

      • Aug 2006
      • 269

      #3
      To me that doesn't make sense but my luck lately stinks. Aren't you using a Storefront? The index.html is normally your Home page but your home page should be your Storefront page.



      Kathleen Steimle-Hermes
      , owner
      Miss Kate's Creations
      [email protected]
      www.misskatescreations.com


      Handcrafted fabric covered photo albums, frames, brag books and MORE


      Comment

      • c3idesign
        Mivite


        • Apr 2006
        • 198

        #4
        The store is not extremely large and products belong to only 1 category, except a couple featured products. Also they want to keep their existing url structure because their traffic is decent.

        So, it's not possible URI managment?

        I tried to this in the product URI template -

        /pc/<mvt:if expr="NOT ISNULL l.settings:category:code"><mvt:eval expr="l.settings:category:code" /></mvt:if>/<mvt:if expr="NOT ISNULL l.settings:product:code"><mvt:eval expr="l.settings:product:code" /></mvt:if>/index.html

        but the category was always empty. I assume you need to pull from products somehow.

        Comment

        • Miss Kate
          Mivite

          • Aug 2006
          • 269

          #5
          Originally posted by c3idesign View Post
          The store is not extremely large and products belong to only 1 category, except a couple featured products. Also they want to keep their existing url structure because their traffic is decent.

          So, it's not possible URI managment?

          I tried to this in the product URI template -

          /pc/<mvt:if expr="NOT ISNULL l.settings:category:code"><mvt:eval expr="l.settings:category:code" /></mvt:if>/<mvt:if expr="NOT ISNULL l.settings:product:code"><mvt:eval expr="l.settings:product:code" /></mvt:if>/index.html

          but the category was always empty. I assume you need to pull from products somehow.
          Follow the advise Brennan gave to you. If the routine he gave you works, then I would go ahead and use it rather than listening to me. It just seems like you need a storefront to me.



          Kathleen Steimle-Hermes
          , owner
          Miss Kate's Creations
          [email protected]
          www.misskatescreations.com


          Handcrafted fabric covered photo albums, frames, brag books and MORE


          Comment

          • c3idesign
            Mivite


            • Apr 2006
            • 198

            #6
            thanks!

            Comment

            Working...
            X