Plugin Directory

Changeset 3098430


Ignore:
Timestamp:
06/06/2024 08:51:59 AM (21 months ago)
Author:
teoleonard
Message:

6.0 update. Version 6 is a major change in how the database structured as it relates to High-Performance Order Storage (HPOS). All updates should only be performed in a staging or development test environment and thoroughly tested before being updated in a live environment.

Location:
raffle-ticket-generator/trunk
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • raffle-ticket-generator/trunk/raffle-ticket-generator.php

    r3077915 r3098430  
    44Plugin URI: http://wpraffle.com
    55Description: Raffle Ticket Generator.  Generate numbered raffle tickets and email virtual tickets via WooCommerce order system
    6 Version: 5.1.4
     6Version: 6.0
    77Author: The Web Design Ninja
    88Author URI: http://TheWebDesignNinja.com
     
    4646     }
    4747register_activation_hook(__FILE__,'wooraffle_install');
     48add_action('before_woocommerce_init', function(){
     49
     50
     51
     52    if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
     53
     54        \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', 'raffle-ticket-generator-gold/raffle-ticket-generator-gold.php', true );
     55
     56
     57
     58    }
     59
     60
     61
     62});
    4863function wooraffle_uninstall(){
    4964      global $wpdb; 
     
    86101   
    87102    function simple_winner_categories(){
    88         echo '<img src="'.plugin_dir_url( __FILE__ ).'/images/wordpress-raffle-logo.png" style="float:left"><div style="clear:both"></div>';
     103        echo '<img src="'.plugin_dir_url( __FILE__ ).'/images/wordpress-raffle-logo.png" style="float:left; width:200px"><div style="clear:both"></div>';
    89104        echo '<h1 style="font-size:20px">For Silver and Gold Members Only</h1>';
    90105        echo '<p>The Bronze version is not a trial version - is it simply a lightweight version that generates 500 unique ticket numbers.  
     
    244259
    245260            $customer = get_user_by('id', $ticketsqueryresult->customer_id);
    246 
    247             $billing_first_name = get_post_meta($ticketsqueryresult->order_id, '_billing_first_name', true);
    248 
    249             $billing_last_name = get_post_meta($ticketsqueryresult->order_id, '_billing_last_name', true);
    250 
    251             $billing_company = get_post_meta($ticketsqueryresult->order_id, '_billing_company', true);
    252 
    253             $billing_address = get_post_meta($ticketsqueryresult->order_id, '_billing_address_1', true);
    254 
    255             $billing_address2 = get_post_meta($ticketsqueryresult->order_id, '_billing_address_2', true);
    256 
    257             $billing_city = get_post_meta($ticketsqueryresult->order_id, '_billing_city', true);
    258 
    259             $billing_postcode = get_post_meta($ticketsqueryresult->order_id, '_billing_postcode', true);
    260 
    261             $billing_country = get_post_meta($ticketsqueryresult->order_id, '_billing_country', true);
    262 
    263             $billing_state = get_post_meta($ticketsqueryresult->order_id, '_billing_state', true);
    264 
    265             $billing_email = get_post_meta($ticketsqueryresult->order_id, '_billing_email', true);
    266 
    267             $billing_phone = get_post_meta($ticketsqueryresult->order_id, '_billing_phone', true);
    268 
    269             $billing_paymethod = get_post_meta($ticketsqueryresult->order_id, '_payment_method', true);
     261            $order = wc_get_order($ticketsqueryresult->order_id);
     262            $billing_first_name = $order->get_billing_first_name();
     263            $billing_last_name = $order->get_billing_last_name();
     264            $billing_company = $order->get_billing_company();
     265            $billing_address = $order->get_billing_address_1();
     266            $billing_address2 = $order->get_billing_address_2();
     267            $billing_city = $order->get_billing_city();
     268            $billing_postcode = $order->get_billing_postcode();
     269            $billing_country = $order->get_billing_country();
     270            $billing_state = $order->get_billing_state();
     271            $billing_email = $order->get_billing_email();
     272            $billing_phone = $order->get_billing_phone();
     273            $billing_paymethod = $order->get_payment_method();
    270274
    271275            $customer_name = $billing_first_name . ' ' . $billing_last_name;
     
    344348        echo '<td>';
    345349
    346         $wpdb->get_results('select * from ' . $wpdb->prefix . 'wooraffle_tickets_customer_to_tickets t1, ' . $wpdb->prefix . 'posts t2 where t1.products_id = "' . get_the_ID() . '" and t2.ID = t1.order_id and t2.post_status != "wc-refunded" and t2.post_status != "wc-cancelled" and  t2.post_status != "trash"');
     350        $tickets_query = $wpdb->get_results('select * from ' . $wpdb->prefix . 'wooraffle_tickets_customer_to_tickets t1, ' . $wpdb->prefix . 'posts t2 where t1.products_id = "' . get_the_ID() . '" and t2.ID = t1.order_id and t2.post_status != "wc-refunded" and t2.post_status != "wc-cancelled" and  t2.post_status != "trash"');
     351       
     352        if (empty($tickets_query)) {
     353         $tickets_query = $wpdb->get_results('select * from ' . $wpdb->prefix . 'wooraffle_tickets_customer_to_tickets t1, ' . $wpdb->prefix . 'wc_orders t2 where t1.products_id = "' . get_the_ID() . '" and t2.ID = t1.order_id and t2.post_status != "wc-refunded" and t2.post_status != "wc-cancelled" and  t2.post_status != "trash"');   
     354        }
    347355
    348356        echo $wpdb->num_rows;
     
    352360        echo '<td>';
    353361
    354         $wpdb->get_results('select * from ' . $wpdb->prefix . 'wooraffle_tickets_customer_to_tickets t1, ' . $wpdb->prefix . 'posts t2 where t1.products_id = "' . get_the_ID() . '" and t2.ID = t1.order_id and t2.post_status != "wc-refunded" and t2.post_status != "wc-cancelled" and  t2.post_status != "trash" group by order_id');
     362        $tickets_query2 = $wpdb->get_results('select * from ' . $wpdb->prefix . 'wooraffle_tickets_customer_to_tickets t1, ' . $wpdb->prefix . 'posts t2 where t1.products_id = "' . get_the_ID() . '" and t2.ID = t1.order_id and t2.post_status != "wc-refunded" and t2.post_status != "wc-cancelled" and  t2.post_status != "trash" group by order_id');
     363        if (empty($tickets_query2)) {
     364         $tickets_query = $wpdb->get_results('select * from ' . $wpdb->prefix . 'wooraffle_tickets_customer_to_tickets t1, ' . $wpdb->prefix . 'wc_orders t2 where t1.products_id = "' . get_the_ID() . '" and t2.ID = t1.order_id and t2.post_status != "wc-refunded" and t2.post_status != "wc-cancelled" and  t2.post_status != "trash" group by order_id');
     365        }
    355366
    356367        echo $wpdb->num_rows;
     
    426437            $order_id = explode("_", $key);
    427438
    428             $billing_first_name = get_post_meta($order_id[0], '_billing_first_name', true);
    429 
    430             $billing_last_name = get_post_meta($order_id[0], '_billing_last_name', true);
    431 
    432             $billing_company = get_post_meta($order_id[0], '_billing_company', true);
    433 
    434             $billing_address = get_post_meta($order_id[0], '_billing_address_1', true);
    435 
    436             $billing_address2 = get_post_meta($order_id[0], '_billing_address_2', true);
    437 
    438             $billing_city = get_post_meta($order_id[0], '_billing_city', true);
    439 
    440             $billing_postcode = get_post_meta($order_id[0], '_billing_postcode', true);
    441 
    442             $billing_country = get_post_meta($order_id[0], '_billing_country', true);
    443 
    444             $billing_state = get_post_meta($order_id[0], '_billing_state', true);
    445 
    446             $billing_email = get_post_meta($order_id[0], '_billing_email', true);
    447 
    448             $billing_phone = get_post_meta($order_id[0], '_billing_phone', true);
    449 
    450             $billing_paymethod = get_post_meta($order_id[0], '_payment_method', true);
     439           $order = wc_get_order($order_id[0]);
     440            $billing_first_name = $order->get_billing_first_name();
     441            $billing_last_name = $order->get_billing_last_name();
     442            $billing_company = $order->get_billing_company();
     443            $billing_address = $order->get_billing_address_1();
     444            $billing_address2 = $order->get_billing_address_2();
     445            $billing_city = $order->get_billing_city();
     446            $billing_postcode = $order->get_billing_postcode();
     447            $billing_country = $order->get_billing_country();
     448            $billing_state = $order->get_billing_state();
     449            $billing_email = $order->get_billing_email();
     450            $billing_phone = $order->get_billing_phone();
     451            $billing_paymethod = $order->get_payment_method();
    451452
    452453            $customer_name = $billing_first_name . ' ' . $billing_last_name;
     
    649650    }
    650651}
     652
    651653add_action( 'woocommerce_admin_order_data_after_order_details', 'simple_show_ticket_numbers_admin' );
    652654?>
  • raffle-ticket-generator/trunk/readme.txt

    r3077915 r3098430  
    357357Bug fix – Starting Ticket Numbers not changing (SLV)
    358358Bug fix – Winner Timer not showing on Fusion Pages (GLD)
    359 Bug fix – Non raffle products fatal error fixed on checkout (Bronze)   
     359Bug fix – Non raffle products fatal error fixed on checkout (Bronze) 
     360
     361=6.0=
     3622024/06/05   WP6.5.3 and Woo8.9.2
     363Changed DB Structure for Woo HPOS
     364Improved Random Ticket Generation when saving
     365Added additional checks during plugin installation and activation
     366Improved Tickets Sold progress bar
     367Added additional DB checks after updating
Note: See TracChangeset for help on using the changeset viewer.