We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12645
    • 9 Posts
    Good evening everyone,
    IF package no longer works after 2.1.2 upgrade anyone else with this same issue?

    huh
      • 22303 MODX Staff
      • 10,725 Posts
      Seems to be working in my tests. Make sure you are not calling the If snippet non-cacheable in a Chunk used for a tpl in getResources or other similar Extras; this will delay processing until after the Chunk output is returned from the Snippet and various placeholders are out of scope.
        • 577
        • 132 Posts
        For me If snippet calls are failing to do anything other then return blank. I have found to places where it has failed once as a snippet and once as a custom output filter. Even when using &then &else neither show up.

        I believe when using is as a filter there is no cache involved so that could not be the issue here.

        The If filter that is failing can be tested if you have a copy of VC R4 running.

        This fails (orderStep1/config.default.php)
        Note: original code was using a lowercase "if" changed to uppercase but that did not resolve anything
        [[!+orderAmountMet:If=`[[+orderAmountMet]]`:is=`0`:then=`<b>You have not met the minimum order amount.</b>`:else=`
        <div id="vcBasketWrapper-nextStep">
        <form action="[[+action]]" method="post">
        <input type="submit" value="Next" />
        </form>
        </div>
        `]]
        


        Started immediately after 2.1.2 upgrade
          "One of these days I will get around to my own website... Its only been about 12 years... maybe tomorrow smiley"
          • 28215
          • 4,149 Posts
          Uhm, that’s not a proper usage. This is:

          [[!+orderAmountMet:is=`0`:then=`<b>You have not met the minimum order amount.</b>`:else=`
          <div id="vcBasketWrapper-nextStep">
          <form action="[[+action]]" method="post">
          <input type="submit" value="Next" />
          </form>
          </div>
          `]]
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 577
            • 132 Posts
            thanks for the info. I had never scene it work that way myself either but it was their code.... and what a mess of code it has been.

            Thank you I will look into the other issue I was having with "If" as a snippet and hopfully that was just the cache issue as suggested.
              "One of these days I will get around to my own website... Its only been about 12 years... maybe tomorrow smiley"
              • 37059
              • 368 Posts
              @aesmith

              I don’t know if you ever figured this out or not, but for reference anyway, it turns out that the problem with [[!+orderAmountMet]] and MODx 2.1.2 was at least partly caused by the placeholder being called uncached. It seems that in MODx 2.1.2, an uncached placeholder inside an uncached snippet is flatly ignored. See this bug report for details.
                Jason