File "class-wc-report-out-of-stock.php"

Full path: /home/kosmetik/public_html/wp-content/plugins/woocommerce/includes/admin/reports/class-wc-report-out-of-stock.php
File size: 1.24 B
MIME-type: text/x-php
Charset: utf-8

Download   Open   Edit   Advanced Editor   Back

<?php

defined('ABSPATH') || exit;
if (!class_exists('WC_Report_Stock')) {
    require_once dirname(__FILE__) . '/class-wc-report-stock.php';
}
class WC_Report_Out_Of_Stock extends WC_Report_Stock
{
    public function no_items()
    {
        esc_html_e('No out of stock products found.', 'woocommerce');
    }
    public function get_items($current_page, $per_page)
    {
        global $wpdb;
        $this->max_items = 0;
        $this->items = array();
        $stock = absint(max(get_option('woocommerce_notify_no_stock_amount'), 0));
        $query_from = apply_filters('woocommerce_report_out_of_stock_query_from', $wpdb->prepare("\n\t\t\t\tFROM {$wpdb->posts} as posts\n\t\t\t\tINNER JOIN {$wpdb->wc_product_meta_lookup} AS lookup ON posts.ID = lookup.product_id\n\t\t\t\tWHERE 1=1\n\t\t\t\tAND posts.post_type IN ( 'product', 'product_variation' )\n\t\t\t\tAND posts.post_status = 'publish'\n\t\t\t\tAND lookup.stock_quantity <= %d\n\t\t\t\t", $stock));
        $this->items = $wpdb->get_results($wpdb->prepare("SELECT SQL_CALC_FOUND_ROWS posts.ID as id, posts.post_parent as parent {$query_from} ORDER BY posts.post_title DESC LIMIT %d, %d;", ($current_page - 1) * $per_page, $per_page));
        $this->max_items = $wpdb->get_var('SELECT FOUND_ROWS();');
    }
}