Plugin Directory

Changeset 808756


Ignore:
Timestamp:
11/22/2013 10:21:46 AM (12 years ago)
Author:
CoenJacobs
Message:

Version 1.0 bumpage

Location:
woocommerce-piwik-integration
Files:
9 added
2 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-piwik-integration/trunk/readme.txt

    r714309 r808756  
    55Requires at least: 3.5
    66Tested up to: 3.5
    7 Stable tag: 0.1.1
     7Stable tag: 1.0
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    1515This plugin integrates your WooCommerce store with the [WP-Piwik plugin](http://wordpress.org/extend/plugins/wp-piwik/) plugin, providing support for tracking your checkout process through Piwik. Please note that you need your own Piwik installation for this plugin (and WP-Piwik) to function, look at the [Piwik website](http://piwik.org/) to get more information.
    1616
    17 Starting WooCommerce 2.1, this integration will no longer be part of WooCommerce and will only be available by using this plugin.
     17Starting WooCommerce 2.1, this integration will no longer be part of WooCommerce and will only be available by using this plugin. More information about this in the [FAQ](http://wordpress.org/extend/plugins/woocommerce-piwik-integration/faq/).
    1818
    1919Contributions are welcome via the [GitHub repository](https://github.com/coenjacobs/wc-piwik-integration).
     
    3131= Where can I find the setting for this plugin? =
    3232
    33 This plugin has no settings. It just integrates WooCommerce with your own Piwik install and the WP-Piwik plugin.
     33This plugin has no settings. It just integrates WooCommerce with your own [Piwik](http://piwik.org/) install and the [WP-Piwik plugin](http://wordpress.org/extend/plugins/wp-piwik/).
     34
     35= Why does this plugin say it is doing nothing? =
     36
     37Starting the WooCommerce 2.1 release, the Piwik integration for WooCommerce is no longer part of the WooCommerce plugin.
     38
     39Until you've updated to WooCommerce 2.1, this plugin puts itself in some sort of hibernate mode.
     40
     41You can leave this plugin activated and it will seamlessly take over the integration that once was in the WooCommerce plugin, once you update to the next version.
    3442
    3543== Changelog ==
     44
     45= 1.0 - 22/11/2013 =
     46 * Feature: Plugin checks for required WooCommerce version or doesn't do anything
     47 * Tweak: Split up logic and output into classes, powered by a lean bootstrap script
    3648
    3749= 0.1.1 - 17/05/2013 =
  • woocommerce-piwik-integration/trunk/wc-piwik-integration.php

    r714309 r808756  
    66Author: Coen Jacobs
    77Author URI: http://coenjacobs.me
    8 Version: 0.1.1
     8Version: 1.0
    99*/
    1010
    11 if ( ! function_exists( 'woocommerce_ecommerce_tracking_piwik' ) ) {
    12     add_action( 'woocommerce_thankyou', 'wcpiwik_ecommerce_tracking_piwik' );
     11define( 'WC_PIWIK_PLUGIN_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
    1312
    14     function wcpiwik_ecommerce_tracking_piwik( $order_id ) {
    15         global $woocommerce;
     13include( 'classes/class-wc-piwik-integration.php' );
    1614
    17         // Don't track admin
    18         if ( current_user_can('manage_options') )
    19             return;
    20 
    21         // Call the Piwik ecommerce function if WP-Piwik is configured to add tracking codes to the page
    22         $wp_piwik_global_settings = get_option( 'wp-piwik_global-settings' );
    23 
    24         // Return if Piwik settings are not here, or if global is not set
    25         if ( ! isset( $wp_piwik_global_settings['add_tracking_code'] ) || ! $wp_piwik_global_settings['add_tracking_code'] )
    26             return;
    27         if ( ! isset( $GLOBALS['wp_piwik'] ) )
    28             return;
    29 
    30         // Get the order and get tracking code
    31         $order = new WC_Order( $order_id );
    32         ob_start();
    33         ?>
    34         try {
    35             // Add order items
    36             <?php if ( $order->get_items() ) foreach( $order->get_items() as $item ) : $_product = $order->get_product_from_item( $item ); ?>
    37 
    38                 piwikTracker.addEcommerceItem(
    39                     "<?php echo esc_js( $_product->get_sku() ); ?>",            // (required) SKU: Product unique identifier
    40                     "<?php echo esc_js( $item['name'] ); ?>",                   // (optional) Product name
    41                     "<?php
    42                         if ( isset( $_product->variation_data ) )
    43                             echo esc_js( woocommerce_get_formatted_variation( $_product->variation_data, true ) );
    44                     ?>",    // (optional) Product category. You can also specify an array of up to 5 categories eg. ["Books", "New releases", "Biography"]
    45                     <?php echo esc_js( $order->get_item_total( $item ) ); ?>,   // (recommended) Product price
    46                     <?php echo esc_js( $item['qty'] ); ?>                       // (optional, default to 1) Product quantity
    47                 );
    48 
    49             <?php endforeach; ?>
    50 
    51             // Track order
    52             piwikTracker.trackEcommerceOrder(
    53                 "<?php echo esc_js( $order->get_order_number() ); ?>",  // (required) Unique Order ID
    54                 <?php echo esc_js( $order->get_total() ); ?>,           // (required) Order Revenue grand total (includes tax, shipping, and subtracted discount)
    55                 false,                                                  // (optional) Order sub total (excludes shipping)
    56                 <?php echo esc_js( $order->get_total_tax() ); ?>,       // (optional) Tax amount
    57                 <?php echo esc_js( $order->get_shipping() ); ?>,        // (optional) Shipping amount
    58                 false                                                   // (optional) Discount offered (set to false for unspecified parameter)
    59             );
    60         } catch( err ) {}
    61         <?php
    62         $code = ob_get_clean();
    63         $woocommerce->add_inline_js( $code );
    64     }
    65 }
     15global $wc_piwik_integration;
     16$wc_piwik_integration = new WC_Piwik_Integration();
Note: See TracChangeset for help on using the changeset viewer.