Plugin Directory

Changeset 2020913


Ignore:
Timestamp:
01/29/2019 05:29:19 AM (7 years ago)
Author:
premiumthemes
Message:

releasing version 2.5

Location:
woo-to-facebook-shop/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • woo-to-facebook-shop/trunk/css/wctofb_setting.css

    r1920888 r2020913  
    1 /* Version 2.4 */
     1/* Version 2.5 */
    22#product_sync,.product_sync.column-product_sync{width: 40px;}
    33.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 ===
    22
    33Contributors: Premiumthemes
     
    55Tags: 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
    66Requires at least: 3.3.1
    7 Tested up to: 4.9
     7Tested up to: 5.0.3
    88Stable tag: 4.3
    99License: GPLv2 or later
     
    110110
    111111== Changelog ==
     112
     113= 2.5 =
     114* minor bug fixes.
    112115
    113116= 2.4 =
  • woo-to-facebook-shop/trunk/wctofb.php

    r1920888 r2020913  
    55Description: 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.
    66Author: premiumthemes
    7 Version: 2.4
     7Version: 2.5
    88Author URI: https://www.premium-themes.co/
    99*/
    1010if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    11 define ('wctofb_version', '2.4');
     11define ('wctofb_version', '2.5');
    1212// Global Variables
    1313global $bulk_action;
     
    5757    $links[] = '<a href="'. esc_url( get_admin_url(null, 'admin.php?page=wc-settings&tab=settings_tab_wctofb') ) .'">Settings</a>';
    5858    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>';
    6060    }
    6161    return $links;
     
    8181    add_option( 'wctofb_apikey_success');
    8282    add_option( 'wctofb_api');
     83    flush_rewrite_rules();
    8384    }
    8485register_activation_hook(__FILE__,'wctofb_install');
     
    203204        'body' => $sendjson,
    204205        '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);
    207213        $apimessage = (int)$apimessage->{'message'};
     214        }
    208215        if ($apimessage == (int)$apimessage)
    209216        {
     
    271278/****** Action for json generate and send product on facebook******/
    272279add_action( 'init', function(){
     280    global $wp_rewrite;
     281    add_rewrite_endpoint('woocommerce_wctofb_feeds',array(EP_PERMALINK, EP_PAGES));
    273282    add_rewrite_endpoint( 'woocommerce_wctofb_feeds', EP_ALL );
     283    $wp_rewrite->flush_rules();
    274284} );
    275285add_action( 'template_redirect', function(){
     
    464474                $response = wctofb_sync_button_action($jsonaction,$unsyncarray);
    465475            }
    466             if (($bulk_action == 'unsync' || $bulk_action == 'sync') && $response=='success'){
     476            if ($bulk_action == 'unsync' || $bulk_action == 'sync'){
    467477                if ( $response == 'success' ) {
    468478                 setcookie( "singleproductupdate",'success');
     479                }else{
     480                setcookie( "singleproductupdatefail",'fail');   
    469481                }
    470482                    $sendback = add_query_arg(
     
    491503        </div>
    492504        <?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       
    495515}
    496516/****** Remove product from facebook shop on product move to trash ******/
     
    507527        if ( $response == 'success' ) {
    508528         setcookie( "singleproductupdate",'success');
    509         }
     529        }else{
     530        setcookie( "singleproductupdatefail",'fail');   
     531        }
    510532    }
    511533}
     
    514536/****** Remove product from facebook shop on product move to draft, pending, private, schedule, publish ******/
    515537function wctofb_func_Save( $post_id ) {
     538    if(!isset($_POST['order_id'])):
    516539    global $wpdb;           
    517540        $table_name = $wpdb->prefix . 'wctofb';
     
    525548            if ( $response == 'success' ) {
    526549            setcookie( "singleproductupdate",'success');
     550            }else{
     551            setcookie( "singleproductupdatefail",'fail');   
    527552            }
    528553        }
     
    530555    if(get_post_status($post_id) == "publish"){
    531556        $syncarray = array();
    532          global $woocommerce;
    533         $woo_version = $woocommerce->version;
    534557        $product = wc_get_product( $post_id );
    535558        if(($product->is_type( 'simple' ) || $product->is_type( 'external' )) && $product->get_regular_price()!='' ){
     
    543566        if ( $response == 'success' ) {
    544567         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))); 
    546569        }
     570        else{
     571        setcookie( "singleproductupdatefail",'fail');   
     572        }
    547573        }
    548574        elseif($product->is_type( 'variable' ) && $product->get_variation_regular_price('min',true)!='' ){
     
    556582        if ( $response == 'success' ) {
    557583         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        }
    560588        }
    561589        elseif($product->is_type( 'grouped' )){
     
    569597        if ( $response == 'success' ) {
    570598         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        }
    573603        }
    574604       
    575605    }
    576606  }
     607  endif;
    577608 }
    578609add_action( 'save_post', 'wctofb_func_Save', 10);
     
    614645                $product_stock_status = $product->stock_status; // Older than version 3.0
    615646                }
    616                 if ( method_exists( $product, 'get_stock' ) ) {
     647                if ( method_exists( $product, 'get_stock_quantity' ) ) {
    617648                $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+
    618649                } else {
     
    704735                $product_stock_status = $product->stock_status; // Older than version 3.0
    705736                }
    706                 if ( method_exists( $product, 'get_stock' ) ) {
     737                if ( method_exists( $product, 'get_stock_quantity' ) ) {
    707738                $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+
    708739                } else {
     
    791822                $product_stock_status = $product->stock_status; // Older than version 3.0
    792823                }
    793                 if ( method_exists( $product, 'get_stock' ) ) {
     824                if ( method_exists( $product, 'get_stock_quantity' ) ) {
    794825                $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+
    795826                } else {
     
    845876                 }
    846877                $get_available_variations = $product->get_available_variations();
     878                echo "<pre>";print_r($get_available_variations);echo "</pre>";
    847879                $productrawvariations='';
    848880                $productrawvariations = array();$productrawvariations['variations']= array(); $custom_single_variation =array();
     
    872904                $productrawvariations['variation_dropdown']= array();
    873905                array_push($productrawvariations['variation_dropdown'],$attributes);
    874                
    875906            }
    876907            if(!empty($product_id)){
     
    878909        endwhile;
    879910    $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    
    883911    }}
    884 echo  $sendjson = json_encode($jsondata, JSON_NUMERIC_CHECK);
    885 
     912  $sendjson = json_encode($jsondata, JSON_NUMERIC_CHECK);
    886913if(!empty($jsondata)){
    887914        $sendjson = json_encode($jsondata, JSON_NUMERIC_CHECK);
     
    898925        'cookies' => array())
    899926        );
    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);
    902933        $apimessage = $apimessage->{'action'};
     934        }
    903935       
    904936    }
     
    10221054        'body' => $sendjson,
    10231055        '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);
    10251061        $apimessage = json_decode($apiresponse);
    10261062        $apimessage = (int)$apimessage->{'message'};
     1063        }
    10271064        if ($apimessage == (int)$apimessage)
    10281065        {
  • woo-to-facebook-shop/trunk/wctofb_woocommerce_feeds.php

    r1873892 r2020913  
    5757                $product_stock_status = $product->stock_status; // Older than version 3.0
    5858                }
    59                 if ( method_exists( $product, 'get_stock' ) ) {
     59                if ( method_exists( $product, 'get_stock_quantity' ) ) {
    6060                $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+
    6161                } else {
     
    9494                }
    9595                }
     96               
    9697                $product_detail_link = get_post_permalink( $product_id );
    9798                $product_short_description = preg_replace("/\[(.*?)\]/i",'',apply_filters( 'the_excerpt', get_the_excerpt()));
     
    150151                $product_stock_status = $product->stock_status; // Older than version 3.0
    151152                }
    152                 if ( method_exists( $product, 'get_stock' ) ) {
     153                if ( method_exists( $product, 'get_stock_quantity' ) ) {
    153154                $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+
    154155                } else {
     
    240241                $product_stock_status = $product->stock_status; // Older than version 3.0
    241242                }
    242                 if ( method_exists( $product, 'get_stock' ) ) {
     243                if ( method_exists( $product, 'get_stock_quantity' ) ) {
    243244                $product_stock_quantity= $product->get_stock_quantity();// For version 3.0+
    244245                } else {
Note: See TracChangeset for help on using the changeset viewer.