コード例 #1
0
function wp_estore_products_table()
{
    $i = 0;
    $output .= '
	<table class="widefat">
	<thead><tr>
	<th scope="col">' . __('Products', 'wp_eStore') . '</th>
	</tr></thead>
	<tbody>';
    //set pages to include $limit records per page
    $limit = get_option('eStore_products_per_page');
    if (isset($_GET['product_page'])) {
        $page = strip_tags($_GET['product_page']);
    } else {
        $page = 1;
    }
    $start = ($page - 1) * $limit;
    global $wpdb;
    $products_table_name = $wpdb->prefix . "wp_eStore_tbl";
    //$products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME;
    $wp_eStore_db = $wpdb->get_results("SELECT * FROM {$products_table_name} ORDER BY id DESC LIMIT {$start}, {$limit}", OBJECT);
    //get total rows
    $totalrows = $wpdb->get_var("SELECT COUNT(*) FROM {$products_table_name};");
    if ($wp_eStore_db) {
        foreach ($wp_eStore_db as $wp_eStore_db) {
            if ($i % 2 == 0) {
                $output .= "<tr bgcolor='#F4F6FA'>";
                $i++;
            } else {
                $output .= "<tr bgcolor='#E9EDF5'>";
                $i++;
            }
            $output .= '<td><strong>' . $wp_eStore_db->name . '</strong><br> ' . WP_ESTORE_CURRENCY_SYMBOL . $wp_eStore_db->price . '<br>';
            $output .= get_button_code_for_product($wp_eStore_db->id);
            $output .= '<br></td></tr>';
        }
    }
    $output .= '</tbody>
	</table>';
    $output .= wp_eStore_generate_pagination_section($totalrows, $limit);
    return $output;
}
コード例 #2
0
function print_wp_digi_cart_button_for_product($id)
{
    // This function has been deprecated. Use the "get_button_code_for_product" function instead
    $replacement = get_button_code_for_product($id);
    return $replacement;
}