• Resolved arnone

    (@arnone)


    Hi,
    I use the e-commerce wordpress script woocommerce and I would like that the Gaugepress label value is the same that my e-shop total order report.

    Woocommerce script use fonctions for displaying the total order number in the admin dashboard.

    Do you think is it possible to export the total order woocommerce report for import it in the gaugepresse label value ?

    This is the woocommerce fonction and script for the admin report display :

    /**
     * Output the sales overview chart.
     *
     * @access public
     * @return void
     */
    function woocommerce_sales_overview() {
    	global $start_date, $end_date, $woocommerce, $wpdb, $wp_locale;
    
    	$total_sales = $total_orders = $order_items = $discount_total = $shipping_total = 0;
    $order_totals = apply_filters( 'woocommerce_reports_sales_overview_order_totals', $wpdb->get_row( "
    		SELECT SUM(meta.meta_value) AS total_sales, COUNT(posts.ID) AS total_orders FROM {$wpdb->posts} AS posts
    
    		LEFT JOIN {$wpdb->postmeta} AS meta ON posts.ID = meta.post_id
    		LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID=rel.object_ID
    		LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
    		LEFT JOIN {$wpdb->terms} AS term USING( term_id )
    
    		WHERE 	meta.meta_key 		= '_order_total'
    		AND 	posts.post_type 	= 'shop_order'
    		AND 	posts.post_status 	= 'publish'
    		AND 	tax.taxonomy		= 'shop_order_status'
    		AND		term.slug			IN ('" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "')
    	" ) );
    
    	$total_sales 	= $order_totals->total_sales;
    	$total_orders 	= absint( $order_totals->total_orders );
    <div class="postbox">
    				<h3><span><?php _e( 'Total orders', 'woocommerce' ); ?></span></h3>
    				<div class="inside">
    					<p class="stat"><?php if ( $total_orders > 0 ) echo $total_orders . ' (' . $order_items . ' ' . __( 'items', 'woocommerce' ) . ')'; else _e( 'n/a', 'woocommerce' ); ?></p>
    				</div>
    			</div>

    Sorry for my English language, I’m french.
    Thank you for your help !

    https://www.ads-software.com/plugins/gaugepress/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter arnone

    (@arnone)

    Ok, I’ve just add this code and everything is ok now ?? :

    Global $wpdb;
    		$value = apply_filters( 'woocommerce_reports_sales_overview_order_items', absint( $wpdb->get_var( "
    		SELECT SUM( order_item_meta.meta_value )
    		FROM {$wpdb->prefix}woocommerce_order_items as order_items
    		LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id
    		LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID
    		LEFT JOIN {$wpdb->term_relationships} AS rel ON posts.ID = rel.object_ID
    		LEFT JOIN {$wpdb->term_taxonomy} AS tax USING( term_taxonomy_id )
    		LEFT JOIN {$wpdb->terms} AS term USING( term_id )
    		WHERE 	term.slug IN ('" . implode( "','", apply_filters( 'woocommerce_reports_order_statuses', array( 'completed', 'processing', 'on-hold' ) ) ) . "')
    		AND 	posts.post_status 	= 'publish'
    		AND 	tax.taxonomy		= 'shop_order_status'
    		AND 	order_items.order_item_type = 'line_item'
    		AND 	order_item_meta.meta_key = '_qty'
    	" ) ) );
    Plugin Author Konstantinos Kouratoras

    (@kouratoras)

    Glad to hear that you solved it!

    Thread Starter arnone

    (@arnone)

    Thank you ! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Gaugepres Label value and Woocommerce report’ is closed to new replies.