Announcement

Collapse
No announcement yet.

Custom Category Field not showing

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

    Custom Category Field not showing

    I'm running MM version 9.12 and I'm using the Shadows Readytheme.

    Under Utilities I created 2 custom category type fields.

    In the Catalog > Categories > Edit > Custom Fields it shows the fields that were created. In one category I've added a value to both fields and saved them.

    In the Store, on a the category page that has values saved in the custom category fields, I've searched for a variable that contains either of the custom field codes and nothing is showing up.

    On the CTGY page used to display the category I have turned on the custom fields item but, it did not change the results.

    Am I missing something?
    Gary

    [email protected]
    www.icCommerce.com

    #2
    I nearly always read CFs this way. I'm not sure the original method was ever available for the CTGYs.

    Code:
    <mvt:item name="customfields" param="Read_Category_Code( 'category_code', 'custom_field_code', l.settings:customfields )" />

    Scott
    Need to offer Shipping Insurance?
    Interactive Design Solutions https://www.myids.net
    MivaMerchant Business Partner | Certified MivaMerchant Web Developer
    Competitive Rates, Custom Modules and Integrations, Store Integration
    AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
    My T-shirt Collection is mostly MivaCon T-shirts!!

    Comment


      #3
      ^^^ This.

      Also, double check you've got the custom fields item active on the CTGY page.
      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


        #4
        Yes I do have the custom fields item activated on the CTGY page.

        ids, can you offer more details on the block of code you posted? I assume I need to replace 'category_code' with my category code, 'custom_field_code' with my custom field code, and, I have no idea of what to do with the l.settings:customfields.

        Something like?
        <mvt:item name="customfields" param="Read_Category_Code( 'Mini-Greek-Paddles', 'category-columns', l.settings:customfields )" />

        I have a plugin that shows all the variables on the page (thanks, Bruce) but I'm not seeing anything.
        Gary

        [email protected]
        www.icCommerce.com

        Comment


          #5
          I've asked Miva tech support to look into this
          Gary

          [email protected]
          www.icCommerce.com

          Comment


            #6
            Gary,

            Your example looks good. CTGY code is Mini-Greek-Paddles and the custom ctgy field is category-columns. If there is a value it gets stored in l.settings:customfields. Then you could display it by
            &mvt:customfields;
            (or use
            &mvte:
            based on encoding the value, like if it's HTML).

            Since you're pulling from the specific custom field you might do this

            Code:
            <mvt:item name="customfields" param="Read_Category_Code( 'Mini-Greek-Paddles', 'category-columns', l.settings:customfields:category-columns )" />
            Code:
            &mvt:customfields:category-columns;
            Depending on where you pull the CCF value, Sometimes the variable isn't available as a local variable. You likely need it as a global. In that case:

            Code:
            <mvt:item name="customfields" param="Read_Category_Code( 'Mini-Greek-Paddles', 'category-columns', g.my_category-columns )" />
            Code:
            &mvt:global:my_category-columns;

            Hope that Helps,

            Scott
            Need to offer Shipping Insurance?
            Interactive Design Solutions https://www.myids.net
            MivaMerchant Business Partner | Certified MivaMerchant Web Developer
            Competitive Rates, Custom Modules and Integrations, Store Integration
            AutoBaskets|Advanced Waitlist Integration|Ask about Shipping Insurance Integration
            My T-shirt Collection is mostly MivaCon T-shirts!!

            Comment


              #7
              Thanks, Scott
              Gary

              [email protected]
              www.icCommerce.com

              Comment


                #8
                Screen Shot 2018-12-13 at 12.15.45 PM.png

                There is a debug function that is helpful. Place
                HTML Code:
                <mvt:item name="customfields" param="Debug()"/>
                in the footer of your page. It will display on your store's page any errors in the customfields item.


                I kept seeing an error that the 3rd parameter must be a variable. It took me a while to realize it didn't like the name I was using. Once I no longer saw any errors, I found out that the third variable became an array containing three values, the custom field code, name, and value.

                I created a new variable and placed the value of the 3rd parameter in it. I was then able to use that variable in an IF statement.

                Purpose: While viewing the category page on a large display, most of my products are best viewed with four columns across the screen. But, a few of my categories look better if they are shown with three columns across the screen. Now with the custom category field and an IF statement, I can set the number of columns to display.

                IF the custom field equals 3 then use class="u-grids-3--l" ELSE use class="u-grids-4--l".
                Gary

                [email protected]
                www.icCommerce.com

                Comment


                  #9
                  the var for the custom field read is not an array unless you make it one, or leave out the specific custom field, so you'd just use &mvt:customcat;
                  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


                    #10
                    I think you want:

                    Code:
                     
                      <mvt:item name="customfields" param="Read_Category_Code( l.settings:category:code, 'short_name', l.settings:customcat )" />  All <mvt:if expr="l.settings:customcat">&mvt:customcat;</mvt:if>
                    Now, i've never used this, but I believe this works

                    Code:
                     
                     <mvt:item name="customfields" param="Read_Category_Code( l.settings:category:code, , l.settings:customcat )" />   &mvt:customcat:short_name; &mvt:customcat:some_other_custom_field; &mvt:customcat:yet_another_custom_field;
                    mostly cause i want to limit memory usages (some site's have tons of custom fields) and I like to use my own variable 'names'
                    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
                      oh, I think you need
                      Code:
                       
                       <mvt:item name="customfields" param="Read_Category_Code(l.settings:category:code, '', l.settings:customcat)" />
                      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


                        #12
                        yea, i guess that other post i recall seeing was either incorrect or possibly this works in mivascript but not SMT, but can confirm this works (I have it running in the category header of a site on currently on)

                        Code:
                        <mvt:item name="customfields" param="Read_Category_Code(l.settings:category:code, 'CatLevel3Intro', l.settings:customcat)" />
                        
                        &mvt:customcat;<br>
                        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


                          #13
                          yea, i couldn't find the post that mentioned this and I've never personally used it cause I like to give the variables names that make sense in the context they are used (unlike the naming convention, ah, somepeople use :) )
                          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