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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lesliekirk
    Super Moderator











    • Aug 2008
    • 9289

    #16
    Originally posted by lesliekirk View Post

    THANK YOU, Bruce! That's what was needed. This needs to be one of those snippets that get put someplace easy to find!
    One more question - what if the custom field is empty? I noticed that this creates if there is no custom field entry

    /p//product_code.html
    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

      #17
      that's what the IF is for. not sure what you want to do/use if its not there, but the <mvt:else> should allow you to use something else.
      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

        #18
        Originally posted by Bruce - PhosphorMedia View Post
        that's what the IF is for. not sure what you want to do/use if its not there, but the <mvt:else> should allow you to use something else.
        That's what I know, but I've got to figure out how to place that slash within the conditional.
        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

          #19
          just put inside both
          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

            #20
            Originally posted by Bruce - PhosphorMedia View Post
            just put inside both
            I had thought about that - but I still think the "red" needs to be triggered. If you happen to miss multiple fields the "required" popup does fade away. I've got a couple of javascript / jquery scripts to try.

            As for making it easy - it would be great if when creating a custom customer field there could be a checkbox (like for facets) that could be checked if the field needs to be required.

            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

            • delcorsets
              Mighty Mivite





              • Mar 2006
              • 620

              #21
              lesliekirk I've been following this thread and it seems you've got it working? I've been experimenting on my dev site for my own use case. I'm trying to include the slugified version of a custom field as part of the URI formula , followed by the slugified product name - I still can't seem to get it working. My goal is to have the URI shown in the format "designer-name-product-name.html" where the designer-name portion is the slugified version of a product custom field.

              My original Product URI template is:

              Code:
              /<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( l.settings:product:slugified_name )" /></mvt:if>.html
              I modified the code that Bruce - PhosphorMedia contributed and came up with the following code to test:

              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,designer', l.settings:custom:designer )" />
              /<mvt:if expr="NOT ISNULL l.settings:product:slugified_page_title"><mvt:eval expr="tolower( l.settings:product:slugified_page_title )" /><mvt:elseif expr="NOT ISNULL(l.settings:custom:designer)"><mvt:eval expr="tolower(l.settings:custom:designer)" />-<mvt:eval expr="tolower( l.settings:product:slugified_name )" /><mvt:else><mvt:eval expr="tolower( l.settings:product:slugified_name )" /></mvt:if>.html
              The above did not work so I simplified just to see if I good get the URI to pull the content from the custom field:
              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,’designer', l.settings:custom:designer )" />
              /<mvt:if expr="NOT ISNULL(l.settings:custom:designer)"><mvt:eval expr="tolower(l.settings:custom:designer)" /><mvt:else><mvt:eval expr="tolower( l.settings:product:slugified_name )" /></mvt:if>.html
              Are you plugging the code into the Product URI Template field and then creating the product and entering the product custom field content at the same time to achieve your results with custom field content included in the URI's?
              Psydde Delicious
              Delicious Boutique & Corseterie
              Philadelphia, PA
              www.DeliciousBoutique.com
              www.DeliciousCorsets.com

              Comment

              • lesliekirk
                Super Moderator











                • Aug 2008
                • 9289

                #22
                delcorsets Hey Psydde - the best I can offer you is exactly what I entered into the URI Management > Product URIs > Product URI template

                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
                Yes, the product is created and the product custom field content is added at the same time but I have advised the store owner to check the product URI to make sure the canonical is what it needs to be.
                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

                • delcorsets
                  Mighty Mivite





                  • Mar 2006
                  • 620

                  #23
                  thanks Leslie.. I'll keep testing. :)
                  Psydde Delicious
                  Delicious Boutique & Corseterie
                  Philadelphia, PA
                  www.DeliciousBoutique.com
                  www.DeliciousCorsets.com

                  Comment

                  Working...
                  X