public function tm_get_variations_array()
 {
     $variations = array();
     $attributes = array();
     if (isset($_POST['post_id'])) {
         if (class_exists('Woocommerce_Waitlist')) {
             remove_filter('woocommerce_get_availability', array(Woocommerce_Waitlist::get_instance(), 'wew_check_product_availability'), 2, 2);
             remove_filter('woocommerce_get_availability', array(Woocommerce_Waitlist::get_instance(), 'wew_check_product_availability'));
         }
         $product = wc_get_product($_POST['post_id']);
         if ($product && is_object($product) && method_exists($product, 'get_available_variations')) {
             $variations = $product->get_available_variations();
             $attributes = $product->get_variation_attributes();
         }
     }
     echo json_encode(array('variations' => $variations, 'attributes' => $attributes));
     die;
 }
 /**
  * Initialize the plugin by loading admin scripts & styles and adding a
  * settings page and menu.
  *
  * @since     1.0.0
  */
 private function __construct()
 {
     $plugin = Woocommerce_Waitlist::get_instance();
     $this->plugin_slug = $plugin->get_plugin_slug();
     $this->plugin_slug_data = $plugin->get_plugin_slug_data();
     // Load admin style sheet and JavaScript.
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
     add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_scripts'));
     // Add the options page and menu item.
     add_action('admin_menu', array($this, 'add_plugin_admin_menu'));
     // Add an action link pointing to the options page.
     $plugin_basename = plugin_basename(plugin_dir_path(__DIR__) . $this->plugin_slug . '.php');
     add_filter('plugin_action_links_' . $plugin_basename, array($this, 'add_action_links'));
     add_action('wp_loaded', array($this, 'execute_before_wp_header'));
     add_action('add_meta_boxes', array($this, 'woowaitlist_add_product_meta_boxes'));
     add_action('add_meta_boxes', array($this, 'woowaitlist_display_subscription_option'));
 }
 /**
  * Fired for each blog when the plugin is activated.
  *
  * @since    1.0.0
  */
 private static function single_activate()
 {
     $ins = Woocommerce_Waitlist::get_instance();
     $ins->createPlugin_databaseTable();
     $ins->checkGroupedStocks_toNotifyUsers();
     $ins->checkStocks_toNotifyUsers();
     $ins->checkVariationsStocks_toNotifyUsers();
 }
Exemplo n.º 4
0
									</td>
									<td><strong><a href="<?php 
                echo $product_permalink;
                ?>
" title="<?php 
                echo $product_title;
                ?>
" target="_blank"><?php 
                echo $product_title;
                ?>
</a></strong></td>
									<td><?php 
                if ($d->variationId == 0) {
                    echo '-';
                } else {
                    $pplg = Woocommerce_Waitlist::get_instance();
                    $variationTitle = $pplg->get_variation_titles($d->variationId);
                    if ($variationTitle) {
                        echo '<strong>' . $variationTitle . '</strong>';
                    }
                }
                ?>
</td>



									<td><?php 
                if ($d->grouped_parentId == 0) {
                    echo '-';
                } else {
                    $parent_product = get_post(absint($d->grouped_parentId));