Is it possible to use custom product fields in the URI Management

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cnelson
    Mini Mivite

    • Aug 2011
    • 45

    #1

    Is it possible to use custom product fields in the URI Management

    Id like the add a manufacturer part code to the product URL. It is inside of a custom product field. Does URI management support custom fields when defining the url pattern?
    Calvin Nelson
    Director of Web Development
    2C Development Group
  • Brennan
    Super Moderator









    • Jun 2009
    • 3481

    #2
    Re: Is it possible to use custom product fields in the URI Management

    Not in the URI Template but you can use a page to generate all URIs with the custom fields and then import them. Or use Excel to build them an import them.
    Brennan Heyde
    VP Product
    Miva, Inc.
    [email protected]
    https://www.miva.com

    Comment

    • cnelson
      Mini Mivite

      • Aug 2011
      • 45

      #3
      Re: Is it possible to use custom product fields in the URI Management

      Originally posted by Brennan View Post
      Not in the URI Template but you can use a page to generate all URIs with the custom fields and then import them. Or use Excel to build them an import them.
      That is exactly what I needed! Duh! Didn't even think about doing that!
      Calvin Nelson
      Director of Web Development
      2C Development Group

      Comment

      • swiftmv
        Mini Mivite

        • Apr 2006
        • 98

        #4
        Hello,

        Originally posted by Brennan View Post
        Re: Is it possible to use custom product fields in the URI Management

        Not in the URI Template but you can use a page to generate all URIs with the custom fields and then import them. Or use Excel to build them an import them.

        Further to this:

        1. In this document:

        http://docs.miva.com/how-to-guides/h...uri-management
        (in or near SECTION 8)

        It would help if it were noted that custom fields cannot (currently) be used as part of URI Management templates. (Life would be easier if they did.)


        2. Is it possible to "slugify" a custom product field within that page template described in Brennan's post? (I'm needing to slugify Manunfacturers' names, particularly those with more than one word for a company name.)


        cheers,
        Michael

        Comment

        • chris.j.rodrig
          Mivite Lite

          • Jan 2015
          • 2

          #5
          Hello,

          CustomFields actually can be used when generating URLs with URI management. The use of mvt:do will assist with that. Here is the code I used to insert a customfield when generating product URLs

          <mvt:do name="l.module_loaded" file="g.Module_Library_DB" value="Module_Load_Code('customfields', l.module )" />

          <mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.module, l.param, l.settings:product:code,'CustomField_Code', g.CustomField_Code )" />

          /product/<mvt:if expr="NOT ISNULL l.settings:product:slugified_page_title"><mvt:eval expr="tolower( l.settings:product:slugified_page_title $ '-' $ g.CustomField_Code)" /><mvt:else><mvt:eval expr="tolower( l.settings:product:slugified_name $ '-' $ g.CustomField_Code )" /></mvt:if>.html

          You can place this directly (without line breaks or spaces) into the URI template text field in URI Management. Replace 'CustomField_Code' with your custom field.

          Comment

          • delcorsets
            Mighty Mivite





            • Mar 2006
            • 620

            #6
            Originally posted by chris.j.rodrig View Post
            Hello,

            CustomFields actually can be used when generating URLs with URI management. The use of mvt:do will assist with that. Here is the code I used to insert a customfield when generating product URLs

            <mvt:do name="l.module_loaded" file="g.Module_Library_DB" value="Module_Load_Code('customfields', l.module )" />

            <mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.module, l.param, l.settings:product:code,'CustomField_Code', g.CustomField_Code )" />

            /product/<mvt:if expr="NOT ISNULL l.settings:product:slugified_page_title"><mvt:eval expr="tolower( l.settings:product:slugified_page_title $ '-' $ g.CustomField_Code)" /><mvt:else><mvt:eval expr="tolower( l.settings:product:slugified_name $ '-' $ g.CustomField_Code )" /></mvt:if>.html

            You can place this directly (without line breaks or spaces) into the URI template text field in URI Management. Replace 'CustomField_Code' with your custom field.
            I've tried getting this to work on my dev site, but no luck as of yet... I'm trying to get a slugified version of my "designer" custom field to preface the slugified product name. I've adapted the code mentioned above as follows:

            Code:
            [FONT=Helvetica]<mvt:do name="l.module_loaded" file="g.Module_Library_DB" value="Module_Load_Code('customfields', l.module )" />[/FONT]
            
            
            [FONT=Helvetica]<mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.module, l.param, l.settings:product:code,’'designer', g.designer )" />[/FONT]
            
            
            [FONT=Helvetica]/<mvt:if expr="NOT ISNULL l.settings:product:slugified_page_title"><mvt:eval expr="tolower( l.settings:product:slugified_page_title)" /><mvt:else><mvt:eval expr="tolower([FONT=Helvetica]g.designer [FONT=Helvetica]$ '-' $[/FONT][/FONT] l.settings:product:slugified_name)" /></mvt:if>.html[/FONT]
            I also tried using the original code exactly as provided in the above post (but with my own custom field code replacing the 'CustomField_Code') but no luck with that either.

            I'm sort of taking stabs in the dark as I'm not really familiar with the syntax.. just trying to follow the directions that Chris provided above and hopefully get it working through trial and error. Has anyone else tried or succeeded with using slugified custom fields in their URI templates?
            Last edited by delcorsets; 05-12-18, 04:32 AM.
            Psydde Delicious
            Delicious Boutique & Corseterie
            Philadelphia, PA
            www.DeliciousBoutique.com
            www.DeliciousCorsets.com

            Comment

            • lesliekirk
              Super Moderator











              • Aug 2008
              • 9289

              #7
              Originally posted by delcorsets View Post

              I've tried getting this to work on my dev site, but no luck as of yet... I'm trying to get a slugified version of my "designer" custom field to preface the slugified product name. I've adapted the code mentioned above as follows:

              Code:
              [FONT=Helvetica]<mvt:do name="l.module_loaded" file="g.Module_Library_DB" value="Module_Load_Code('customfields', l.module )" />[/FONT]
              
              
              [FONT=Helvetica]<mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.module, l.param, l.settings:product:code,’'designer', g.designer )" />[/FONT]
              
              
              [FONT=Helvetica]/<mvt:if expr="NOT ISNULL l.settings:product:slugified_page_title"><mvt:eval expr="tolower( l.settings:product:slugified_page_title)" /><mvt:else><mvt:eval expr="tolower([FONT=Helvetica]g.designer [FONT=Helvetica]$ '-' $[/FONT][/FONT] l.settings:product:slugified_name)" /></mvt:if>.html[/FONT]
              I also tried using the original code exactly as provided in the above post (but with my own custom field code replacing the 'CustomField_Code') but no luck with that either.

              I'm sort of taking stabs in the dark as I'm not really familiar with the syntax.. just trying to follow the directions that Chris provided above and hopefully get it working through trial and error. Has anyone else tried or succeeded with using slugified custom fields in their URI templates?
              It's an old post, I know, but I need to do the same thing.

              The old MMUI store used this syntax for it's Product Links from the CTGY Page

              Code:
               <mvt:item name="customfields" param="Read_Product_Code(l.settings:product:code,'url_product_name', g.customProductName)" />
              
              https://&mvte:global:domain:name;/p/&mvt:global:customProductName;/&mvta:product:code;.html
              So has anyone got this to work?
              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: X | Facebook | Pinterest

              Comment

              • lesliekirk
                Super Moderator











                • Aug 2008
                • 9289

                #8
                Originally posted by chris.j.rodrig View Post
                Hello,

                CustomFields actually can be used when generating URLs with URI management. The use of mvt:do will assist with that. Here is the code I used to insert a customfield when generating product URLs

                <mvt:do name="l.module_loaded" file="g.Module_Library_DB" value="Module_Load_Code('customfields', l.module )" />

                <mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.module, l.param, l.settings:product:code,'CustomField_Code', g.CustomField_Code )" />

                /product/<mvt:if expr="NOT ISNULL l.settings:product:slugified_page_title"><mvt:eval expr="tolower( l.settings:product:slugified_page_title $ '-' $ g.CustomField_Code)" /><mvt:else><mvt:eval expr="tolower( l.settings:product:slugified_name $ '-' $ g.CustomField_Code )" /></mvt:if>.html

                You can place this directly (without line breaks or spaces) into the URI template text field in URI Management. Replace 'CustomField_Code' with your custom field.
                When I used this code, I got the Page Title in the link but no custom field at all. Closer inspection of the code it is telling it to add the slugified page title. I don't want the slugified page title, I want the Custom Field.
                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: X | Facebook | Pinterest

                Comment

                • Bruce - PhosphorMedia
                  Developer Partner











                  • Mar 2006
                  • 11256

                  #9
                  Not positive but:

                  <mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.module, l.param, l.settings:product:code,'CustomField_Code', g.CustomField_Code )" />

                  doesn't look right. should be

                  <mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.settings:product:code,' CustomField_Code', g.CustomField_Code )" />

                  and just change

                  l.settings:product:slugified_page_title

                  to

                  g.Custom_FieldCode

                  (though I'd change that variable in all places to something more specific like "g.custom:manufacture_name"



                  Bruce Golub
                  Phosphor Media - "Your Success is our Business"

                  Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                  phosphormedia.com

                  Comment

                  • lesliekirk
                    Super Moderator











                    • Aug 2008
                    • 9289

                    #10
                    Here is what I tried:

                    Code:
                    <mvt:do name="l.module_loaded" file="g.Module_Library_DB" value="Module_Load_Code('url_product_name', l.module )" /><mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.settings:product:code,'url_product_name', g.customProductName )" />/p/<mvt:if expr="NOT ISNULL l.settings:product:slugified_page_title"><mvt:eval expr="tolower(g.customProductName)" /><mvt:else><mvt:eval expr="tolower(g.customProductName)" /></mvt:if>/&mvt:product:code;.html
                    What I got was

                    /p//product_code.html

                    The custom field was not generated. Hopefully, I just did something wrong with the code.
                    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: X | Facebook | Pinterest

                    Comment

                    • Bruce - PhosphorMedia
                      Developer Partner











                      • Mar 2006
                      • 11256

                      #11
                      I don't think you need to look up the module info as this is a managed template (given that SMT code can be used). So, try this?

                      Code:
                      <mvt:item name="customfields" param="Read_Product_Code( g.product_code, 'custom_field_code', l.settings:custom:urlName)" />
                      /p/<mvt:if expr="NOT ISNULL(l.settings:custom:urlName)"><mvt:eval expr="tolower(l.settings:custom:urlName)" /><mvt:else><mvt:eval expr="tolower(l.settings:product:slugified_page_title)" /></mvt:if>/&mvt:product:code;.html
                      Bruce Golub
                      Phosphor Media - "Your Success is our Business"

                      Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                      phosphormedia.com

                      Comment

                      • lesliekirk
                        Super Moderator











                        • Aug 2008
                        • 9289

                        #12
                        Originally posted by Bruce - PhosphorMedia View Post
                        I don't think you need to look up the module info as this is a managed template (given that SMT code can be used). So, try this?

                        Code:
                        <mvt:item name="customfields" param="Read_Product_Code( g.product_code, 'custom_field_code', l.settings:custom:urlName)" />
                        /p/<mvt:if expr="NOT ISNULL(l.settings:custom:urlName)"><mvt:eval expr="tolower(l.settings:custom:urlName)" /><mvt:else><mvt:eval expr="tolower(l.settings:product:slugified_page_title)" /></mvt:if>/&mvt:product:code;.html
                        Thanks, I tried this

                        Code:
                        <mvt:item name="customfields" param="Read_Product_Code( g.product_code, 'url_product_name', l.settings:custom:urlName)" />
                        /p/<mvt:if expr="NOT ISNULL(l.settings:custom:urlName)"><mvt:eval expr="tolower(l.settings:custom:urlName)" /><mvt:else><mvt:eval expr="tolower(l.settings:product:slugified_page_title)" /></mvt:if>/&mvt:product:code;.html
                        but I get this error message:

                        Error compiling template: customfields is not in the list of valid items
                        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: X | Facebook | Pinterest

                        Comment

                        • Bruce - PhosphorMedia
                          Developer Partner











                          • Mar 2006
                          • 11256

                          #13
                          damn, that's why you need the module call...forgot that URI management is not attached to a page:

                          try

                          Code:
                          <mvt:do name="l.module_loaded" file="g.Module_Library_DB" value="Module_Load_Code('customfields', l.module )" />
                          <mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.module, l.param, l.settings:product:code,'url_product_name', l.settings:custom:urlName  )" />
                          /p/<mvt:if expr="NOT ISNULL(l.settings:custom:urlName)"><mvt:eval expr="tolower(l.settings:custom:urlName)" /><mvt:else><mvt:eval expr="tolower(l.settings:product:slugified_page_title)" /></mvt:if>/&mvt:product:code;.html
                          Bruce Golub
                          Phosphor Media - "Your Success is our Business"

                          Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                          phosphormedia.com

                          Comment

                          • lesliekirk
                            Super Moderator











                            • Aug 2008
                            • 9289

                            #14
                            Originally posted by Bruce - PhosphorMedia View Post
                            damn, that's why you need the module call...forgot that URI management is not attached to a page:

                            try

                            Code:
                            <mvt:do name="l.module_loaded" file="g.Module_Library_DB" value="Module_Load_Code('customfields', l.module )" />
                            <mvt:do name="l.result" file="g.Module_Root $ l.module:module" value="Read_Product_Code(l.module, l.param, l.settings:product:code,'url_product_name', l.settings:custom:urlName )" />
                            /p/<mvt:if expr="NOT ISNULL(l.settings:custom:urlName)"><mvt:eval expr="tolower(l.settings:custom:urlName)" /><mvt:else><mvt:eval expr="tolower(l.settings:product:slugified_page_title)" /></mvt:if>/&mvt:product:code;.html
                            THANK YOU, Bruce! That's what was needed. This needs to be one of those snippets that get put someplace easy to find!
                            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: X | Facebook | Pinterest

                            Comment

                            • Bruce - PhosphorMedia
                              Developer Partner











                              • Mar 2006
                              • 11256

                              #15
                              Google:

                              "miva merchant" "forums" using custom field in URI management

                              it's how i roll.
                              Bruce Golub
                              Phosphor Media - "Your Success is our Business"

                              Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
                              phosphormedia.com

                              Comment

                              Working...
                              X