order_details in DB – Change format

WPPizza – A Restaurant Plugin for WordPress Support General Support order_details in DB – Change format

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #41880
    Oguz Ece
    Participant

      Hey Olly,
      I want to change the format how an order is stored in the Database (wppizza_orders (DB) -> order_details (column)).

      here is an example:

      Menge Artikel ————————————————– Preis
      2 Chili-Cheeseburger € 26,00

      mit amerikanischem Krautsalat “Coleslaw”, mit Chili-Cheese Pommes

      Ihre Artikel € 26,00
      Gratislieferung
      Inkl. Steuer von 7% € 1,71
      Gesamt € 26,00

      is it possbile also for the customer_ini?

      i want to have there HTML not plain Text.

      I search in your docs but i only found in the markup/order/itemised.php but i think this is wrong?!?

      #41901
      Olly
      Admin & Mod

        sorry, but only plaintext will be stored in these fields
        I dont actually even understand why html would be useful there I must admit

        #41902
        Oguz Ece
        Participant

          Well,
          I want to target the HTML Elements with js,
          Because in the future i want a build a App where i can recieve the Orders. The App should get the orders with the build in function from wordress Rest api.

          #41903
          Olly
          Admin & Mod

            i would strongly suggest you start here in that case
            https://docs.wp-pizza.com/developers/?section=function-wppizza_get_orders

            get the template parameters (in this case print from the print templates id=0 and assuming it’s set to be using html format for your purpose)

            
            $template_type = 'print';
            $template_id = 0;
            /* parameters of template print template id 0 */
            $template_parameters = get_option(WPPIZZA_SLUG.'_templates_'.$template_type);
            $template_parameters = $template_parameters[$template_id];
            /* 
            get the html markup  
            $order formatted will be the order(s) you get from the wppizza_get_orders() functions
            so the below should be in a loop
            */
            $markup = WPPIZZA() -> templates_email_print -> get_template_email_html_sections_markup($order_formatted, $template_parameters, $template_type, $template_id);
            

            mileage may vary, and not tested as such, but something along these lines.

            the next version of WPpizza will probably have a global wrapper function that replaces the WPPIZZA() -> templates_email_print -> get_template_email_html_sections_markup with something that is easier to use (and i would strongly recommend to use it once it’s implemented as the get_template_email_html_sections_markup referred to above *might( well change at some point in the future as it’s really only an internal function, but I’m just mentioning it here. just do not rely on it )

            #41904
            Olly
            Admin & Mod

              a quick – working – example (as mentioned, mileage may vary, and the caveat regarding function name remains)

              
              /* get orders */
              $orders = wppizza_get_orders();
              /* get template */
              $template_type = 'print';
              $template_id = 0;
              /* parameters of template print template id 0 */
              $template_parameters = get_option(WPPIZZA_SLUG.'_templates_'.$template_type);
              $template_parameters = $template_parameters[$template_id];
              /* get markup for each order */
              foreach($orders['orders'] as $order_formatted){
              $order_for_template = array();
              $order_for_template['sections'] = $order_formatted;
              $markup = WPPIZZA() -> templates_email_print -> get_template_email_html_sections_markup($order_for_template, $template_parameters, $template_type, $template_id);	
              }
              
              #42194
              Olly
              Admin & Mod

                there are now some globally available and more versatile wrapper functions available
                https://docs.wp-pizza.com/developers/?section=email-print-templates

              Viewing 6 posts - 1 through 6 (of 6 total)
              • The topic ‘order_details in DB – Change format’ is closed to new replies.