Announcement

Collapse
No announcement yet.

Read_Product for meta fields

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

    Read_Product for meta fields

    Is there a way to do something like this but for the meta fields instead of the custom fields?

    Code:
    <mvt:item name="customfields" param="Read_Product_ID(l.settings:product:id, 'notes', l.settings:product:notes)" />
    I need to "read" what might be in this field l.settings:product:metafield:robots
    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

    #2
    Meta-tags are controlled by a module that comes standard with all stores. There's a version in the LSK named mmlsk-cmp-mv-prodctgy-meta.mv. A quick look at the source code suggests that, Yes, you can write template code to read the values, but it might take two or three mvt:do tags to do it; it's not as simple as custom fields.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      There is a code sample on Miva Docs:

      https://docs.miva.com/code-samples/l...ct-meta-fields


      Code:
      
      <mvt:foreach iterator="meta_item" array="product:meta_items">
          <mvt:if expr="l.settings:meta_item:name EQ 'keywords'">
              <mvt:assign name="l.settings:product:meta_keywords" value="l.settings:meta_item:value" />
          <mvt:elseif expr="l.settings:meta_item:name EQ 'description'">
              <mvt:assign name="l.settings:product:meta_description" value="l.settings:meta_item:value" />
          <mvt:elseif expr="l.settings:meta_item:name EQ 'robots'">
              <mvt:assign name="l.settings:product:meta_robots" value="l.settings:meta_item:value" />
          </mvt:if>
      </mvt:foreach>
      Or can you assign the META:robots on the product page from the product:display tab?
      http://www.alphabetsigns.com/

      Comment


        #4
        Originally posted by alphabet View Post
        There is a code sample on Miva Docs:

        https://docs.miva.com/code-samples/l...ct-meta-fields


        Code:
        
        <mvt:foreach iterator="meta_item" array="product:meta_items">
        <mvt:if expr="l.settings:meta_item:name EQ 'keywords'">
        <mvt:assign name="l.settings:product:meta_keywords" value="l.settings:meta_item:value" />
        <mvt:elseif expr="l.settings:meta_item:name EQ 'description'">
        <mvt:assign name="l.settings:product:meta_description" value="l.settings:meta_item:value" />
        <mvt:elseif expr="l.settings:meta_item:name EQ 'robots'">
        <mvt:assign name="l.settings:product:meta_robots" value="l.settings:meta_item:value" />
        </mvt:if>
        </mvt:foreach>
        Or can you assign the META:robots on the product page from the product:display tab?
        I need this to create a conditional link to the product based on robots index.follow. It's "complicated" because it's part of the code to display products from sub-sub- categories on to a category page.

        Thanks!

        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


          #5
          I have a most ignorant follow-up question for this. If "customfields" is the mvt:item name for the Product Read to find the custom field "notes", what would the mvt:item name be to find the metafield robots?
          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


            #6
            Have you checked if
            &mvt:product:metafield:robots;
            (or whatever the actual code name is for your robots meta data is (check in Global Settings | Meta Data Settings under 'name')?

            If not, you could try running

            <mvt:do file="g.Module_Library_DB" name="l.success" value="Product_Load_ID(id, product var)" />

            and see if that has the variable loaded in.
            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


              #7
              It should be noted that I'm trying to integrate this into the sub-sub-category template that pulls products into it (from sub-sub-categories).

              To answer Bruce's question - yes.
              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


                #8
                Originally posted by lesliekirk View Post
                To answer Bruce's question - yes.
                to both? (there where two questions)
                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


                  #9
                  Originally posted by Bruce - PhosphorMedia View Post

                  to both? (there where two questions)
                  I saw one question and one suggestion. It looked like if I had answer no, then try what you suggested. Sort of an if not then type statement. What was the second question I missed?

                  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


                    #10
                    ok, fair enough...did you try the suggestion and what was the result? :)
                    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


                      #11
                      Originally posted by Bruce - PhosphorMedia View Post
                      ok, fair enough...did you try the suggestion and what was the result? :)
                      I would need the exact "do" statement for what is needed. Hence the reason I posted. If I knew what statements to use for this situation, I would not have started this thread...
                      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


                        #12
                        Maybe I can save you the trouble. The library function Product_Load_ID only reads from the store's Products table. It doesn't retrieve data about meta-tags.
                        Kent Multer
                        Magic Metal Productions
                        http://TheMagicM.com
                        * Web developer/designer
                        * E-commerce and Miva
                        * Author, The Official Miva Web Scripting Book -- available on-line:
                        http://www.amazon.com/exec/obidos/IS...icmetalproducA

                        Comment


                          #13
                          Originally posted by Kent Multer View Post
                          Maybe I can save you the trouble. The library function Product_Load_ID only reads from the store's Products table. It doesn't retrieve data about meta-tags.
                          Thanks, Kent, like I said, I got lazy and created a Product Custom Field to do what I needed ... sigh.
                          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