Plugin Directory

Changeset 2289067


Ignore:
Timestamp:
04/22/2020 08:38:01 AM (6 years ago)
Author:
sizeme
Message:

Fix ajax-based add to cart tracking

Location:
sizeme-for-woocommerce
Files:
2 edited
5 copied

Legend:

Unmodified
Added
Removed
  • sizeme-for-woocommerce/tags/2.1.1/readme.txt

    r2257567 r2289067  
    33Tags: sizeme, measurements, size guide, size recommendations
    44Requires at least: 3.8
    5 Tested up to: 5.3.2
    6 Stable tag: 2.1.0
     5Tested up to: 5.4
     6Stable tag: 2.1.1
    77Requires PHP: 5.2.4
    88WC requires at least: 2.5
    9 WC tested up to: 3.9.3
     9WC tested up to: 4.0.1
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    80802. Offer a true-to-product size guide
    81813. For size recommendations, we ask for physical measurements of the users and offer proper measuring instructions for this
    82 4. Visualize the fit using the SizeMe Sizing Bar™ and easy-to-understand illustrations 
     824. Visualize the fit using the SizeMe Sizing Bar™ and easy-to-understand illustrations
    8383
    8484== Changelog ==
     85
     86= 2.1.1 =
     87* Fixed tracking of ajax-based add to cart events.  Also improved SKU handling with simple products.
    8588
    8689= 2.1.0 =
  • sizeme-for-woocommerce/tags/2.1.1/sizeme-for-woocommerce.php

    r2257567 r2289067  
    1010 * Plugin Name: SizeMe for WooCommerce
    1111 * Description: SizeMe is a web store plugin that enables your consumers to input their measurements and get personalised fit recommendations based on actual product data.
    12  * Version:     2.1.0
     12 * Version:     2.1.1
    1313 * Author:      SizeMe Ltd
    1414 * Author URI:  https://www.sizeme.com/
     
    5151     * @var string VERSION The plugin version.
    5252     */
    53     const VERSION = '2.1.0';
     53    const VERSION = '2.1.1';
    5454
    5555    /**
     
    591591    public function send_add_to_cart_info($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data)
    592592    {
    593         $parent_product = New WC_Product( $product_id );
    594         $child_product = New WC_Product_Variation( $variation_id );
     593        $parent_product = New WC_Product( absint($product_id) );
     594        $child_product = New WC_Product_Variation( absint($variation_id) );
     595
     596        if ($variation_id > 0) {
     597            $SKU = ($child_product->get_sku() ? $child_product->get_sku() : substr($this->get_client_key(), 0, 16).'-'.$variation_id);
     598        } else {
     599            $SKU = ($parent_product->get_sku() ? $parent_product->get_sku() : substr($this->get_client_key(), 0, 16).'-'.$product_id);
     600        }
    595601
    596602        $arr = array(
    597             'SKU' => ($child_product->get_sku() ? $child_product->get_sku() : substr($this->get_client_key(), 0, 16).'-'.$variation_id),
     603            'SKU' => (string)$SKU,
    598604            'quantity' => (int)$quantity,
    599605            'name' => $parent_product->get_name(),
     
    816822        add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_setting_page' ) );
    817823        add_action( 'admin_notices', array( $this, 'admin_notices' ) );
     824        // ajax based add to carts come this way
     825        if ( wp_doing_ajax() ) {
     826            add_action( 'woocommerce_add_to_cart', array( $this, 'send_add_to_cart_info' ), 10, 6 );
     827        }
    818828    }
    819829
  • sizeme-for-woocommerce/trunk/readme.txt

    r2257567 r2289067  
    33Tags: sizeme, measurements, size guide, size recommendations
    44Requires at least: 3.8
    5 Tested up to: 5.3.2
    6 Stable tag: 2.1.0
     5Tested up to: 5.4
     6Stable tag: 2.1.1
    77Requires PHP: 5.2.4
    88WC requires at least: 2.5
    9 WC tested up to: 3.9.3
     9WC tested up to: 4.0.1
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    80802. Offer a true-to-product size guide
    81813. For size recommendations, we ask for physical measurements of the users and offer proper measuring instructions for this
    82 4. Visualize the fit using the SizeMe Sizing Bar™ and easy-to-understand illustrations 
     824. Visualize the fit using the SizeMe Sizing Bar™ and easy-to-understand illustrations
    8383
    8484== Changelog ==
     85
     86= 2.1.1 =
     87* Fixed tracking of ajax-based add to cart events.  Also improved SKU handling with simple products.
    8588
    8689= 2.1.0 =
  • sizeme-for-woocommerce/trunk/sizeme-for-woocommerce.php

    r2257567 r2289067  
    1010 * Plugin Name: SizeMe for WooCommerce
    1111 * Description: SizeMe is a web store plugin that enables your consumers to input their measurements and get personalised fit recommendations based on actual product data.
    12  * Version:     2.1.0
     12 * Version:     2.1.1
    1313 * Author:      SizeMe Ltd
    1414 * Author URI:  https://www.sizeme.com/
     
    5151     * @var string VERSION The plugin version.
    5252     */
    53     const VERSION = '2.1.0';
     53    const VERSION = '2.1.1';
    5454
    5555    /**
     
    591591    public function send_add_to_cart_info($cart_item_key, $product_id, $quantity, $variation_id, $variation, $cart_item_data)
    592592    {
    593         $parent_product = New WC_Product( $product_id );
    594         $child_product = New WC_Product_Variation( $variation_id );
     593        $parent_product = New WC_Product( absint($product_id) );
     594        $child_product = New WC_Product_Variation( absint($variation_id) );
     595
     596        if ($variation_id > 0) {
     597            $SKU = ($child_product->get_sku() ? $child_product->get_sku() : substr($this->get_client_key(), 0, 16).'-'.$variation_id);
     598        } else {
     599            $SKU = ($parent_product->get_sku() ? $parent_product->get_sku() : substr($this->get_client_key(), 0, 16).'-'.$product_id);
     600        }
    595601
    596602        $arr = array(
    597             'SKU' => ($child_product->get_sku() ? $child_product->get_sku() : substr($this->get_client_key(), 0, 16).'-'.$variation_id),
     603            'SKU' => (string)$SKU,
    598604            'quantity' => (int)$quantity,
    599605            'name' => $parent_product->get_name(),
     
    816822        add_filter( 'woocommerce_get_settings_pages', array( $this, 'add_setting_page' ) );
    817823        add_action( 'admin_notices', array( $this, 'admin_notices' ) );
     824        // ajax based add to carts come this way
     825        if ( wp_doing_ajax() ) {
     826            add_action( 'woocommerce_add_to_cart', array( $this, 'send_add_to_cart_info' ), 10, 6 );
     827        }
    818828    }
    819829
Note: See TracChangeset for help on using the changeset viewer.