Plugin Directory

Changeset 1398102


Ignore:
Timestamp:
04/18/2016 07:38:03 AM (10 years ago)
Author:
webcomers
Message:
  • Conversion code on woocommerce thankyou page
  • Change menu name to 'Conversion code' under woocommerce menus
Location:
wc-pro-conversion-google-facebook-bing/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wc-pro-conversion-google-facebook-bing/trunk/inc/class-wc-cat-cn-settings.php

    r1373521 r1398102  
    4040
    4141                $this->save_default_scripts( $_POST );
     42               
     43                $this->save_thankyou_script( $_POST );
    4244
    4345                echo '<div id="message" class="updated"><p><strong>Changes has been saved successfully.</strong></p></div>';
     
    6870
    6971            echo  $this->general_code_fields();
     72           
     73            echo  '<h3>Thank you page scripts.</h3>';
     74           
     75            echo  '<p>Below code will be added to checkout success page.</p>';
     76           
     77            echo $this->thankyou_fields();
     78            //$thankyou_script = get_option('_woocommerce_conversion_thankyou_script');
     79            //print_r( $thankyou_script );
    7080
    7181            echo  '<input name="save_cn_code_settings" class="button-primary" type="submit" value="Save changes"/>';
     
    276286
    277287    }
    278 
     288   
     289    public function thankyou_fields(){
     290       
     291        $thankyou_script = get_option('_woocommerce_conversion_thankyou_script');
     292       
     293       
     294       
     295        $html ='<table class="form-table">
     296
     297                <tbody>
     298
     299                    <tr valign="top">
     300
     301                        <th scope="row" class="titledesc"><label>Google Conversion Code</label></th>
     302
     303                        <td><textarea name="wc_thankyou_cn_gcode" rows="5" cols="40">'.strip_slashes_script($thankyou_script['_cn_gcode']).'</textarea></td>
     304
     305                    </tr>
     306
     307                    <tr valign="top">
     308
     309                        <th scope="row" class="titledesc"><label>Yahoo Conversion Code</label></th>
     310
     311                        <td><textarea name="wc_thankyou_cn_ycode" rows="5" cols="40">'.strip_slashes_script($thankyou_script['_cn_ycode']).'</textarea></td>
     312
     313                    </tr>
     314
     315                    <tr valign="top">
     316
     317                        <th scope="row" class="titledesc"><label>Bing Conversion Code</label></th>
     318
     319                        <td><textarea name="wc_thankyou_cn_bcode" rows="5" cols="40">'.strip_slashes_script($thankyou_script['_cn_bcode']).'</textarea></td>
     320
     321                    </tr>
     322
     323                </tbody>
     324
     325              </table>';
     326             
     327              return $html;
     328    }
     329   
     330    public function save_thankyou_script( $post){
     331       
     332        if(isset($post['save_cn_code_settings'])){
     333           
     334            $thankyou_script        = array();
     335
     336            $thankyou_script['_cn_gcode']   = wc_cat_cn_sanitize_script($post['wc_thankyou_cn_gcode']);
     337
     338            $thankyou_script['_cn_ycode']   = wc_cat_cn_sanitize_script($post['wc_thankyou_cn_ycode']);
     339
     340            $thankyou_script['_cn_bcode']   = wc_cat_cn_sanitize_script($post['wc_thankyou_cn_bcode']);
     341                   
     342            if( !empty( $thankyou_script['_cn_gcode'] )  || !empty( $thankyou_script['_cn_ycode'] ) || $thankyou_script['_cn_bcode'] ){
     343                $res = update_option( '_woocommerce_conversion_thankyou_script', $thankyou_script );
     344            }else{
     345                delete_option( '_woocommerce_conversion_thankyou_script' );
     346            }
     347
     348            return true;
     349        }
     350       
     351    }
     352   
     353    public function print_thankyou_script( $order_id ){
     354       
     355        $thankyou_script = get_option('_woocommerce_conversion_thankyou_script');
     356       
     357    }
    279358   
    280359
  • wc-pro-conversion-google-facebook-bing/trunk/inc/functions.php

    r1373521 r1398102  
    3434
    3535function get_conversion_code(){
    36 
    37    
     36   
     37   
     38   
     39    if( is_order_received_page() ){
     40        $thankyou_script = get_option('_woocommerce_conversion_thankyou_script');
     41        if(!empty($thankyou_script)) return $thankyou_script;       
     42    }
    3843
    3944    if(is_product()){
     
    101106
    102107        $cat_script = get_woocommerce_term_meta( $cat_id, $key );               
    103        
    104        
    105        
     108               
    106109        if( $cat_script ) return $cat_script; // return code of current category
    107110       
    108         //return count($cat_script);
    109         //return $parent_id;
    110111        if( !$cat_script ){
    111112            if($cat->parent > 0){ // if category has parent category
     
    164165    }
    165166
    166     echo "<!-- Converstion Code -->\n";
     167    echo "<!-- Conversion Code -->\n";
    167168
    168169    if(!empty($gcode)) echo strip_slashes_script($gcode)."\n\n";
  • wc-pro-conversion-google-facebook-bing/trunk/readme.txt

    r1373684 r1398102  
    53532. Go to plugins interface and activate the plugin.
    5454
    55 3. Go to "Woocommerce" menu and click on submenu "Conversion Code Settings" for settings
     553. Go to "Woocommerce" menu and click on submenu "Conversion Code" for settings
    5656
    57574. Set default code for facebook,bing and yahoo.
     
    8484
    85853. Category conversion code, which will show on category pages.
     86
     87== Changelog ==
     88
     89= 1.3 =
     90* Latest updates : Show conversion on woocommerce thank you page.
     91
     92= 1.2 =
     93* Change settings menu name in under woocommerce menus
     94
     95= 1.1 =
     96* Fix issues in with subcategories and product page
  • wc-pro-conversion-google-facebook-bing/trunk/wc-category-conversion-code.php

    r1373521 r1398102  
    231231         $wc_cat_cn_settings = new Wc_Conversion_Code_Settings;
    232232
    233          add_submenu_page( 'woocommerce', 'Conversion Code Settings', 'Conversion Code Settings', 'manage_options', 'can-cn-code-settings', array($wc_cat_cn_settings, 'cn_code_settings_callback') );
     233         add_submenu_page( 'woocommerce', 'Conversion Code', 'Conversion Code', 'manage_options', 'can-cn-code-settings', array($wc_cat_cn_settings, 'cn_code_settings_callback') );
    234234
    235235    }
Note: See TracChangeset for help on using the changeset viewer.