We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8168
    • 1,118 Posts
    Quote from: Bruno17 at Jan 06, 2016, 09:44 AM
    I'm sure, you can set values in hooks, which can be used as placeholders in the email-tpl and if I'm not wrong I had also used snippets in email-tpls.

    But I can't help, if don't want to show us the output of my little hook-snippet above.
    Should you take 5 minutes to create the snippet, add it as a hook to your formit-call, send the form and post the result here.

    Thanks Bruno, with that snippet in place I get this outputted:

    Array
    (
        [nospam:blank] => 
        [Cheese_Mon] => 9
        [Cheese_Tue] => 0
        [Cheese_Wed] => 0
        [Cheese_Thur] => 0
        [Cheese_Fri] => 0
        [Cheese_Sat] => 0
        [Cheese_Sun] => 0
        [Milk_Mon] => 0
        [Milk_Tue] => 0
        [Milk_Wed] => 0
        [Milk_Thur] => 0
        [Milk_Fri] => 0
        [Milk_Sat] => 0
        [Milk_Sun] => 0
        [Cream_Mon] => 0
        [Cream_Tue] => 0
        [Cream_Wed] => 0
        [Cream_Thur] => 0
        [Cream_Fri] => 0
        [Cream_Sat] => 0
        [Cream_Sun] => 0
        [Chicken_Mon] => 0
        [Chicken_Tue] => 0
        [Chicken_Wed] => 0
        [Chicken_Thur] => 0
        [Chicken_Fri] => 0
        [Chicken_Sat] => 0
        [Chicken_Sun] => 0
        [Beef_Mon] => 0
        [Beef_Tue] => 0
        [Beef_Wed] => 0
        [Beef_Thur] => 0
        [Beef_Fri] => 0
        [Beef_Sat] => 0
        [Beef_Sun] => 0
        [Burger_buns_Mon] => 0
        [Burger_buns_Tue] => 0
        [Burger_buns_Wed] => 0
        [Burger_buns_Thur] => 0
        [Burger_buns_Fri] => 0
        [Burger_buns_Sat] => 0
        [Burger_buns_Sun] => 0
        [Tomatoes_Mon] => 0
        [Tomatoes_Tue] => 0
        [Tomatoes_Wed] => 0
        [Tomatoes_Thur] => 0
        [Tomatoes_Fri] => 0
        [Tomatoes_Sat] => 0
        [Tomatoes_Sun] => 0
        [nospam] => 
    )
    


    Which shows it works fine in the form, as I selected 9 for Cheese on a Monday (e.g. first line item here)
      • 8168
      • 1,118 Posts
      Any thoughts Bruno? This boogles my mind why it is not working...
      • discuss.answer
        • 8168
        • 1,118 Posts
        BINGO!!!!!!!! Worked it out...

        To get the value of the form input in the emailTpl I need to use

        [[+[[+wf.title]]_Mon]]
        
          • 4172
          • 5,888 Posts
          great!
          I'm glad you got it sorted by yourself!
          That is what I have thought.
          But wanted to see the form-output to be sure.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 8168
            • 1,118 Posts
            Quote from: Bruno17 at Jan 06, 2016, 11:25 AM
            great!
            I'm glad you got it sorted by yourself!
            That is what I have thought.
            But wanted to see the form-output to be sure.

            Thanks Bruno.

            The last thing I want to be able to do, is when the user clicks on the submit button on the order form, they see a 2nd view which includes just the table rows of the products they have placed an order for - so we remove any product table rows which do not contain any order values - we then show this to the user as an order review, which they can then place, or click a "make changes" button to go back to the formit form once more...

            Any ideas on a way to achieve this?

            e.g. how to hide products if the user has not clicked to order them?

            I will then just email the details of the products ordered and not the full list of products from the wayfinder call. This is because there will be 200+ products and want to make it easy for the order recipient to process the order and not have to sift through all 200 products each time... [ed. note: dubbs last edited this post 10 years, 9 months ago.]
              • 4172
              • 5,888 Posts
              maybe in you wayfinder - tpl something like that:

              [[preparerow? &values=`[[+[[+wf.title]]_Mon]],[[+[[+wf.title]]_Tue]],[[+[[+wf.title]]_Wed]],[[+[[+wf.title]]_Thur]]`]]
              


              with all the days

              preparerow:

              <?php
              
              $values = explode(',',$modx->getOption('values',$scriptProperties,0));
              
              $sum = 0;
              foreach ($values as $value){
                  $sum += (int) $value;
              }
              
              $output = '';
              if ($sum>0){
                  foreach ($values as $value){
                      $output .= '<td><p>' . $value . '</p></td>';
                  }    
              }
              
              return $output;
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 8168
                • 1,118 Posts
                Thanks Bruno.

                Just looking at your suggestion and my current wayfinderTpl and wondering how to adapt it...

                My wayfinder tpl is:

                <td><select name="[[+wf.title]]_Mon" id="[[+wf.title]]_Mon" value="[[!+wf.title]]]">
                <option>0</option>
                <option value="1" [[!+wf.title_Mon:FormItIsSelected=`1`]]>1</option>
                <option value="2" [[!+wf.title_Mon:FormItIsSelected=`2`]]>2</option>
                <option value="3" [[!+wf.title_Mon:FormItIsSelected=`3`]]>3</option>
                <option value="4" [[!+wf.title_Mon:FormItIsSelected=`4`]]>4</option>
                <option value="5" [[!+wf.title_Mon:FormItIsSelected=`5`]]>5</option>
                <option value="6" [[!+wf.title_Mon:FormItIsSelected=`6`]]>6</option>
                <option value="7" [[!+wf.title_Mon:FormItIsSelected=`7`]]>7</option>
                <option value="8" [[!+wf.title_Mon:FormItIsSelected=`8`]]>8</option>
                <option value="9" [[!+wf.title_Mon:FormItIsSelected=`9`]]>9</option>
                </select></td>
                


                So where would I drop in the code you have suggested - e.g.

                [[preparerow? &values=`[[+[[+wf.title]]_Mon]],[[+[[+wf.title]]_Tue]],[[+[[+wf.title]]_Wed]],[[+[[+wf.title]]_Thur]]`]]
                


                Then, do I need to adapt the preparerow snippet code, to render as per my wayfinder Tpl

                Let me know // thanks wink
                  • 4172
                  • 5,888 Posts
                  this was for your productTPL-Output in the emailTpl.
                  You will need to modify it for your needs (if the idea does work at all).
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 8168
                    • 1,118 Posts
                    Sorry - yes of course, I quoted the wrong TPL in my mail.

                    I have it working, but it does not render the product name now...

                    How can I ensure that for the product that has any order values has its name included

                    The element of the TPL missing is as below:

                    <td>[[+wf.linktext]][[+wf.wrapper]]</td>
                    
                      • 4172
                      • 5,888 Posts
                      not sure, for what you need the wf.wrapper here, but something like that?

                      [[preparerow? &linktext=`[[+wf.linktext]]` &values=`[[+[[+wf.title]]_Mon]],[[+[[+wf.title]]_Tue]],[[+[[+wf.title]]_Wed]],[[+[[+wf.title]]_Thur]]`]


                      <?php
                       
                      $values = explode(',',$modx->getOption('values',$scriptProperties,0));
                      $linktext = $modx->getOption('linktext',$scriptProperties,'');
                       
                      $sum = 0;
                      foreach ($values as $value){
                          $sum += (int) $value;
                      }
                       
                      $output = '';
                      if ($sum>0){
                          $output .= '<tr>';
                          $output .= '<td>'.$linktext.'</td>';
                          foreach ($values as $value){
                              $output .= '<td><p>' . $value . '</p></td>';
                          }
                          $output .= '</tr>';    
                      }
                       
                      return $output;
                      [ed. note: Bruno17 last edited this post 10 years, 9 months ago.]
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!