How make a new line between customer tags and values

WPPizza – A Restaurant Plugin for WordPress Support General Support How make a new line between customer tags and values

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #46049
    Nurullah
    Participant

      Hi together,

      In thermal printer i get many issues because it doesn’t prinn everything on confirmation page. If i can move the values (name, address, etc.) of customer to a bottom line it will be okey. but i couldn’t find it how – without changing the code.

      #46050
      Olly
      Admin & Mod

        the print templates print what you have set up in wppizza -> templates -> print (or “emails” if your printer prints from the emails received – depends on setup and what your printer “listens” to )
        if you want to change the order of things – i.e move things below some other things – simply drag and drop there and save

        btw, this is completely independent of what the confirmation page shows (which follows the settings in wppizza->order form)

        #46056
        Nurullah
        Participant

          thanks!

          #46059
          Nurullah
          Participant

            i added some css (display:block;), but when i print it via my thermal printer, the css code will be ignored. can you add some html code like <br> ?

            #46092
            Olly
            Admin & Mod

              although theoretically doable, i cannot see how this could help

              in a nutshell, the html output is something like this

              
              ....
              <tr><td>some label</td><td>some value</td></tr>
              ...
              

              so just adding a <br> before/after the label / value will still keep it all in their own table column
              adding a <br> after the closing </tr> is simply invalid html (and will therefore in most cases be ignored probably anyway)

              are you sure your printer can actually print html in the first place ?
              have you tried using a plaintext template with that printer ?

              #46107
              Nurullah
              Participant

                I have this problem in many thermo printers. If i also can remove the labels “name, address, phone” then it will also solve my problem. But i can’t find this too..

                #46108
                Olly
                Admin & Mod

                  > I have this problem in many thermo printers.

                  I am sure you do.

                  <rant>
                  (the majority of) thermal printers are technologically still stuck in the 80's 
                  from what I can tell
                  All I (i.e wppizza) can do is output valid, standard html and/or plain-text 
                  documents (and with the pdf plugin pdf's too - as attachments) that can be 
                  send to and printed by a/the printer. 
                  It is completely out of my hands as to what the printer does with this 
                  when printing.
                  From what I can tell, most thermo printers simply do not follow *any* standard 
                  and/or do their own thing as to whatever the company has dreamt up at the 
                  time the format should be without any consideration at all as to any standards.
                  Afaik, in many cases one cannnot even select the most basic things like  fonts or fontsizes , 
                  let alone anything more specific....
                  I must admit, I find the arrogance/laziness (call it what you will)  
                  of printer manufacturers on that front quite staggering to be honest .....
                  (i could rant on about this for quite a while here, but it wont help you of course, 
                  so i wont ------- for now :))
                  </rant>

                  So, that off my chest (sorry) back to the issue at hand:
                  (You did not address this question) – Did you try setting your template you are using for printing to plaintext ?
                  is the output better/worse ?
                  perhaps could you post a screenshot of both outcomes ?

                  Btw, I’m not trying to be difficult, just trying to find the most appropriate workaround/solution to what really should be someone elses problem (I’m referring to printer manufacturers here, please don’t take this as a dig at you !)
                  to perhaps come up with something that helps not only in your particular case but might be generally useful for others too coming across this post…..

                  #46109
                  Nurullah
                  Participant

                    Yes i tried but plaintext format is not good for my customer, because they need the titles bold.

                    here is the output: https://prnt.sc/qito1l

                    but i want to make the header something similiar to: https://prnt.sc/qitovt

                    The print size in template is 4, when i make it 3 or less it’s hard to read (for old men :))

                    #46111
                    Olly
                    Admin & Mod

                      thanks for the screenshots.
                      from what i can see, your issue isn’t actually the html/css as the printer does seemingly print bold and table columns etc (referring to the screenshot https://prnt.sc/qito1l) but that it forces left and right margins .

                      The most appropriate solution I would think is setting the margins on the printer to something smaller / zero.
                      However it might be the case that the printer does not allow for this to be adjusted.
                      If that is the case, my idea would be to add the following to the css declarations

                      a) set the body margins in the css declaration to something negative . i.e

                      body {
                      margin-left: -100px;
                      margin-right: -25px;
                      }

                      or perhaps in mm

                      body {
                      margin-left: -10mm;
                      margin-right: -5mm;
                      }

                      (you might have to play with the values until it fits)

                      b) regarding customer labels, add the following

                      
                      #customer tbody > tr > td:first-child {
                      display: none;
                      }
                      

                      which should hide the labels there

                      always provided the printer does in fact understand this sort of thing.
                      let me know if the above makes any difference please

                      #46112
                      Olly
                      Admin & Mod

                        some random epson doc i have come across which may or may not be relevant
                        https://files.support.epson.com/htmldocs/pho925/pho925rf/vari_2.htm

                        it says there :

                        “Printing on roll paper
                        You need to make your data 4 mm wider than the roll paper.”

                        so a -4mm (left only ?) margin on the body *might* be what works – assuming your printer is an epson printer….
                        just posting things as i come across them here for future reference perhaps

                        #46130
                        Nurullah
                        Participant

                          Thanks for the answers.

                          Unfortunately the css codes don’t work. I think the printer driver doesn’t render them. In print preview it look great. But in printer i can see all hidden values (customer labels).

                          #46137
                          Olly
                          Admin & Mod

                            the last one left is using a filter then .
                            so something like this (i assume you know how wordpress filters work and how/where to use them)

                            
                            /*
                            remove first <td> (label) from customer data in emails and/or print templates
                            */
                            add_filter('wppizza_filter_template_customer_section', 'myprefix_remove_customer_labels', 10, 3);
                            function myprefix_remove_customer_labels($markup_array, $template_type, $tplId){
                            /*
                            only filter for print templates
                            else return as is
                            */	
                            if($template_type != 'print'){
                            return $markup_array;	
                            }
                            /*
                            //	if required one could also restrict by template id like
                            //	if($tplId != 3){return $markup_array;}
                            */
                            /* 
                            quick remove colspan from thead, as we are removing all label td's to end up with one td only per tr 
                            */
                            $markup_array['section_label'] = str_replace('colspan="2"', '' , $markup_array['section_label']);
                            /*
                            all customer data fields - by array keys -  where we want to remove the label td
                            intersecting the 2 we want to keep, with the rest
                            */
                            $customer_data_keys = array_diff( array_keys($markup_array), array('section_label', 'tbody_', '_tbody'));	
                            /*
                            remove first td of all customer data
                            */
                            foreach($customer_data_keys as $cdKey){
                            /*
                            quick and dirty explode 
                            Note:
                            could also (should probably) be done by regex or parsing dom document 
                            or whatever else one can think of 
                            as perhaps - though not very likely - one day there might end up being a space 
                            or something between the "</td><td" for some as yet unknown reason
                            it's just a note if you want to make this more "future proof" 
                            */
                            $orig_string = explode('</td><td', $markup_array[$cdKey]);// explode by closing/opening td's
                            $new_str = '<tr><td'.$orig_string[1];//prepend tr->td to second part of exploded array
                            $markup_array[$cdKey]	= $new_str;//put it together
                            }
                            return $markup_array;	
                            }
                            
                            #46142
                            Nurullah
                            Participant

                              Great it works! and if comment if($template_type != ‘print’) this, then it should also work for email template – i think.

                              thanks!!

                            Viewing 13 posts - 1 through 13 (of 13 total)
                            • The topic ‘How make a new line between customer tags and values’ is closed to new replies.