Announcement

Collapse
No announcement yet.

How do I Call Custom fields For Categories or Products?

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

    #16
    Re: How do I Call Custom fields For Categories or Products?

    I am using it on the Mobile Category Tree Page. How do I make sure that g.Category_Code is available on the page?

    Comment


      #17
      Re: How do I Call Custom fields For Categories or Products?

      Again, Token viewer or a tool like Inspector...or, if you like wasting time, just try adding an eval everytime.

      <mvt:eval expr="g.category_code" /> r

      right before you try to use the variable in an expression.

      You could also just use: &mvt:global:category_code;
      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


        #18
        Re: How do I Call Custom fields For Categories or Products?

        If you are using it in the category tree, the variable g.Category_Code is not set. That only gets set on the CTGY page

        You'll need to change use something like this:

        Code:
        <mvt:item name="customfields" param="Read_Category_Code( l.settings:cattree_category:code, 'mobile_cat_image', g.mobile_cat_image )" />
        <img src="&mvte:global:mobile_cat_image;">
        A rule of thumb is if you are using any function like this within a foreach loop (the category tree) the variable will always be l.setting: + the iterator of the array. This is why i'm using l.settings:cattree_category:code

        These video may help with some background:

        http://www.miva.com/videos/web_developers/structures

        http://www.miva.com/videos/web_developers/foreach-loops
        Brennan Heyde
        VP Product
        Miva, Inc.
        [email protected]
        https://www.miva.com

        Comment


          #19
          Re: How do I Call Custom fields For Categories or Products?

          Thank you both for the help. I realized when your code didn't work that I didn't give you all the information you needed. This is on the Mobile Category Tree page and is using toolkit and it is actually to show subcategory images, not main categories. This is the code that worked in case anyone needs it:

          Code:
          <mvt:item name="customfields" param="Read_Category_Code( l.settings:cattree_category:code, 'mobile_cat_image', g.mobile_cat_image )" />
          <img src="&mvte:global:mobile_cat_image;">
          Thanks again - your solutions helped me figure it out!

          Comment


            #20
            Re: How do I Call Custom fields For Categories or Products?

            Oops. I realized I posted the wrong code:

            Code:
            <mvt:item name="customfields" param="Read_Category_Code( l.settings:sub_category:code, 'mobile_cat_image', g.mobile_cat_image )" /><img src="&mvte:global:mobile_cat_image;">

            Comment

            Working...
            X