star-micronics / star-cloudprnt-for-woocommerce

Print to Star CloudPRNT compatible printers from WooCommerce
MIT License
10 stars 8 forks source link

How can i disable extra information from being printed #30

Open chetanhit opened 10 months ago

chetanhit commented 10 months ago

Hi, How can i disable extra information from being printed. I know there is an option to hide hidden fields on the plugin but when i choose this option it also hide pickup and delivery time on printout.

IMG-20240123-WA0009

gfrino commented 10 months ago

Fatal error: Uncaught TypeError: html_entity_decode(): Argument #1 ($string) must be of type string, array given in /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php:120 Stack trace: #0 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php(120): html_entity_decode() #1 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.php(158): star_cloudprnt_filter_html() #2 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.php(384): star_cloudprnt_print_additional_order_info() #3 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php(194): star_cloudprnt_print_order_summary() #4 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php(209): star_cloudprnt_trigger_print() #5 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(324): star_cloudprnt_reprint() #6 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #7 /var/www/webroot/ROOT/wp-includes/plugin.php(517): WP_Hook->do_action() #8 /var/www/webroot/ROOT/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php(173): do_action() #9 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(324): WC_Meta_Box_Order_Actions::save() #10 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #11 /var/www/webroot/ROOT/wp-includes/plugin.php(517): WP_Hook->do_action() #12 /var/www/webroot/ROOT/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php(263): do_action() #13 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(326): WC_Admin_Meta_Boxes->save_meta_boxes() #14 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #15 /var/www/webroot/ROOT/wp-includes/plugin.php(517): WP_Hook->do_action() #16 /var/www/webroot/ROOT/wp-includes/post.php(4760): do_action() #17 /var/www/webroot/ROOT/wp-includes/post.php(4862): wp_insert_post() #18 /var/www/webroot/ROOT/wp-admin/includes/post.php(453): wp_update_post() #19 /var/www/webroot/ROOT/wp-admin/post.php(227): edit_post() #20 {main} thrown in /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php on line 120

chetanhit commented 10 months ago

Fatal error: Uncaught TypeError: html_entity_decode(): Argument #1 ($string) must be of type string, array given in /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php:120 Stack trace: #0 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php(120): html_entity_decode() #1 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.php(158): star_cloudprnt_filter_html() #2 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.php(384): star_cloudprnt_print_additional_order_info() #3 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php(194): star_cloudprnt_print_order_summary() #4 /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php(209): star_cloudprnt_trigger_print() #5 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(324): star_cloudprnt_reprint() #6 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #7 /var/www/webroot/ROOT/wp-includes/plugin.php(517): WP_Hook->do_action() #8 /var/www/webroot/ROOT/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php(173): do_action() #9 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(324): WC_Meta_Box_Order_Actions::save() #10 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #11 /var/www/webroot/ROOT/wp-includes/plugin.php(517): WP_Hook->do_action() #12 /var/www/webroot/ROOT/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php(263): do_action() #13 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(326): WC_Admin_Meta_Boxes->save_meta_boxes() #14 /var/www/webroot/ROOT/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #15 /var/www/webroot/ROOT/wp-includes/plugin.php(517): WP_Hook->do_action() #16 /var/www/webroot/ROOT/wp-includes/post.php(4760): do_action() #17 /var/www/webroot/ROOT/wp-includes/post.php(4862): wp_insert_post() #18 /var/www/webroot/ROOT/wp-admin/includes/post.php(453): wp_update_post() #19 /var/www/webroot/ROOT/wp-admin/post.php(227): edit_post() #20 {main} thrown in /var/www/webroot/ROOT/wp-content/plugins/star-cloudprnt-for-woocommerce/order-handler.inc.php on line 120

Thankx for the reply... but I didn't understand... what is this?

kjarret commented 8 months ago

In order-handler.php, comment the following lines on star_cloudprnt_print_additional_order_info function:

    function star_cloudprnt_print_additional_order_info(&$printer, &$selectedPrinter, &$order, &$order_meta)
    {
        if(get_option('star-cloudprnt-print-order-meta-cb') != "on")
            return;

        $max_chars = $selectedPrinter['columns'];
        $meta_data = $order->get_meta_data();

        $is_printed = false;

        $print_hidden = get_option('star-cloudprnt-print-order-meta-hidden') == 'on';
        $excluded_keys = array_map('trim', explode(',', esc_attr(get_option('star-cloudprnt-print-order-meta-exclusions'))));

        foreach ($meta_data as $item_id => $meta_data_item)
        {
            $item_data = $meta_data_item->get_data();

            // Skip any keys in the exclusion list
            if(in_array($item_data["key"], $excluded_keys))
                continue;

            // Skip hidden fields (any field whose key begins with a "_", by convention)
            if(!$print_hidden && mb_substr($item_data["key"], 0, 1) == "_")
                continue;

/*          
            if(! $is_printed)
            {
                $is_printed = true;
                $printer->add_text_line("");
                $printer->set_text_emphasized();
                $printer->add_text_line("Additional Order Information");
                $printer->cancel_text_emphasized();
            }

            $formatted_key = $item_data["key"];
            if(get_option('star-cloudprnt-print-order-meta-reformat-keys') == 'on')
                $formatted_key = mb_convert_case(mb_ereg_replace("_", " ", $formatted_key), MB_CASE_TITLE);

            $printer->add_text_line(star_cloudprnt_filter_html($formatted_key) . ": " . star_cloudprnt_filter_html($item_data["value"]));
        }

        //if($is_printed)   $printer->add_text_line("");
    }
*/
        }
    }