Announcement

Collapse
No announcement yet.

Conditional Using A Custom Category

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

    Conditional Using A Custom Category

    I have a custom category called "noffolows". I am toting to use it in a conditional with no success.

    <mvt:item name="toolkit" param="subcat|ccount|g.Category_Code" />
    <mvt:if expr="ccount GT 0">
    <mvt:foreach iterator="sub_category" array="sub_categories">


    <mvt:item name="customfields" param="Read_Category_Code(g.Category_Code, 'nofollows', g.nofollows)" />
    <mvt:if expr="g.categorypic">
    <mvt:if expr="g.nofollows EQ 'Yes'">
    True
    <mvt:else>
    False
    </mvt:if>
    Don Lappin
    Manager
    PLFixtures.com
    1-816-463-3034

    #2
    Re: Conditional Using A Custom Category

    You're reading the custom field within the Toolkit's sub-category loop, so g.Category_Code is not the appropriate variable for obtaining the necessary sub-category code.

    Comment


      #3
      Re: Conditional Using A Custom Category

      Hi Dan!
      This one is on the same page and works. That is what I can not understand.
      <mvt:item name="customfields" param="Read_Category_Code(g.Category_Code, 'categorypic', g.categorypic )" />
      <mvt:if expr="g.categorypic">
      Yes
      <mvt:else>
      No
      </mvt:if>

      Here is all the code. The g.categorypic conditional works great.
      <div>
      <mvt:item name="toolkit" param="subcat|ccount|g.Category_Code" />
      <mvt:if expr="ccount GT 0">
      <!--<h2>Sub Categories For &mvte:category:name;</h2> -->
      <mvt:foreach iterator="sub_category" array="sub_categories">
      <div class="col-md-3 col-sm-4"> <!-- divcol-md-3 col-sm- -->
      <div class="padding"> <!-- div2 -->
      <!-- NEW SUBCAT PIC -->
      <mvt:item name="customfields" param="Read_Category_Code(g.Category_Code, 'categorypic', g.categorypic )" />
      <mvt:item name="customfields" param="Read_Category_Code(g.Category_Code, 'nofollows', g.nofollows)" />
      <mvt:if expr="g.categorypic">
      <mvt:if expr="g.nofollows EQ 'Yes'">
      <div class="item-details"> <li><a href="/&mvt:sub_category:code;.html" rel="nofollow">&mvt:sub_category:name;</a></li></div>
      <mvt:else>
      <div class="item-details"> <li><a href="/&mvt:sub_category:code;.html">&mvt:sub_category:na me;</a></li></div>
      </mvt:if>
      <mvt:else>
      <div class="mycategory-item"><!-- divcategory-item -->
      <div class="item-image">
      <a href="/&mvt:sub_category:code;.html" rel="nofollow"><img src="catpics/&mvte:sub_category:code;.jpg" border="0" alt="&mvt:sub_category:name;"></a>
      <mvt:if expr="g.nofollows EQ 'Yes'">
      <div class="item-details"> <a href="/&mvt:sub_category:code;.html" rel="nofollow">&mvt:sub_category:name;</a></div>
      <mvt:else>
      <div class="item-details"> <a href="/&mvt:sub_category:code;.html">&mvt:sub_category:na me;</a></div>
      </mvt:if>
      </div> <!-- item-image-->
      </div><!-- divcategory-item -->
      </mvt:if>
      <!-- END NEW SUBCAT PIC -->
      </div><!-- div3-->
      </div> <!-- divcol-md-3 col-sm- -->
      </mvt:foreach>
      </mvt:if>
      </div>
      Don Lappin
      Manager
      PLFixtures.com
      1-816-463-3034

      Comment


        #4
        Re: Conditional Using A Custom Category

        Ask yourself this, what is the variable for displaying a subcategory's code within the Toolkit's subcat function/foreach loop? If you want to display a custom field for a given subcat, what would be the appropriate variable to pass to the Read_Category_Code function for it to pull the proper information?

        I suspect your
        categorypic field is not firing properly either if your goal there was to specify "yes" on the subcategory level and not the current category this is all displayed on, ie. g.Category_Code.

        Comment


          #5
          Re: Conditional Using A Custom Category

          categorypic is checking for ISNULL seems to work fine

          I got the code from toolkit and &mvte:global:vnofollows; shows the value of nofollows for each sub category but the conditional shows goodbye for all subcategorieseven when the nofollows field = Yes


          <mvt:item name="toolkit" param="customcategoryc|vnofollows|l.all_settings:s ub_category:code|nofollows" />
          &mvte:global:vnofollows;


          <mvt:if expr="l.settings:vnofollows:customfield_values:cus tomfields:nofollows EQ 'Yes'">
          Hello!
          <mvt:else>
          Goodbye
          </mvt:if>
          Don Lappin
          Manager
          PLFixtures.com
          1-816-463-3034

          Comment


            #6
            Re: Conditional Using A Custom Category

            The customcategoryc Toolkit function declares a global variable, g.vnofollows, containing the contents of the specified custom field:


            Code:
            <mvt:item name="toolkit" param="customcategoryc|vnofollows|l.all_settings:sub_category:code|nofollows" />
            &mvte:global:vnofollows;

            Your conditional is checking for l.settings:vnofollows:customfield_values:customfie lds:nofollows, not g.vnofollows.


            Code:
            <mvt:if expr="l.settings:vnofollows:customfield_values:customfields:nofollows EQ 'Yes'">
            If you were using the new stock custom field capabilities, it is very similar. The custom field value is assigned to a global variable, which is what you would test against. l.settings:vnofollows:customfield_values:customfie lds:nofollows is the old method of calling the contents of a custom field, IF it is available/assigned for a given display.

            Comment


              #7
              Re: Conditional Using A Custom Category

              woops I mean
              <mvt:if expr="l.settings:sub_category:code:customfield_val ues:customfields:nofollows EQ 'Yes'">
              Hello!
              <mvt:else>
              Goodbye
              Don Lappin
              Manager
              PLFixtures.com
              1-816-463-3034

              Comment


                #8
                Re: Conditional Using A Custom Category

                This does not work either nor does g.vnofollows
                <mvt:if expr="l.settings:global.vnofollows:customfield_val ues:customfields:nofollows EQ 'Yes'">
                Hello!
                <mvt:else>
                Goodbye
                </mvt:if>
                Don Lappin
                Manager
                PLFixtures.com
                1-816-463-3034

                Comment


                  #9
                  Re: Conditional Using A Custom Category

                  Erase :customfield_values:customfields: from your mind, that is the old method. Your original example was correct, however you were passing the wrong variable for the Toolkit's subcategory code to Read_Category_Code:

                  Code:
                  <mvt:item name="customfields" param="Read_Category_Code(l.settings:sub_category:code, 'nofollows', g.nofollows)" />
                  <mvt:if expr="g.nofollows EQ 'YES'">
                  Do something.
                  </mvtif>

                  Comment


                    #10
                    Re: Conditional Using A Custom Category

                    Sorry This does not work, but it sure looks like it should.

                    <mvt:item name="customfields" param="Read_Category_Code(l.settings:sub_category: code, 'nofollows', g.nofollows)" />
                    &mvte:g.nofollows;
                    <mvt:if expr="g.vnofollows EQ 'YES'">
                    H
                    <mvt:else>
                    G
                    </mvt:if>
                    Don Lappin
                    Manager
                    PLFixtures.com
                    1-816-463-3034

                    Comment


                      #11
                      Re: Conditional Using A Custom Category

                      g.nofollows vs. g.vnofollows

                      Code:
                      
                      <mvt:item name="customfields" param="Read_Category_Code(l.settings:sub_category: code, 'nofollows', g.nofollows)" />
                      &mvte:g.nofollows;
                      <mvt:if expr="g.vnofollows EQ 'YES'">
                      H
                      <mvt:else>
                      G
                      </mvt:if>

                      Comment


                        #12
                        Re: Conditional Using A Custom Category

                        You can see this here: http://plfixtures.com/drop-in-kitche...rall-size.html

                        This code from toolkit writes the correct value for nofollows
                        <mvt:item name="toolkit" param="customcategoryc|vnofollows|l.all_settings:s ub_category:code|nofollows" />
                        &mvte:global:vnofollows;

                        This code does not write the value nor does the test work
                        <mvt:item name="customfields" param="Read_Category_Code(l.settings:sub_category: code, 'nofollows', g.nofollows)" />
                        &mvte:g.nofollows;
                        <mvt:if expr="g.nofollows EQ 'YES'">
                        H
                        <mvt:else>
                        G
                        </mvt:if>
                        Don Lappin
                        Manager
                        PLFixtures.com
                        1-816-463-3034

                        Comment


                          #13
                          Re: Conditional Using A Custom Category

                          The value on the second one would not display because of this: &mvte:g.nofollows; vs. &mvte:global:nofollows;

                          What are the values displayed if you use the following?
                          Code:
                          <mvt:item name="toolkit" param="customcategoryc|vnofollows|l.all_settings:sub_category:code|nofollows" />
                          <mvt:if expr="g.vnofollows">
                          &mvt:global:vnofollows;
                          </mvt:if>
                          

                          Last edited by Dan - Glendale Designs; 10-02-14, 12:15 PM.

                          Comment


                            #14
                            Re: Conditional Using A Custom Category

                            Ah now that is displaying yes as it should on the stainless sink category
                            http://plfixtures.com/drop-in-kitche...rall-size.html
                            Don Lappin
                            Manager
                            PLFixtures.com
                            1-816-463-3034

                            Comment


                              #15
                              Re: Conditional Using A Custom Category

                              Alright, now we're getting somewhere. Do you see the issue?

                              Comment

                              Working...
                              X