Changeset 2020913
- Timestamp:
- 01/29/2019 05:29:19 AM (7 years ago)
- Location:
- woo-to-facebook-shop/trunk
- Files:
-
- 4 edited
-
css/wctofb_setting.css (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
wctofb.php (modified) (22 diffs)
-
wctofb_woocommerce_feeds.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-to-facebook-shop/trunk/css/wctofb_setting.css
r1920888 r2020913 1 /* Version 2. 4*/1 /* Version 2.5 */ 2 2 #product_sync,.product_sync.column-product_sync{width: 40px;} 3 3 .wctofb_product_sync { border: medium none; cursor: pointer; padding: 0;} -
woo-to-facebook-shop/trunk/readme.txt
r1920888 r2020913 1 === WooCommerce to facebook shop ===1 === WooCommerce to facebook shop === 2 2 3 3 Contributors: Premiumthemes … … 5 5 Tags: Facebook, ecommerce, Facebook store, Facebook shop, import, woocommerce, woo-commerce, wp-commerce, Facebook marketing, Online Sales, Social commerce, Twitter, G+, google, google plus, comments, Social campaigns, wordpress Woocommerce, share, blog, plugin, product sharing, network shop 6 6 Requires at least: 3.3.1 7 Tested up to: 4.97 Tested up to: 5.0.3 8 8 Stable tag: 4.3 9 9 License: GPLv2 or later … … 110 110 111 111 == Changelog == 112 113 = 2.5 = 114 * minor bug fixes. 112 115 113 116 = 2.4 = -
woo-to-facebook-shop/trunk/wctofb.php
r1920888 r2020913 5 5 Description: Now you can start your facebook shop free. With WooCommerce to facebook shop plugin you can easily sync or unsync your products from your woocommerce website to your facebook fan page very quickly. No manual import or Export required everything in real time. 6 6 Author: premiumthemes 7 Version: 2. 47 Version: 2.5 8 8 Author URI: https://www.premium-themes.co/ 9 9 */ 10 10 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 11 define ('wctofb_version', '2. 4');11 define ('wctofb_version', '2.5'); 12 12 // Global Variables 13 13 global $bulk_action; … … 57 57 $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=wc-settings&tab=settings_tab_wctofb') ) .'">Settings</a>'; 58 58 if(esc_attr(get_option('wctofb_apikey_success'))=='' || esc_attr(get_option('wctofb_apikey_success'))=='0'){ 59 $links[] = '<a href="'. esc_url($wctofb_register.'/setup-wizard/ ') .'">Get Key</a>';59 $links[] = '<a href="'. esc_url($wctofb_register.'/setup-wizard/?shop='.get_bloginfo('url')) .'">Get Key</a>'; 60 60 } 61 61 return $links; … … 81 81 add_option( 'wctofb_apikey_success'); 82 82 add_option( 'wctofb_api'); 83 flush_rewrite_rules(); 83 84 } 84 85 register_activation_hook(__FILE__,'wctofb_install'); … … 203 204 'body' => $sendjson, 204 205 'cookies' => array()) ); 205 $apiresponse = $apisucces['body']; 206 $apimessage = json_decode($apiresponse); 206 if ( is_wp_error( $apisucces ) ) { 207 $error = $apisucces->get_error_message(); 208 $apimessage = 'Unable to verify the API key. Please try again'; 209 echo '<div class="notice-error notice is-dismissible"><p>'.$apimessage.'</p></div>'; 210 }else{ 211 $apiresponse = wp_remote_retrieve_body($apisucces); 212 $apimessage = json_decode($apiresponse); 207 213 $apimessage = (int)$apimessage->{'message'}; 214 } 208 215 if ($apimessage == (int)$apimessage) 209 216 { … … 271 278 /****** Action for json generate and send product on facebook******/ 272 279 add_action( 'init', function(){ 280 global $wp_rewrite; 281 add_rewrite_endpoint('woocommerce_wctofb_feeds',array(EP_PERMALINK, EP_PAGES)); 273 282 add_rewrite_endpoint( 'woocommerce_wctofb_feeds', EP_ALL ); 283 $wp_rewrite->flush_rules(); 274 284 } ); 275 285 add_action( 'template_redirect', function(){ … … 464 474 $response = wctofb_sync_button_action($jsonaction,$unsyncarray); 465 475 } 466 if ( ($bulk_action == 'unsync' || $bulk_action == 'sync') && $response=='success'){476 if ($bulk_action == 'unsync' || $bulk_action == 'sync'){ 467 477 if ( $response == 'success' ) { 468 478 setcookie( "singleproductupdate",'success'); 479 }else{ 480 setcookie( "singleproductupdatefail",'fail'); 469 481 } 470 482 $sendback = add_query_arg( … … 491 503 </div> 492 504 <?php 493 setcookie( "singleproductupdate",""); 494 } 505 setcookie("singleproductupdate","",time()-36000); 506 } 507 if (isset($_COOKIE['singleproductupdatefail'])){?> 508 <div class="notice notice-error is-dismissible"> 509 <p><?php _e('Unable to updated on your <strong>Facebook shop</strong>. Please try again.','wctofb');?></p> 510 </div> 511 <?php 512 setcookie("singleproductupdatefail","",time()-36000); 513 } 514 495 515 } 496 516 /****** Remove product from facebook shop on product move to trash ******/ … … 507 527 if ( $response == 'success' ) { 508 528 setcookie( "singleproductupdate",'success'); 509 } 529 }else{ 530 setcookie( "singleproductupdatefail",'fail'); 531 } 510 532 } 511 533 } … … 514 536 /****** Remove product from facebook shop on product move to draft, pending, private, schedule, publish ******/ 515 537 function wctofb_func_Save( $post_id ) { 538 if(!isset($_POST['order_id'])): 516 539 global $wpdb; 517 540 $table_name = $wpdb->prefix . 'wctofb'; … … 525 548 if ( $response == 'success' ) { 526 549 setcookie( "singleproductupdate",'success'); 550 }else{ 551 setcookie( "singleproductupdatefail",'fail'); 527 552 } 528 553 } … … 530 555 if(get_post_status($post_id) == "publish"){ 531 556 $syncarray = array(); 532 global $woocommerce;533 $woo_version = $woocommerce->version;534 557 $product = wc_get_product( $post_id ); 535 558 if(($product->is_type( 'simple' ) || $product->is_type( 'external' )) && $product->get_regular_price()!='' ){ … … 543 566 if ( $response == 'success' ) { 544 567 setcookie( "singleproductupdate",'success'); 545 $wpdb->update( $table_name, array( 'product_status' => 'sync'),array( 'product_id' => esc_sql($post_id)));568 $wpdb->update( $table_name,array( 'product_status' => 'sync'),array( 'product_id' => esc_sql($post_id))); 546 569 } 570 else{ 571 setcookie( "singleproductupdatefail",'fail'); 572 } 547 573 } 548 574 elseif($product->is_type( 'variable' ) && $product->get_variation_regular_price('min',true)!='' ){ … … 556 582 if ( $response == 'success' ) { 557 583 setcookie( "singleproductupdate",'success'); 558 $wpdb->update( $table_name, array( 'product_status' => 'sync'),array( 'product_id' => esc_sql($post_id))); 559 } 584 $wpdb->update($table_name, array( 'product_status' => 'sync'),array( 'product_id' => esc_sql($post_id))); 585 }else{ 586 setcookie( "singleproductupdatefail",'fail'); 587 } 560 588 } 561 589 elseif($product->is_type( 'grouped' )){ … … 569 597 if ( $response == 'success' ) { 570 598 setcookie( "singleproductupdate",'success'); 571 $wpdb->update( $table_name, array( 'product_status' => 'sync'),array( 'product_id' => esc_sql($post_id))); 572 } 599 $wpdb->update( $table_name,array( 'product_status' => 'sync'),array( 'product_id' => esc_sql($post_id))); 600 }else{ 601 setcookie( "singleproductupdatefail",'fail'); 602 } 573 603 } 574 604 575 605 } 576 606 } 607 endif; 577 608 } 578 609 add_action( 'save_post', 'wctofb_func_Save', 10); … … 614 645 $product_stock_status = $product->stock_status; // Older than version 3.0 615 646 } 616 if ( method_exists( $product, 'get_stock ' ) ) {647 if ( method_exists( $product, 'get_stock_quantity' ) ) { 617 648 $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+ 618 649 } else { … … 704 735 $product_stock_status = $product->stock_status; // Older than version 3.0 705 736 } 706 if ( method_exists( $product, 'get_stock ' ) ) {737 if ( method_exists( $product, 'get_stock_quantity' ) ) { 707 738 $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+ 708 739 } else { … … 791 822 $product_stock_status = $product->stock_status; // Older than version 3.0 792 823 } 793 if ( method_exists( $product, 'get_stock ' ) ) {824 if ( method_exists( $product, 'get_stock_quantity' ) ) { 794 825 $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+ 795 826 } else { … … 845 876 } 846 877 $get_available_variations = $product->get_available_variations(); 878 echo "<pre>";print_r($get_available_variations);echo "</pre>"; 847 879 $productrawvariations=''; 848 880 $productrawvariations = array();$productrawvariations['variations']= array(); $custom_single_variation =array(); … … 872 904 $productrawvariations['variation_dropdown']= array(); 873 905 array_push($productrawvariations['variation_dropdown'],$attributes); 874 875 906 } 876 907 if(!empty($product_id)){ … … 878 909 endwhile; 879 910 $jsondata = array("action"=>"Store Feed","products"=>$sendstoreproducts,'store_url'=>$store_url,'cartpage_url'=>$cartpage_url,"store_currency"=>$store_currency,"store_weight_unit"=>esc_attr( get_option('woocommerce_weight_unit' ) ),"store_dimension_unit"=>esc_attr( get_option('woocommerce_dimension_unit')),"store_language"=>$store_language,"apikey"=>"verified"); 880 881 882 883 911 }} 884 echo $sendjson = json_encode($jsondata, JSON_NUMERIC_CHECK); 885 912 $sendjson = json_encode($jsondata, JSON_NUMERIC_CHECK); 886 913 if(!empty($jsondata)){ 887 914 $sendjson = json_encode($jsondata, JSON_NUMERIC_CHECK); … … 898 925 'cookies' => array()) 899 926 ); 900 $apiresponse = $passstoreproducts['body']; 901 $apimessage = json_decode($apiresponse); 927 if ( is_wp_error( $passstoreproducts ) ) { 928 $error = $passstoreproducts->get_error_message(); 929 $apimessage = 'fail'; 930 }else{ 931 $apiresponse = wp_remote_retrieve_body($passstoreproducts); 932 $apimessage = json_decode($apiresponse); 902 933 $apimessage = $apimessage->{'action'}; 934 } 903 935 904 936 } … … 1022 1054 'body' => $sendjson, 1023 1055 'cookies' => array()) ); 1024 $apiresponse = $apisucces['body']; 1056 if ( is_wp_error( $apisucces ) ) { 1057 $error = $apisucces->get_error_message(); 1058 $apimessage = 'Unable to Update API key.'; 1059 }else{ 1060 $apiresponse = wp_remote_retrieve_body($apisucces); 1025 1061 $apimessage = json_decode($apiresponse); 1026 1062 $apimessage = (int)$apimessage->{'message'}; 1063 } 1027 1064 if ($apimessage == (int)$apimessage) 1028 1065 { -
woo-to-facebook-shop/trunk/wctofb_woocommerce_feeds.php
r1873892 r2020913 57 57 $product_stock_status = $product->stock_status; // Older than version 3.0 58 58 } 59 if ( method_exists( $product, 'get_stock ' ) ) {59 if ( method_exists( $product, 'get_stock_quantity' ) ) { 60 60 $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+ 61 61 } else { … … 94 94 } 95 95 } 96 96 97 $product_detail_link = get_post_permalink( $product_id ); 97 98 $product_short_description = preg_replace("/\[(.*?)\]/i",'',apply_filters( 'the_excerpt', get_the_excerpt())); … … 150 151 $product_stock_status = $product->stock_status; // Older than version 3.0 151 152 } 152 if ( method_exists( $product, 'get_stock ' ) ) {153 if ( method_exists( $product, 'get_stock_quantity' ) ) { 153 154 $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+ 154 155 } else { … … 240 241 $product_stock_status = $product->stock_status; // Older than version 3.0 241 242 } 242 if ( method_exists( $product, 'get_stock ' ) ) {243 if ( method_exists( $product, 'get_stock_quantity' ) ) { 243 244 $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+ 244 245 } else {
Note: See TracChangeset
for help on using the changeset viewer.