WPPizza – A Restaurant Plugin for WordPress › Support › General Support › order_details in DB – Change format
- AuthorPosts
- 2 March, 2019 at 2:34 pm #41880
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,00mit amerikanischem Krautsalat “Coleslaw”, mit Chili-Cheese Pommes
Ihre Artikel € 26,00
Gratislieferung
Inkl. Steuer von 7% € 1,71
Gesamt € 26,00is 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?!?
4 March, 2019 at 10:39 am #41901sorry, but only plaintext will be stored in these fields
I dont actually even understand why html would be useful there I must admit4 March, 2019 at 12:16 pm #41902Well,
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.4 March, 2019 at 1:35 pm #41903i would strongly suggest you start here in that case
https://docs.wp-pizza.com/developers/?section=function-wppizza_get_ordersget 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 theget_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 )4 March, 2019 at 1:50 pm #41904a 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); }
18 March, 2019 at 5:41 pm #42194there are now some globally available and more versatile wrapper functions available
https://docs.wp-pizza.com/developers/?section=email-print-templates - AuthorPosts
- The topic ‘order_details in DB – Change format’ is closed to new replies.