{"id":6569,"date":"2022-01-05T10:37:00","date_gmt":"2022-01-05T10:37:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=6569"},"modified":"2022-01-05T10:37:00","modified_gmt":"2022-01-05T10:37:00","slug":"zobrazeni-ceny-polozky-objednavky-s-dph-a-bez-ve-woocommerce-e-mailu","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/zobrazeni-ceny-polozky-objednavky-s-dph-a-bez-ve-woocommerce-e-mailu\/","title":{"rendered":"Zobrazen\u00ed ceny polo\u017eky objedn\u00e1vky s dph a bez ve WooCommerce e-mailu"},"content":{"rendered":"\n
Souhrn objedn\u00e1vky ve WooCommerce e-mailu je tak trochu zjednodu\u0161en\u00fd. Cena za polo\u017eku je zobrazena v souhrnu a neobsahuje cenu bez DPH. V n\u00e1vodu si uk\u00e1\u017eeme, jak zobrazit ob\u011b ceny.<\/p>\n\n\n\n
Bohu\u017eel si ji\u017e nevysta\u010d\u00edme s akcemi a filtry, ale budeme muset upravit html k\u00f3d \u0161ablony. <\/p>\n\n\n\n
Jak vid\u00edte, pokud budeme cht\u00edt p\u0159idat dal\u0161\u00ed sloupce tabulky, budeme ji muset upravit.<\/p>\n\n\n\n
Nejprve vezmeme soubor email-order-details.php a zkop\u00edrujeme jej do aktivn\u00ed \u0161ablony (nepochybuji o tom, \u017ee m\u00e1te aktivn\u00ed child \u0161ablonu a needitujete rodi\u010dovskou \u0161ablonu).<\/p>\n\n\n\n
K\u00f3d hlavi\u010dky vypad\u00e1 takto:<\/p>\n\n\n\n
<thead>\n\t<tr>\n\t\t<th class=\"td\" scope=\"col\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php esc_html_e( 'Product', 'woocommerce' ); ?><\/th>\n\t\t<th class=\"td\" scope=\"col\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?><\/th>\n\t\t<th class=\"td\" scope=\"col\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php esc_html_e( 'Price', 'woocommerce' ); ?><\/th>\n\t<\/tr>\n<\/thead><\/code><\/pre>\n\n\n\nP\u0159id\u00e1me dal\u0161\u00ed bu\u0148ku a uprav\u00edme text Price:<\/p>\n\n\n\n
<tr>\n\t<th class=\"td\" scope=\"col\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php esc_html_e( 'Product', 'woocommerce' ); ?><\/th>\n\t<th class=\"td\" scope=\"col\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?><\/th>\n\t<th class=\"td\" scope=\"col\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php esc_html_e( 'Price without vat', 'woocommerce' ); ?><\/th>\n\t<th class=\"td\" scope=\"col\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php esc_html_e( 'Price with vat', 'woocommerce' ); ?><\/th>\n<\/tr><\/code><\/pre>\n\n\n\n\u00daprava \u0159\u00e1dku tabulky<\/h2>\n\n\n\n
V \u0159\u00e1dku n\u00e1m bohu\u017eel nesta\u010d\u00ed jen p\u0159idat bu\u0148ku, ale mus\u00edme z\u00edskat cenu s a bez dph, abychom je mohli zobrazit.<\/p>\n\n\n\n
Vezmeme soubor email-order-item.php a p\u0159esuneme jej do \u0161ablony. <\/p>\n\n\n\n
Origin\u00e1ln\u00ed k\u00f3d:<\/p>\n\n\n\n
<td class=\"td\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;\">\n\t<?php echo wp_kses_post( $order->get_formatted_line_subtotal( $item ) ); ?>\n<\/td><\/code><\/pre>\n\n\n\nZm\u011bn\u00edme na:<\/p>\n\n\n\n
<?php\n\t$price_without_vat = $order->get_line_total( $item, $false );\n\t$price_with_vat = $order->get_line_total( $item, true );\n?>\n<td class=\"td\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;\">\n\t<?php echo wc_price( $price_without_vat ); ?>\n<\/td>\n<td class=\"td\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>; vertical-align:middle; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif;\">\n\t<?php echo wc_price( $price_with_vat ); ?>\n<\/td><\/code><\/pre>\n\n\n\nT\u00edm jsme z\u00edskali cenu s DPH a cenu bez DPH. <\/p>\n\n\n\n
Jako posledn\u00ed mus\u00edme je\u0161t\u011b pro get order item totals a order note zm\u011bnit colspan z 2 na 3, jinak se n\u00e1m rozsype spodek tabulky.<\/p>\n\n\n\n
$item_totals = $order->get_order_item_totals();\n\nif ( $item_totals ) {\n\t$i = 0;\n\tforeach ( $item_totals as $total ) {\n\t\t$i++;\n\t\t?>\n\t\t<tr>\n\t\t\t<th class=\"td\" scope=\"row\" colspan=\"3\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>\"><?php echo wp_kses_post( $total['label'] ); ?><\/th>\n\t\t\t<td class=\"td\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>; <?php echo ( 1 === $i ) ? 'border-top-width: 4px;' : ''; ?>\"><?php echo wp_kses_post( $total['value'] ); ?><\/td>\n\t\t<\/tr>\n\t\t<?php\n\t}\n}\nif ( $order->get_customer_note() ) {\n\t?>\n\t<tr>\n\t\t<th class=\"td\" scope=\"row\" colspan=\"3\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php esc_html_e( 'Note:', 'woocommerce' ); ?><\/th>\n\t\t<td class=\"td\" style=\"text-align:<?php echo esc_attr( $text_align ); ?>;\"><?php echo wp_kses_post( nl2br( wptexturize( $order->get_customer_note() ) ) ); ?><\/td>\n\t<\/tr>\n\t<?php\n}<\/code><\/pre>\n\n\n\nV\u00fdsledek<\/h2>\n\n\n\n
<\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"Souhrn objedn\u00e1vky ve WooCommerce e-mailu je tak trochu zjednodu\u0161en\u00fd. Cena za polo\u017eku je zobrazena v souhrnu a neobsahuje cenu bez DPH. V n\u00e1vodu si uk\u00e1\u017eeme, jak zobrazit ob\u011b ceny. Bohu\u017eel si ji\u017e nevysta\u010d\u00edme s akcemi a filtry, ale budeme muset upravit html k\u00f3d \u0161ablony. Jak vypad\u00e1 defaultn\u00ed tabulka Jak vid\u00edte, pokud budeme cht\u00edt p\u0159idat dal\u0161\u00ed<\/p>\n","protected":false},"author":1,"featured_media":5600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-6569","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce-snippety"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6569"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=6569"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6569\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/5600"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=6569"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=6569"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=6569"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}