Changeset 1271588
- Timestamp:
- 10/23/2015 07:42:17 AM (10 years ago)
- Location:
- klawoo-connector/trunk
- Files:
-
- 3 edited
-
classes/class.wc-klawoo.php (modified) (10 diffs)
-
klawoo-connector.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
klawoo-connector/trunk/classes/class.wc-klawoo.php
r995297 r1271588 56 56 add_action( 'wp_ajax_klawoo_validate_and_get_brands', array (&$this, 'validate_and_get_brands') ); 57 57 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 ); 60 61 61 62 $settings = get_option('wc_klawoo_credentials', null); … … 768 769 // ======================================= 769 770 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 // } 778 779 779 780 // ======================================= 780 781 781 782 $list_ids = array_unique($list_ids); 782 783 foreach( $list_ids as $prod_id => $list_id ){ 783 784 $list_name = mysql_real_escape_string($list_data[$prod_id]['list_name']); … … 788 789 } 789 790 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 { 793 794 $values_inserted[] = "(" . $prod_id . ", '" . $list_name . "' , '" . $list_id . "' , '" . $this->brand_id . "' , '" . $custom_attributes . "')"; 794 }795 // } 795 796 796 797 … … 801 802 // Insert only if it does not exist 802 803 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"; 804 805 $insert_query .= implode( ',', $values_inserted ); 805 806 $result_inserted = $wpdb->query( $insert_query ); … … 807 808 808 809 // 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 // } 818 818 819 819 if ( $result_inserted === false) { … … 1224 1224 $list_ids = array(); // array containing all the list ids 1225 1225 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; 1227 1227 $result_list_ids = $wpdb->get_results( $query_list_ids, 'ARRAY_A' ); 1228 1228 $result_list_ids_count = $wpdb->num_rows; … … 1398 1398 $email_ids_temp = array(); 1399 1399 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 1400 1407 foreach ($sync_data as $order_id => $sync_data_temp ) { 1401 1408 $email_ids [$order_id] = $sync_data_temp['subscriber_email']; … … 1403 1410 } 1404 1411 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), '', '' ); 1406 1413 1407 1414 if (!empty($generated_links)) { … … 1949 1956 public function user_subscribe_or_unsubscribe( $order_id, $old_status, $new_status ){ 1950 1957 1951 if( $old_status != $new_status ){1958 // if( $old_status != $new_status ){ 1952 1959 1953 1960 if( $new_status == 'processing' || $new_status == 'completed' ){ … … 1981 1988 } 1982 1989 } 1983 }1990 // } 1984 1991 } 1985 1992 -
klawoo-connector/trunk/klawoo-connector.php
r995297 r1271588 4 4 * Plugin URI: http://storeapps.org 5 5 * Description: Connect Wordpress with Klawoo - The next generation customer engagement and marketing platform. 6 * Version: 1. 66 * Version: 1.7 7 7 * Author: storeapps 8 8 * Author URI: http://storeapps.org/ -
klawoo-connector/trunk/readme.txt
r995297 r1271588 4 4 Requires at least: 3.3 5 5 Tested up to: 4.0 6 Stable tag: 1. 66 Stable tag: 1.7 7 7 License: GPL 3.0 8 8 … … 78 78 == Changelog == 79 79 80 = 1.7 = 81 * New: Syncing the MyAccount link for the subscribers 82 * Fix: New orders not getting synced 83 * Fixed: Minor Fixes 84 80 85 = 1.6 = 81 86 * Update: Compatibility with new versions of WordPress & WooCommerce (v2.2 or greater) … … 87 92 == Upgrade Notice == 88 93 94 = 1.7 = 95 Fixed issue of new orders not getting synced along with some important updates and fixes, recommended upgrade. 96 89 97 = 1.6 = 90 98 Compatibility 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.