• Dear friend, please, could you help me to put the flavours chosed at the printer report of each sale?
    
    (example attached here: https://pizzavenus.com.br/wp-content/uploads/2024/06/print-invoice-pizza-venus.jpg)
    
    Bellow is the php code where I need to put this add:
    
    <!DOCTYPE html>
    
    <html>
    
    <head>
    
    <meta charset="utf-8">
    
    <title></title>
    
    <style>
    
    /* CSS Media Queries for Print
    
    ------------------------------------------*/
    
    @media print {
    
    body {
    
    max-width: 100mm;
    
    margin: 100;
    
    }
    
    </style>
    
    <style>
    
    #navigation {
    
    font-family: sans-serif;
    
    background-color: #f1f1f1;
    
    z-index: 200;
    
    border-bottom: 1px solid #dfdfdf;
    
    left: 0;
    
    right: 0;
    
    bottom: 0;
    
    position: fixed;
    
    padding: 6px 8px;
    
    text-align: right;
    
    }
    
    #navigation .button {
    
    transition-property: border, background, color;
    
    display: inline-block;
    
    font-size: 13px;
    
    line-height: 26px;
    
    height: 28px;
    
    margin: 0;
    
    padding: 0 10px 1px;
    
    cursor: pointer;
    
    border-width: 1px;
    
    border-style: solid;
    
    -webkit-border-radius: 3px;
    
    -webkit-appearance: none;
    
    border-radius: 3px;
    
    white-space: nowrap;
    
    -webkit-box-sizing: border-box;
    
    -moz-box-sizing: border-box;
    
    box-sizing: border-box;
    
    background: #2ea2cc;
    
    border-color: #0074a2;
    
    -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.5), 0 1px 0 rgba(0,0,0,.15);
    
    box-shadow: inset 0 1px 0 rgba(120,200,230,0.5), 0 1px 0 rgba(0,0,0,.15);
    
    color: #fff;
    
    text-decoration: none;
    
    }
    
    #navigation .button:hover,
    
    #navigation .button:focus {
    
    background: #1e8cbe;
    
    border-color: #0074a2;
    
    -webkit-box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
    
    box-shadow: inset 0 1px 0 rgba(120,200,230,0.6);
    
    color: #fff;
    
    }
    
    #navigation .button:active {
    
    background: #1b7aa6;
    
    border-color: #005684;
    
    color: rgba(255,255,255,0.95);
    
    -webkit-box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
    
    box-shadow: inset 0 1px 0 rgba(0,0,0,0.1);
    
    }
    
    @media print {
    
    #navigation {
    
    display: none;
    
    }
    
    }
    
    </style>
    
    <link rel="stylesheet" href="https://pizzavenus.com.br/wp-content/plugins/woocommerce-delivery-notes/templates/print-order/style.css" type="text/css" media="screen,print" />
    
    <style>
    
    .order-items .order-pizza-meta-list,
    
    .display-meta .order-pizza-meta-list,
    
    display: yes;
    
    display: active;
    
    .order-items .woocommerce-Price-amount,
    
    .display-meta .woocommerce-Price-amount,
    
    display: yes;
    
    display: active;
    
    .order-items .order-pizza-meta-list,
    
    .display-meta .order-pizza-meta-list,
    
    display: yes;
    
    display: active;
    
    .order-items .order-line-items,
    
    .display-meta .order-line-items,
    
    display: yes;
    
    display: active;
    
    .order-items .woocommerce-order-items,
    
    .display-meta .woocommerce-order-items,
    
    display: yes;
    
    display: active;
    
    .order-items .woocommerce-order-items-wrapper,
    
    .order-items .woocommerce-order-items-wrapper,
    
    display: yes;
    
    display: active;
    
    .woocommerce-order-items-wrapper,
    
    .order-pizza-meta-list {
    
    }
    
    </style>
    
    <style>
    
    #page {
    
    font-size: 1.5em;
    
    font-style: bold;
    
    font-family: arial, serif;
    
    column-width: 5500mm;
    
    column-gap: 2000mm;
    
    margin-left: 1mm;
    
    margin-right: 10mm;
    
    line-height: 115%;
    
    font-weight: bold;
    
    font-weight: capitalize;
    
    }
    
    .order-addresses address {
    
    font-size: 1.4em;
    
    line-height: 99%;
    
    font-weight: bold
    
    column-width: 950mm;
    
    }
    
    .wcdn_head {
    
    font-size: 0.5em;
    
    line-height: 99%;
    
    font-weight: bold
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .order-addresses .shipping-address {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .order-addresses .billing-address .state {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .order-addresses .billing-address .billing_number {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .billing-address .state {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .order-addresses .billing-address .state {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .order-addresses .head-price {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .head-item-price {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .product-item-price {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .order-items .product-name {
    
    width: 50%;
    
    column-width: 2000mm;
    
    column-rule-width: 1000;
    
    margin-right: 100mm;
    
    font-weight: bold;
    
    font-size: 1.3em;
    
    }
    
    </style>
    
    <style>
    
    .order-items .head-name {
    
    width: 50%;
    
    column-width: 2950mm;
    
    margin-right: 150mm;
    
    font-weight: bold;
    
    }
    
    </style>
    
    <style>
    
    .order-items .product-price {
    
    width: 50%;
    
    column-width: 2000mm;
    
    column-rule-width: 1000;
    
    margin-right: 100mm;
    
    font-weight: bold;
    
    font-size: 1.3em;
    
    }
    
    </style>
    
    <style>
    
    .order-items .total-price {
    
    font-size: 1.3em;
    
    }
    
    </style>
    
    <style>
    
    .order-items .total-quantity {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .order-items .shipped_via {
    
    display: none;
    
    }
    
    </style>
    
    <style>
    
    .order-branding .company-logo img {
    
    width: 300px;
    
    height: auto;
    
    column-width: 950mm;
    
    }
    
    </style>
    
    </head>
    
    <body class="invoice">
    
    <div id="container">
    
    <div id="navigation">
    
    <a href="#" class="button" onclick="window.print();return false;">Imprimir</a>
    
    </div><!-- #navigation -->
    
    <div id="page">
    
    <article class="content">
    
    <div class="order-branding">
    
    <div class="company-logo">
    
    <style>
    
    /* hide mobile version by default */
    
    .logo .mobile {
    
    display: none;
    
    }
    
    /* when screen is less than 600px wide show mobile version and hide desktop */
    
    @media ( max-width: 600px ) {
    
    .logo .mobile {
    
    display: block;
    
    }
    
    .logo .desktop {
    
    display: none;
    
    }
    
    }
    
    </style>
    
    <div class="logo">
    
    <img src="https://ml2ycaibhako.i.optimole.com/w:350/h:156/q:mauto/process:1802/id:160a9124352e6d94d048292b9fa5737e/https://pizzavenus.com.br/logo-pizza-venus-para-site-print-invoice-pedidos-site.png" class="desktop" width="88" height="39" alt="Pizza Vênus (51) 3221.0322" />
    
    <img src="https://ml2ycaibhako.i.optimole.com/w:350/h:156/q:mauto/process:1802/id:160a9124352e6d94d048292b9fa5737e/https://pizzavenus.com.br/logo-pizza-venus-para-site-print-invoice-pedidos-site.png" class="mobile" width="88" height="39" alt="Pizza Vênus (51) 3221.0322" />
    
    </div>
    
    </div>
    
    <div class="company-info">
    
    <div class="company-address"><p>Duque de Caxias 765 Centro Histórico POA RS</p>
    
    </div>
    
    </div>
    
    </div><!-- .order-branding -->
    
    <div class="order-addresses">
    
    <div class="billing-address">
    
    <h3>Endere?o de cobran?a</h3>
    
    <address>
    
    Jo?o Kussler<br />Rua duque de caxias, 638<br />apto 902<br />Porto Aelgre<br />Rio Grande do Sul<br />90010-280
    
    </address>
    
    </div>
    
    <div class="shipping-address">
    
    <h3>Endere?o de entrega</h3>
    
    <address>
    
    Jo?o Kussler<br />Rua duque de caxias, 638<br />apto 902<br />Porto Aelgre<br />Rio Grande do Sul<br />90010-280
    
    </address>
    
    </div>
    
    </div><!-- .order-addresses -->
    
    <div class="order-info">
    
    <h2></h2>
    
    <ul class="info-list">
    
    <li>
    
    <strong>Número do Pedido</strong>
    
    <span>1813</span>
    
    </li>
    
    <li>
    
    <strong>Data do pedido</strong>
    
    <span></span>
    
    </li>
    
    <li>
    
    <strong>Forma de pagamento</strong>
    
    <span>Pagamento na entrega (informar valor do troco nas observa??es em caso de dinheiro)</span>
    
    </li>
    
    <li>
    
    <strong>Email</strong>
    
    <span><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d6bcb9b7b9bda3a5a5bab3a496b1bbb7bfbaf8b5b9bb">[email protected]</a></span>
    
    </li>
    
    <li>
    
    <strong>Telefone</strong>
    
    <span>51981033829</span>
    
    </li>
    
    </ul>
    
    </div><!-- .order-info -->
    
    <div class="order-items">
    
    <table>
    
    <thead>
    
    <tr>
    
    <th class="head-name"><span>Produto</span></th>
    
    <th class="head-item-price"><span>Pre?o</span></th>
    
    <th class="head-quantity"><span>Quantidade</span></th>
    
    <th class="head-price"><span>Total</span></th>
    
    </tr>
    
    </thead>
    
    <tbody>
    
    <tr>
    
    <td class="product-name">
    
    <span class="name">
    
    Pizza Grande 35cm 9 fatias até 3 sabores </span>
    
    <ul class="wc-item-meta"><li><strong class="wc-item-meta-label">Borda Recheada:</strong> <p>Chocolate</p></li></ul> <dl class="extras">
    
    </dl>
    
    </td>
    
    <td class="product-item-price">
    
    <span><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">R$</span>&nbsp;79,90</span></span>
    
    </td>
    
    <td class="product-quantity">
    
    <span>1</span>
    
    </td>
    
    <td class="product-price">
    
    <span><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">R$</span>&nbsp;79,90</span></span>
    
    </td>
    
    </tr>
    
    </tbody>
    
    <tfoot>
    
    <tr>
    
    <td class="total-name"><span>Subtotal</span></td>
    
    <td class="total-item-price"></td>
    
    <td class="total-quantity"></td>
    
    <td class="total-price"><span><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">R$</span>&nbsp;79,90</span></span></td>
    
    </tr>
    
    <tr>
    
    <td class="total-name"><span>Entrega</span></td>
    
    <td class="total-item-price"></td>
    
    <td class="total-quantity"></td>
    
    <td class="total-price"><span><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">R$</span>&nbsp;5,99</span>&nbsp;<small class="shipped_via">via Entrega via Motoboy próprio (Centro Histórico)</small></span></td>
    
    </tr>
    
    <tr>
    
    <td class="total-name"><span>Total</span></td>
    
    <td class="total-item-price"></td>
    
    <td class="total-quantity">1</td>
    
    <td class="total-price"><span><span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">R$</span>&nbsp;85,89</span></span></td>
    
    </tr>
    
    </tfoot>
    
    </table>
    
    </div><!-- .order-items -->
    
    <div class="order-notes">
    
    </div><!-- .order-notes -->
    
    <div class="order-thanks">
    
    </div><!-- .order-thanks -->
    
    <div class="order-colophon">
    
    <div class="colophon-policies">
    
    </div>
    
    <div class="colophon-imprint">
    
    <p>www.pizzavenus.com.br</p>
    
    </div>
    
    </div><!-- .order-colophon -->
    
    </article><!-- .content -->
    
    </div><!-- #page -->
    
    </div><!-- #container -->
    
    <script data-cfasync="false" src="/cdn-cgi/scripts/5c5dd728/cloudflare-static/email-decode.min.js"></script></body>
    
    </html>

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 22 total)
  • Plugin Author EvelynWaugh

    (@wsjrcatarri)

    Hi @dannwagner, sorry I dont quite understand. Do you use any extra plugins for printing invoice? Share it please.

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    Is that right! The invoices are printed with this plugin: https://www.ads-software.com/plugins/woocommerce-delivery-notes/

    Plugin Author EvelynWaugh

    (@wsjrcatarri)

    Next release will try to make it compatible with that plugin.

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    That would be great! In mean time, could you just try to help me with a function which I can add to the functions.php, like as following, please:

    I’m not sure about what fields I need to show to just out the flavours choosen. I try to do like as bellow, but is not working:

    function flavours-print() {

    ?>

    <style>

    display-meta .order-pizza-meta-list,

    display: yes;
    }
    </style>

    I’m a very cheap web designer lol and need to guarentee my contract with the client, which is very demanding about this function, since with several invoices, he have to check and write it manually. Would be great if you could help me! The site is that: https://www.pizzavenus.com.br/loja

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    Could you help me, please?

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    ?

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    dearest friend I just need the name of the filed which contains de flavours choosed by the customer, and will try to make a new function, ok? can you just tell which it is, please? thank a lot!

    Plugin Author EvelynWaugh

    (@wsjrcatarri)

    Hi, I dont know if that works for you, but you can try display_meta_thankyou_main($item_id, $item, $order) from includes/pizza-checkout.php

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    Thanks for respondind! Can you specify better which filed contains the EXTRA COMPONENTS, please?

    Plugin Author EvelynWaugh

    (@wsjrcatarri)

    Ok try then display_meta_thankyou_extra($item_id, $item, $order) from includes/pizza-checkout.php

    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    Could you adapt this function bellow with this variable/field, please? I tryied several times with chat gpt but it never works… this function bellow does exacly the same, call a variable and shows at the print invoice…

    function example_custom_order_fields( $fields, $order ) {
    $new_fields = array();

    if( get_post_meta( $order->id, 'billing_order-info', true ) ) {
        $new_fields['billing_order-info'] = array(
            'label' => 'ID:',
            'value' => get_post_meta( $order->id, 'billing_order-info', true )
        );
    }
    
    
    return array_merge( $fields, $new_fields );

    }
    add_filter( ‘wcdn_order_info_fields’, ‘example_custom_order_fields’, 10, 2 );

    Plugin Author EvelynWaugh

    (@wsjrcatarri)

    Try this:

    	add_filter( 'wcdn_order_info_fields', 'example_custom_order_fields', 10, 2 );
    function example_custom_order_fields( $fields, $order ) {
    $new_fields = array();

    $order_items = $order->get_items(array('line_item'));

    foreach($order_items as $item_id => $item) {

    $pizza_product = get_post_meta( $item->get_data()['product_id'], '_ev_pizza', true ) === 'yes' ? true : false;
    if ( ! $pizza_product ) continue;

    $item_data = $item->get_meta_data();

    $index = 0;
    foreach ( $item_data as $meta ) {

    if ( $meta->key !== '_ev_pizza_config' ) {
    continue;
    }
    if ( ! isset( $meta->value['extra']['components'] ) ) {
    continue;
    }
    $index++ ;

    $new_fields['ev_component' .$index ] = array(
    'label' => $meta->key,
    'value' => $meta->value,
    );
    }


    }
    return array_merge( $fields, $new_fields );
    }
    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    This is the original function, man, plus some adjustment chat-gpt did. It is running at https://www.pizzavenus.com.br/loja – already sended to you the wp access to see it at code snippets (trechos de código plugin) – is the newest code there. It is not working yet, but I think must be few details about…

    add_filter( ‘wcdn_order_info_fields’, ‘custom_order_fields_example’, 10, 2 );

    function custom_order_fields_example( $fields, $order ) {
    $new_fields = array();

    $order_items = $order->get_items(array('line_item'));
    error_log('Order items: ' . print_r($order_items, true));
    
    foreach ( $order_items as $item_id => $item ) {
        $pizza_product = get_post_meta( $item->get_data()['product_id'], '_ev_pizza', true ) === 'yes' ? true : false;
        error_log('Pizza product: ' . $pizza_product);
        if ( ! $pizza_product ) continue;
    
        $item_data = $item->get_meta_data();
        error_log('Item data: ' . print_r($item_data, true));
    
        $index = 0;
        foreach ( $item_data as $meta ) {
            if ( $meta->key !== '_ev_pizza_config' ) {
                continue;
            }
            if ( ! isset( $meta->value['extra']['components'] ) ) {
                continue;
            }
            $index++;
    
            $new_fields['ev_component' . $index ] = array( 
                'label' => $meta->key,
                'value' => $meta->value,
            );
            error_log('New field added: ' . print_r($new_fields['ev_component' . $index], true));
        }
    }
    return array_merge( $fields, $new_fields );

    }

    Plugin Author EvelynWaugh

    (@wsjrcatarri)

    Try this:

    add_filter( 'wcdn_order_item_fields', 'example_wcdn_order_item_fields', 10, 4 );
    function example_wcdn_order_item_fields( $fields, $product, $order, $item ) {

    $pizza_product = get_post_meta( $product->get_id(), '_ev_pizza', true ) === 'yes' ? true : false;
    if ( ! $pizza_product ) {
    return $fields;
    }

    $item_data = $item->get_meta_data();

    $index = 0;
    foreach ( $item_data as $meta ) {

    if ( $meta->key !== '_ev_pizza_config' ) continue;

    if ( ! isset( $meta->value['extra']['components'] ) ) continue;

    $index++ ;

    $fields['ev_component' .$index ] = array(
    'label' => $meta->key,
    'value' => $meta->value,
    );
    }

    return $fields;
    }
    • This reply was modified 2 months, 4 weeks ago by EvelynWaugh.
    Thread Starter Daniel Godoi Wagner

    (@dannwagner)

    Hi there @wsjrcatarri ! Thanks a lot again. The function is running, but the data isnt showing up at the print invoice yet. I’ve sended the wp admin password by e-mail recently, the funcionation is the number 02 at the code snippets plugin (trechos de código in portuguese). Can you check it out, please? Excuse me by bothering you, man! Thanks a lot!

Viewing 15 replies - 1 through 15 (of 22 total)
  • You must be logged in to reply to this topic.