We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    If you want the whole price element, with enclosing HTML and a label, you would need something like this
    <?php
    if(isset($_SESSION['webValidated'])) {
        $tv = $modx->getTemplateVar('price');
        // format TV value for display
        $output = '<div class="price">A Fantastic Bargain Just For YOU!!! Only $' . $tv['value'] . '!!!</div>';
       return $output;
    }
    return;
    ?>
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 10489
      • 93 Posts
      ok,

      I started over, this is what i did:

      1. create a price TV
      2. added R 250.00 to the price TV in my document.
      3. created price_check snippet and called it in the document both cached and un-cached - [[price_check]] & [!price_check!]
      4. cleared my cache, clicked on preview.....price still not showing in front end whether logged in or not.

      have i missed something?

        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Are you sure you assigned the TV to the template your document is using?
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 10489
          • 93 Posts
          Yes i did.

          I also followed this: http://wiki.modxcms.com/index.php/Adding_TV_Widgets_without_hacking_the_core
          and this also didn’t work.

          By the way i’m using Evolution 1.0.4
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Ok. Here’s exactly what I did.

            1. Create a TV named price, input type text, no output widget. Assign it to the template.
            2. Create a snippet named price_check with this code (if you copy/paste this, make sure you don’t leave duplicate <?php and ?> tags in the field)
            <?php
            if(isset($_SESSION['webValidated'])) {
                $tv = $modx->getTemplateVar('price');
                // format TV value for display
            
                 return $tv['value'];
            }
            return;
            ?>

            3. In my resource content I put [!price_check!] and [!WebLogin!]
            4. Created a web user.

            When I’m not logged in I don’t see anything. When I log in, I see the value of the TV.
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 10489
              • 93 Posts
              Well.....Murphy’s law.
              I started again form scratch, followed exactly what you posted and it now works perfectly.

              Dunno why....

              but i really appreciate your help
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Most likely a typo somewhere, with my eyes sometimes I’ll spend hours fighting a bug to find a doubled ’ somewhere or something like that.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org