Plugin Directory

Changeset 1977618


Ignore:
Timestamp:
11/20/2018 07:10:26 PM (7 years ago)
Author:
storespot
Message:

v.1.0.9

Location:
storespot
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • storespot/tags/1.0.9/admin/class-storespot-productfeed.php

    r1969746 r1977618  
    107107            if ( function_exists( 'wc_get_products' ) ) {
    108108                $args = array(
    109                     'status' => 'publish',
    110109                    'status'  => array( 'publish' ),
    111110                    'type'    => array( 'simple', 'variable', 'bundle', 'composite' ),
  • storespot/tags/1.0.9/includes/class-storespot-deactivator.php

    r1939129 r1977618  
    33    public static function deactivate() {
    44        wp_clear_scheduled_hook( 'stsp_product_feed_update' );
     5        delete_option( 'storespot_settings' );
    56    }
    67}
  • storespot/tags/1.0.9/includes/class-storespot.php

    r1969706 r1977618  
    7878            $this->loader->add_action( 'wp_head', $plugin_public, 'render_facebook_pixel_noscript' );
    7979            $this->loader->add_action( 'woocommerce_after_single_product', $plugin_public, 'render_product_view_event');
     80            $this->loader->add_action( 'woocommerce_after_shop_loop', $plugin_public, 'render_category_view_event');
    8081            $this->loader->add_action( 'pre_get_posts', $plugin_public, 'render_search_event' );
    8182            $this->loader->add_action( 'woocommerce_add_to_cart', $plugin_public, 'render_add_to_cart_event' );
  • storespot/tags/1.0.9/public/class-storespot-events.php

    r1957373 r1977618  
    1919        $product_id = $product->get_id();
    2020        $product_sku = $product->get_sku();
    21         return $product_sku ? $product_sku . '_' . $product_id : 'wc_post_id_' . $product_id;
     21        $sku_id = $product_sku . '_' . $product_id;
     22        $other_id = 'wc_post_id_' . $product_id;
     23
     24        $ids = array($other_id, $product_id);
     25        if ( $product_sku ) {
     26            $ids[] = $sku_id;
     27            $ids[] = $product_sku;
     28        }
     29
     30        return $ids;
    2231    }
    2332
     
    3847            return;
    3948        }
     49    }
     50
     51    public function render_category_view_event() {
     52        global $wp_query;
     53
     54        $products = array_values(array_map(function($item) {
     55        return wc_get_product($item->ID);
     56    }, $wp_query->posts));
     57
     58        $content_type = 'product';
     59    $product_ids = array();
     60    foreach ($products as $product) {
     61      if (!$product) { continue; }
     62      $product_ids = array_merge(
     63        $product_ids,
     64        $this->get_facebook_content_id($product)
     65            );
     66      if ($product->get_type() == 'variable') {
     67        $content_type = 'product_group';
     68      }
     69    }
     70
     71    $category_path = wp_get_post_terms( get_the_ID(), 'product_cat' );
     72        $content_category = array_values( array_map( function($item) {
     73            return $item->name;
     74        }, $category_path));
     75        $content_category_slice = array_slice($content_category, -1);
     76        $categories = empty( $content_category ) ? '""' : implode( ', ', $content_category );
     77        $categories = array(
     78            'name' => array_pop($content_category_slice),
     79            'categories' => $categories
     80        );
     81
     82        $params = array(
     83            'content_name'          => $categories['name'],
     84            'content_category'  => $categories['categories'],
     85            'content_ids'           => json_encode(array_slice($product_ids, 0, 10)),
     86            'content_type'          => $content_type
     87        );
     88
     89        $this->facebook_pixel->event_code(
     90            'ViewCategory',
     91            $params,
     92            'trackCustom'
     93        );
    4094    }
    4195
  • storespot/tags/1.0.9/readme.txt

    r1969706 r1977618  
    55Tested up to: 4.9
    66Requires PHP: 5.6
    7 Stable tag: 1.0.8
     7Stable tag: 1.0.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5050== Changelog ==
    5151
     52= 1.0.9 =
     53* Add category view to pixel data
     54* Remove options after plugin deactivation
     55
    5256= 1.0.8 =
    5357* Improve memory usage in feed generation
  • storespot/tags/1.0.9/storespot.php

    r1969706 r1977618  
    44 * Plugin URI:   https://storespot.io/
    55 * Description:  Stop leaving money on the table. Automate your retargeting ads with StoreSpot.
    6  * Version:      1.0.8
     6 * Version:      1.0.9
    77 * Author:       StoreSpot
    88**/
     
    1111if ( ! defined( 'WPINC' ) ) { die; }
    1212
    13 define( 'STORESPOT_VERSION', '1.0.8' );
     13define( 'STORESPOT_VERSION', '1.0.9' );
    1414
    1515function activate_storespot() {
  • storespot/trunk/admin/class-storespot-productfeed.php

    r1969746 r1977618  
    107107            if ( function_exists( 'wc_get_products' ) ) {
    108108                $args = array(
    109                     'status' => 'publish',
    110109                    'status'  => array( 'publish' ),
    111110                    'type'    => array( 'simple', 'variable', 'bundle', 'composite' ),
  • storespot/trunk/includes/class-storespot-deactivator.php

    r1939129 r1977618  
    33    public static function deactivate() {
    44        wp_clear_scheduled_hook( 'stsp_product_feed_update' );
     5        delete_option( 'storespot_settings' );
    56    }
    67}
  • storespot/trunk/includes/class-storespot.php

    r1969706 r1977618  
    7878            $this->loader->add_action( 'wp_head', $plugin_public, 'render_facebook_pixel_noscript' );
    7979            $this->loader->add_action( 'woocommerce_after_single_product', $plugin_public, 'render_product_view_event');
     80            $this->loader->add_action( 'woocommerce_after_shop_loop', $plugin_public, 'render_category_view_event');
    8081            $this->loader->add_action( 'pre_get_posts', $plugin_public, 'render_search_event' );
    8182            $this->loader->add_action( 'woocommerce_add_to_cart', $plugin_public, 'render_add_to_cart_event' );
  • storespot/trunk/public/class-storespot-events.php

    r1957373 r1977618  
    1919        $product_id = $product->get_id();
    2020        $product_sku = $product->get_sku();
    21         return $product_sku ? $product_sku . '_' . $product_id : 'wc_post_id_' . $product_id;
     21        $sku_id = $product_sku . '_' . $product_id;
     22        $other_id = 'wc_post_id_' . $product_id;
     23
     24        $ids = array($other_id, $product_id);
     25        if ( $product_sku ) {
     26            $ids[] = $sku_id;
     27            $ids[] = $product_sku;
     28        }
     29
     30        return $ids;
    2231    }
    2332
     
    3847            return;
    3948        }
     49    }
     50
     51    public function render_category_view_event() {
     52        global $wp_query;
     53
     54        $products = array_values(array_map(function($item) {
     55        return wc_get_product($item->ID);
     56    }, $wp_query->posts));
     57
     58        $content_type = 'product';
     59    $product_ids = array();
     60    foreach ($products as $product) {
     61      if (!$product) { continue; }
     62      $product_ids = array_merge(
     63        $product_ids,
     64        $this->get_facebook_content_id($product)
     65            );
     66      if ($product->get_type() == 'variable') {
     67        $content_type = 'product_group';
     68      }
     69    }
     70
     71    $category_path = wp_get_post_terms( get_the_ID(), 'product_cat' );
     72        $content_category = array_values( array_map( function($item) {
     73            return $item->name;
     74        }, $category_path));
     75        $content_category_slice = array_slice($content_category, -1);
     76        $categories = empty( $content_category ) ? '""' : implode( ', ', $content_category );
     77        $categories = array(
     78            'name' => array_pop($content_category_slice),
     79            'categories' => $categories
     80        );
     81
     82        $params = array(
     83            'content_name'          => $categories['name'],
     84            'content_category'  => $categories['categories'],
     85            'content_ids'           => json_encode(array_slice($product_ids, 0, 10)),
     86            'content_type'          => $content_type
     87        );
     88
     89        $this->facebook_pixel->event_code(
     90            'ViewCategory',
     91            $params,
     92            'trackCustom'
     93        );
    4094    }
    4195
  • storespot/trunk/readme.txt

    r1969706 r1977618  
    55Tested up to: 4.9
    66Requires PHP: 5.6
    7 Stable tag: 1.0.8
     7Stable tag: 1.0.9
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5050== Changelog ==
    5151
     52= 1.0.9 =
     53* Add category view to pixel data
     54* Remove options after plugin deactivation
     55
    5256= 1.0.8 =
    5357* Improve memory usage in feed generation
  • storespot/trunk/storespot.php

    r1969706 r1977618  
    44 * Plugin URI:   https://storespot.io/
    55 * Description:  Stop leaving money on the table. Automate your retargeting ads with StoreSpot.
    6  * Version:      1.0.8
     6 * Version:      1.0.9
    77 * Author:       StoreSpot
    88**/
     
    1111if ( ! defined( 'WPINC' ) ) { die; }
    1212
    13 define( 'STORESPOT_VERSION', '1.0.8' );
     13define( 'STORESPOT_VERSION', '1.0.9' );
    1414
    1515function activate_storespot() {
Note: See TracChangeset for help on using the changeset viewer.