Plugin Directory

Changeset 1271588


Ignore:
Timestamp:
10/23/2015 07:42:17 AM (10 years ago)
Author:
niravmehta
Message:

Changes for 1.7

Location:
klawoo-connector/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • klawoo-connector/trunk/classes/class.wc-klawoo.php

    r995297 r1271588  
    5656                add_action( 'wp_ajax_klawoo_validate_and_get_brands', array (&$this, 'validate_and_get_brands') );
    5757                add_action( 'wp_ajax_klawoo_sign_up', array (&$this, 'validate_and_get_brands') );
    58                 add_filter( 'wp_klawoo_bulk_subscribe_get_data', array( &$this, 'bulk_subscribe_get_data' ), 10, 2 );
    59             }
     58            }
     59           
     60            add_filter( 'wp_klawoo_bulk_subscribe_get_data', array( &$this, 'bulk_subscribe_get_data' ), 10, 2 );
    6061
    6162            $settings = get_option('wc_klawoo_credentials', null);
     
    768769//            =======================================           
    769770           
    770             $list_id_stored = array();
    771            
    772             $query_list_ids = "SELECT id, list_id FROM {$wpdb->prefix}wc_klawoo WHERE brand_id =". $this->brand_id;
    773             $result_list_ids = $wpdb->get_results( $query_list_ids, 'ARRAY_A' );
    774 
    775             foreach ($result_list_ids as $result_list_id) {
    776                 $list_id_stored [ $result_list_id ['id'] ] = $result_list_id ['list_id'];
    777             }
     771            // $list_id_stored = array();
     772           
     773            // $query_list_ids = "SELECT id, list_id FROM {$wpdb->prefix}wc_klawoo WHERE brand_id =". $this->brand_id;
     774            // $result_list_ids = $wpdb->get_results( $query_list_ids, 'ARRAY_A' );
     775
     776            // foreach ($result_list_ids as $result_list_id) {
     777            //     $list_id_stored [ $result_list_id ['id'] ] = $result_list_id ['list_id'];
     778            // }
    778779           
    779780//            =======================================
    780781           
    781            
     782            $list_ids = array_unique($list_ids);
    782783            foreach( $list_ids as $prod_id => $list_id ){
    783784                $list_name = mysql_real_escape_string($list_data[$prod_id]['list_name']);
     
    788789                }
    789790
    790                 if ( isset( $list_id_stored [$prod_id] ) ) {
    791                     $values_updated[] = "WHEN " . $prod_id  . " THEN '" . $list_id . "'";
    792                 } else {
     791                // if ( isset( $list_id_stored [$prod_id] ) ) {
     792                //     $values_updated[] = "WHEN " . $prod_id  . " THEN '" . $list_id . "'";
     793                // } else {
    793794                    $values_inserted[] = "(" . $prod_id . ", '" . $list_name . "' , '" . $list_id . "' , '" . $this->brand_id . "' , '" . $custom_attributes . "')";
    794                 }
     795                // }
    795796               
    796797               
     
    801802            // Insert only if it does not exist
    802803            if ( sizeof( $values_inserted ) > 0 ) {
    803                 $insert_query = " INSERT IGNORE into {$wpdb->prefix}wc_klawoo (id, list_name, list_id, brand_id, custom_attributes) VALUES";
     804                $insert_query = " REPLACE INTO {$wpdb->prefix}wc_klawoo (id, list_name, list_id, brand_id, custom_attributes) VALUES";
    804805                $insert_query .= implode( ',', $values_inserted );
    805806                $result_inserted = $wpdb->query( $insert_query );
     
    807808                       
    808809            // Code for updating the list ids
    809             if ( !empty($values_updated) && sizeof( $values_updated ) > 0 ) {
    810                 $update_query = " UPDATE {$wpdb->prefix}wc_klawoo
    811                                     SET list_id = CASE id ". implode("\n", $values_updated) ."
    812                                             END                                   
    813                                     WHERE brand_id = ".$this->brand_id;   
    814 
    815                 $result_updated = $wpdb->query( $update_query );
    816                 $num_updated = $wpdb->num_rows;
    817             }
     810            // if ( !empty($values_updated) && sizeof( $values_updated ) > 0 ) {
     811            //     $update_query = " UPDATE {$wpdb->prefix}wc_klawoo
     812            //                         SET list_id = CASE id ". implode("\n", $values_updated) ."
     813            //                                 END                                   
     814            //                         WHERE brand_id = ".$this->brand_id;   
     815            //     $result_updated = $wpdb->query( $update_query );
     816            //     $num_updated = $wpdb->num_rows;
     817            // }
    818818
    819819            if ( $result_inserted === false) {
     
    12241224        $list_ids = array(); // array containing all the list ids
    12251225
    1226         $query_list_ids = "SELECT id, list_id FROM {$wpdb->prefix}wc_klawoo ";
     1226        $query_list_ids = "SELECT id, list_id FROM {$wpdb->prefix}wc_klawoo WHERE brand_id = ".$this->brand_id;
    12271227        $result_list_ids = $wpdb->get_results( $query_list_ids, 'ARRAY_A' );
    12281228        $result_list_ids_count = $wpdb->num_rows;
     
    13981398            $email_ids_temp = array();
    13991399
     1400            //Code for getting the my-account page link
     1401            $myaccount_page_url = '';
     1402            $myaccount_page_id = get_option( 'woocommerce_myaccount_page_id' );
     1403            if ( $myaccount_page_id ) {
     1404              $myaccount_page_url = get_permalink( $myaccount_page_id );
     1405            }
     1406
    14001407            foreach ($sync_data as $order_id => $sync_data_temp ) {
    14011408                $email_ids [$order_id] = $sync_data_temp['subscriber_email'];
     
    14031410            }
    14041411
    1405             $generated_links = apply_filters('sa_bulk_express_login_link', array(), '', array_unique($email_ids), '', '' );
     1412            $generated_links = apply_filters('sa_bulk_express_login_link', array(), $myaccount_page_url , array_unique($email_ids), '', '' );
    14061413
    14071414            if (!empty($generated_links)) {
     
    19491956    public function user_subscribe_or_unsubscribe( $order_id, $old_status, $new_status ){
    19501957
    1951         if( $old_status != $new_status ){
     1958        // if( $old_status != $new_status ){
    19521959
    19531960            if( $new_status == 'processing' || $new_status == 'completed' ){
     
    19811988                }
    19821989            }
    1983         }   
     1990        // }   
    19841991    }
    19851992   
  • klawoo-connector/trunk/klawoo-connector.php

    r995297 r1271588  
    44 * Plugin URI: http://storeapps.org
    55 * Description: Connect Wordpress with Klawoo - The next generation customer engagement and marketing platform.
    6  * Version: 1.6
     6 * Version: 1.7
    77 * Author: storeapps
    88 * Author URI: http://storeapps.org/
  • klawoo-connector/trunk/readme.txt

    r995297 r1271588  
    44Requires at least: 3.3
    55Tested up to: 4.0
    6 Stable tag: 1.6
     6Stable tag: 1.7
    77License: GPL 3.0
    88
     
    7878== Changelog ==
    7979
     80= 1.7 =
     81* New: Syncing the MyAccount link for the subscribers
     82* Fix: New orders not getting synced
     83* Fixed: Minor Fixes
     84
    8085= 1.6 =
    8186* Update: Compatibility with new versions of WordPress & WooCommerce (v2.2 or greater)
     
    8792== Upgrade Notice ==
    8893
     94= 1.7 =
     95Fixed issue of new orders not getting synced along with some important updates and fixes, recommended upgrade.
     96
    8997= 1.6 =
    9098Compatibility with new versions of WordPress & WooCommerce (v2.2 or greater) along with some important updates and fixes, recommended upgrade.
Note: See TracChangeset for help on using the changeset viewer.