WooCommerce Print Invoice & Delivery Note
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  • Hook Reference
  • Docs Home

Packages

  • None
  • WooCommerce-Delivery-Notes
    • Admin
      • Edit-Order
    • Includes
    • Settings
    • Theme

Classes

  • WCDN_Welcome
  • WooCommerce_Delivery_Notes
  • WooCommerce_Delivery_Notes_Print
  • WooCommerce_Delivery_Notes_Settings
  • WooCommerce_Delivery_Notes_Theme
  • WooCommerce_Delivery_Notes_Writepanel

Functions

  • WCDN
  • wcdn_add_refunded_order_totals
  • wcdn_additional_product_fields
  • wcdn_company_info
  • wcdn_company_logo
  • wcdn_company_name
  • wcdn_content
  • wcdn_customer_notes
  • wcdn_document_title
  • wcdn_get_company_logo_id
  • wcdn_get_customer_notes
  • wcdn_get_formatted_item_price
  • wcdn_get_imprint
  • wcdn_get_order
  • wcdn_get_order_info
  • wcdn_get_order_invoice_date
  • wcdn_get_order_invoice_number
  • wcdn_get_orders
  • wcdn_get_personal_notes
  • wcdn_get_policies_conditions
  • wcdn_get_print_link
  • wcdn_get_template_content
  • wcdn_get_template_title
  • wcdn_get_template_type
  • wcdn_has_customer_notes
  • wcdn_has_refund
  • wcdn_has_shipping_address
  • wcdn_imprint
  • wcdn_navigation
  • wcdn_navigation_style
  • wcdn_personal_notes
  • wcdn_policies_conditions
  • wcdn_remove_payment_method_from_totals
  • wcdn_remove_semicolon_from_totals
  • wcdn_template_stylesheet
  1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45  46  47  48  49  50  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  76  77  78  79  80  81  82  83  84  85  86  87  88  89  90  91  92  93  94  95  96  97  98  99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 
<?php 
/**
 * WooCommerce Print Invoice & Delivery Note Welcome Page Class
 *
 * Displays on plugin activation
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * WCDN_Welcome Class
 *
 * A general class for About page.
 *
 * @since 4.4
 */
class WCDN_Welcome {

    /**
     * @var string The capability users should have to view the page
     */
    public $minimum_capability = 'manage_options';

    /**
     * Get things started
     *
     * @since 4.4
     */
    public function __construct() {

        add_action( 'admin_menu', array( $this, 'wcdn_admin_menus' ) );
        add_action( 'admin_head', array( $this, 'wcdn_admin_head' ) );

        if ( !isset( $_GET[ 'page' ] ) || 
            ( isset( $_GET[ 'page' ] ) && $_GET[ 'page' ] != 'wcdn-about' ) ) {
            add_action( 'admin_init', array( $this, 'wcdn_welcome' ) );
        }
    }

    /**
     * Register the Dashboard Page which is later hidden but this pages
     * is used to render the Welcome page.
     *
     * @access public
     * @since  4.4
     * @return void
     */
    public function wcdn_admin_menus() {
        // About Page
        add_dashboard_page(
            sprintf( esc_html__( 'Welcome to WooCommerce Print Invoice & Delivery Note %s', 'woocommerce-delivery-notes' ), WooCommerce_Delivery_Notes::$plugin_version ),
            esc_html__( 'Welcome to WooCommerce Print Invoice & Delivery Note', 'woocommerce-delivery-notes' ),
            $this->minimum_capability,
            'wcdn-about',
            array( $this, 'wcdn_about_screen' )
        );
    }

    /**
     * Hide Individual Dashboard Pages
     *
     * @access public
     * @since  4.4
     * @return void
     */
    public function wcdn_admin_head() {
        remove_submenu_page( 'index.php', 'wcdn-about' );
    }

    /**
     * Render About Screen
     *
     * @access public
     * @since  4.4
     * @return void
     */
    public function wcdn_about_screen() {
        $display_version = WooCommerce_Delivery_Notes::$plugin_version;
        // Badge for welcome page
        $badge_url = WooCommerce_Delivery_Notes::$plugin_url . 'assets/images/icon-256x256.png';
        $wcdn_plugin_url = WooCommerce_Delivery_Notes::$plugin_url;     
        ?>
        <style>
            .feature-section .feature-section-item {
                float:left;
                width:48%;
            }
        </style>
        <div class="wrap about-wrap">

            <?php $this->wcdn_get_welcome_header() ?>

            <div style="float:left;width: 80%;">
            <p class="about-text" style="margin-right:20px;"><?php
                printf(
                    __( "Thank you for activating or updating to the latest version of WooCommerce Print Invoice & Delivery Note! If you're a first time user, welcome! You're well on your way to explore the print functionality for your WooCommerce orders." )
                );
                ?></p>
            </div>
            <div class="wcdn-badge"><img src="<?php echo $badge_url; ?>" style="width:150px;"/></div>

            <p>&nbsp;</p>

            <div class="feature-section clearfix introduction">

                <h3><?php esc_html_e( "Get Started with WooCommerce Print Invoice & Delivery Note", 'woocommerce-delivery-notes' ); ?></h3>

                <div class="video feature-section-item" style="float:left;padding-right:10px;">
                    <img src="<?php echo $wcdn_plugin_url . '/assets/images/wcdn-settings.png' ?>"
                         alt="<?php esc_attr_e( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-delivery-notes' ); ?>" style="width:600px;">
                </div>

                <div class="content feature-section last-feature">
                    <h3><?php esc_html_e( 'Add settings', 'woocommerce-delivery-notes' ); ?></h3>

                    <p><?php esc_html_e( 'To enable the print functionality for your invoices, delivery notes & receipts, you just need to set it up under WooCommerce -> Settings -> Print page. Here you can also setup the Company Logo that will appear on the printed items, Company Address & other information.', 'woocommerce-delivery-notes' ); ?></p>
                    <a href="admin.php?page=wc-settings&tab=wcdn-settings" target="_blank" class="button-secondary">
                        <?php esc_html_e( 'Click Here to go to Print page', 'woocommerce-delivery-notes' ); ?>
                        <span class="dashicons dashicons-external"></span>
                    </a>
                </div>
            </div>

            <div class="content">

                <div class="feature-section clearfix">
                    <div class="content feature-section-item">

                        <h3><?php esc_html_e( 'Enable Print button for Customers.', 'woocommerce-delivery-notes' ); ?></h3>

                            <p><?php esc_html_e( 'Allow customers to print the WooCommerce order invoice from the customer notification email, from the My Account page or from the View Order page under My Account.', 'woocommerce-delivery-notes' ); ?></p>
                            <a href="admin.php?page=wc-settings&tab=wcdn-settings" target="_blank" class="button-secondary">
                                <?php esc_html_e( 'Click Here to Enable Print button for Customers', 'woocommerce-delivery-notes' ); ?>
                                <span class="dashicons dashicons-external"></span>
                            </a>
                    </div>

                    <div class="content feature-section-item last-feature">
                        <img src="<?php echo $wcdn_plugin_url . 'assets/images/wcdn-email-myaccount.png'; ?>" alt="<?php esc_attr_e( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-delivery-notes' ); ?>" style="width:500px;">
                    </div>
                </div>

                <div class="feature-section clearfix introduction">
                    <div class="video feature-section-item" style="float:left;padding-right:10px;">
                        <img src="<?php echo $wcdn_plugin_url . 'assets/images/wcdn-invoice-numbering.png'; ?>" alt="<?php esc_attr_e( 'WooCommerce Print Invoice & Delivery Note', 'woocommerce-delivery-notes' ); ?>" style="width:500px;">
                    </div>

                    <div class="content feature-section-item last-feature">
                        <h3><?php esc_html_e( 'Enable Invoice Numbering', 'woocommerce-delivery-notes' ); ?></h3>

                        <p><?php esc_html_e( 'f you want to change the default invoice numbers & set some numbering scheme of your own, then you can set it here with a starting invoice number, a prefix & suffix. For example, you could set it as: TS/001/17-18.', 'woocommerce-delivery-notes' ); ?></p>
                        <a href="admin.php?page=wc-settings&tab=wcdn-settings" target="_blank" class="button-secondary">
                            <?php esc_html_e( 'Click Here to Enable Invoice Numbering', 'woocommerce-delivery-notes' ); ?>
                            <span class="dashicons dashicons-external"></span>
                        </a>
                    </div>
                </div>
            </div>

            <div class="feature-section clearfix">

                <div class="content feature-section-item">

                    <h3><?php esc_html_e( 'Getting to Know Tyche Softwares', 'woocommerce-delivery-notes' ); ?></h3>

                    <ul class="ul-disc">
                        <li><a href="https://tychesoftwares.com/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank"><?php esc_html_e( 'Visit the Tyche Softwares Website', 'woocommerce-delivery-notes' ); ?></a></li>
                        <li><a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank"><?php esc_html_e( 'View all Premium Plugins', 'woocommerce-delivery-notes' ); ?></a>
                        <ul class="ul-disc">
                            <li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-abandoned-cart-pro/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Abandoned Cart Pro Plugin for WooCommerce</a></li>
                            <li><a href="https://www.tychesoftwares.com/store/premium-plugins/woocommerce-booking-plugin/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Booking & Appointment Plugin for WooCommerce</a></li>
                            <li><a href="https://www.tychesoftwares.com/store/premium-plugins/order-delivery-date-for-woocommerce-pro-21/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Order Delivery Date for WooCommerce</a></li>
                            <li><a href="https://www.tychesoftwares.com/store/premium-plugins/product-delivery-date-pro-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Product Delivery Date for WooCommerce</a></li>
                            <li><a href="https://www.tychesoftwares.com/store/premium-plugins/deposits-for-woocommerce/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">Deposits for WooCommerce</a></li>
                        </ul>
                        </li>
                        <li><a href="https://tychesoftwares.com/about/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank"><?php esc_html_e( 'Meet the team', 'woocommerce-delivery-notes' ); ?></a></li>
                    </ul>
                </div>

                <div class="content feature-section-item">

                    <h3><?php esc_html_e( 'Current Offers', 'woocommerce-delivery-notes' ); ?></h3>

                    <p>Buy all our <a href="https://tychesoftwares.com/premium-plugins/?utm_source=wpaboutpage&utm_medium=link&utm_campaign=WCDeliveryNotes" target="_blank">premium plugins</a> at 30% off till 31st December 2017</p>
                </div>
            </div>            
            <!-- /.feature-section -->
        </div>
        <?php

        update_option( 'wcdn_welcome_page_shown', 'yes' );
        update_option( 'wcdn_welcome_page_shown_time', current_time( 'timestamp' ) );
    }


    /**
     * The header section for the welcome screen.
     *
     * @since 4.4
     */
    public function wcdn_get_welcome_header() {
        // Badge for welcome page
        $badge_url = WooCommerce_Delivery_Notes::$plugin_url . 'assets/images/icon-256x256.png';
        ?>
        <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1>
        <?php $this->wcdn_social_media_elements(); ?>

    <?php }


    /**
     * Social Media Like Buttons
     *
     * Various social media elements to Tyche Softwares
     * @since: 4.4
     */
    public function wcdn_social_media_elements() { ?>

        <div class="social-items-wrap">

            <iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Ftychesoftwares&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=220596284639969"
                    scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;"
                    allowTransparency="true"></iframe>

            <a href="https://twitter.com/tychesoftwares" class="twitter-follow-button" data-show-count="false"><?php
                printf(
                    esc_html_e( 'Follow %s', 'tychesoftwares' ),
                    '@tychesoftwares'
                );
                ?></a>
            <script>!function (d, s, id) {
                    var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https';
                    if (!d.getElementById(id)) {
                        js = d.createElement(s);
                        js.id = id;
                        js.src = p + '://platform.twitter.com/widgets.js';
                        fjs.parentNode.insertBefore(js, fjs);
                    }
                }(document, 'script', 'twitter-wjs');
            </script>

        </div>
        <!--/.social-items-wrap -->

        <?php
    }


    /**
     * Sends user to the Welcome page on first activation of WooCommerce Print Invoice & Delivery Note as well as each
     * time WooCommerce Print Invoice & Delivery Note is upgraded to a new version
     *
     * @access public
     * @since  4.4
     *
     * @return void
     */
    public function wcdn_welcome() {

        // Bail if activating from network, or bulk
        if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
            return;
        }

        if( !get_option( 'wcdn_welcome_page_shown' ) ) {
            wp_safe_redirect( admin_url( 'index.php?page=wcdn-about' ) );
            exit;
        }
    }

}

new WCDN_Welcome();
WooCommerce Print Invoice & Delivery Note API documentation generated by ApiGen