/** * Get the order info fields */ function wcdn_get_order_info($order) { global $wcdn; $fields = array(); $create_invoice_number = get_option(WooCommerce_Delivery_Notes::$plugin_prefix . 'create_invoice_number'); if (wcdn_get_template_type() == 'invoice' && !empty($create_invoice_number)) { $fields['invoice_number'] = array('label' => __('Invoice Number', 'woocommerce-delivery-notes'), 'value' => wcdn_get_order_invoice_number($order->id)); } $fields['order_number'] = array('label' => __('Order Number', 'woocommerce-delivery-notes'), 'value' => $order->get_order_number()); $fields['order_date'] = array('label' => __('Order Date', 'woocommerce-delivery-notes'), 'value' => date_i18n(get_option('date_format'), strtotime($order->order_date))); $fields['payment_method'] = array('label' => __('Payment Method', 'woocommerce-delivery-notes'), 'value' => __($order->payment_method_title, 'woocommerce')); if ($order->billing_email) { $fields['billing_email'] = array('label' => __('Email', 'woocommerce-delivery-notes'), 'value' => $order->billing_email); } if ($order->billing_phone) { $fields['billing_phone'] = array('label' => __('Telephone', 'woocommerce-delivery-notes'), 'value' => $order->billing_phone); } return $fields; }
function wcdn_template_title() { if (wcdn_get_template_type() == 'invoice') { echo apply_filters('wcdn_template_title', __('Invoice', 'woocommerce-delivery-notes')); } else { echo apply_filters('wcdn_template_title', __('Delivery Note', 'woocommerce-delivery-notes')); } }
if ($orders = wcdn_get_orders()) { ?> <?php // wcdn_before_loop hook do_action('wcdn_before_loop'); ?> <?php foreach ($orders as $order) { ?> <article class="content"> <?php do_action('wcdn_loop_content', $order, wcdn_get_template_type()); ?> </article><!-- .content --> <?php } ?> <?php // wcdn_after_loop hook do_action('wcdn_after_loop'); ?> <?php }
<!DOCTYPE html> <html class="<?php echo wcdn_get_template_type(); ?> "> <head> <meta charset="utf-8"> <title><?php wcdn_template_title(); ?> </title> <?php wcdn_head(); ?> <link rel="stylesheet" href="<?php wcdn_stylesheet_url('style.css'); ?> " type="text/css" media="screen,print" /> <style type = 'text/css'> /* Simple CSS Reset and Print options ------------------------------------------*/ html, body, div, span, h1, h2, h3, h4, h5, h6, p, a, table, ol, ul, dl, li, dt, dd { border: 0 none; font: inherit; margin: 0; padding: 0; vertical-align: baseline;
</div> <div class="company-address"><?php wcdn_company_info(); ?> </div> </div> </div><!-- #letter-header --> <div id="order-listing"> <h3><?php _e('Recipient', 'woocommerce-delivery-notes'); ?> </h3> <div class="shipping-info"> <?php if (wcdn_get_template_type() == 'invoice') { ?> <?php wcdn_billing_address(); ?> <?php } else { ?> <?php wcdn_shipping_address(); ?> <?php } ?> </div><!-- .shipping-info --> </div><!-- #order-listing -->