=== Simple Product Table for WooCommerce ===
Contributors: bluegamediversion
Tags: woocommerce, product table, product list, order form, datatable
Requires at least: 5.9
Tested up to: 7.0
Requires PHP: 7.4
WC requires at least: 7.0.0
WC tested up to: 10.8
Stable tag: 1.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Display WooCommerce products in a responsive, searchable and sortable table with a built-in add-to-cart order form.

== Description ==

**Simple Product Table for WooCommerce** lets you display your products in a clean, interactive table layout. Customers can search, sort, set quantities and add multiple items to their cart — all without leaving the page.

= Key Features =

* **Column builder** — choose which columns to display: product name, thumbnail, price, quantity input and add-to-cart button
* **Instant search and sort** — powered by DataTables, no page reload required
* **Shortcode-based** — place `[sptable id="X"]` anywhere on your site
* **Product Lists** — group specific products into curated lists, then assign those lists to tables
* **AJAX add to cart** — customers add multiple products without a page reload
* **Mobile responsive** — works on all screen sizes

= How It Works =

1. Go to **Simple Product Table → Products Lists** and create a product list by selecting the WooCommerce products to include
2. Go to **Simple Product Table** and create a new table, choose the columns, and assign the product list
3. Copy the generated shortcode (e.g. `[sptable id="42"]`) and paste it on any page or post

= Use Cases =

* Wholesale / B2B quick-order forms
* Restaurant or food menus with direct cart access
* Product catalogs for distributors
* Any store that sells multiple products at once

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`
2. Activate the plugin through the **Plugins** menu in WordPress
3. Ensure WooCommerce is installed and active — the plugin will display an admin notice if it is not
4. Go to **Simple Product Table → Products Lists** to create your first product list
5. Go to **Simple Product Table** to create a table, configure columns and assign a list
6. Copy the generated shortcode and paste it on any page or post

== Frequently Asked Questions ==

= Does this plugin require WooCommerce? =

Yes. WooCommerce must be installed and active. The plugin will display an admin notice and stop loading if WooCommerce is not detected.

= Can I display multiple tables on the same page? =

Yes. You can use multiple `[sptable id="X"]` shortcodes on the same page, each pointing to a different table.

= Can I control which products appear in a table? =

Yes. First create a Product List and select the products to include, then assign that list to a table.

= Does the table work on mobile? =

Yes. The table is mobile-responsive through DataTables.

= Can guests (non-logged-in users) add products to their cart? =

Yes. The add-to-cart action works for both logged-in and guest users, consistent with standard WooCommerce behaviour.

== Third-Party Libraries ==

This plugin bundles the following open-source libraries. Both are distributed under the MIT License, which is GPL-compatible.

* **DataTables** (MIT License)
  Homepage: https://datatables.net
  Source: https://github.com/DataTables/DataTables

* **Select2** (MIT License)
  Homepage: https://select2.org
  Source: https://github.com/select2/select2

== Changelog ==

= 1.1.0 =
* Security: added nonce verification to the AJAX add-to-cart handler
* Security: added absint() sanitization for product_id and product_qty in the AJAX handler
* Fix: corrected hardcoded post ID that prevented tables from displaying on any site other than the development environment
* Fix: corrected HTML output for sold-individually products in the quantity column (esc_attr was stripping the hidden input markup)
* Fix: added null check for get_current_screen() in admin script loader to prevent fatal errors on edge-case screens
* Fix: replaced nopaging => true with explicit numberposts limits to prevent unbounded database queries
* Compatibility: updated for WordPress 6.8 and WooCommerce 9.4
* Compatibility: added WooCommerce dependency check with admin notice on activation
* Compatibility: replaced dirname(__FILE__) with __DIR__ throughout
* Code: fixed blank lines before closing braces (PSR-2)
* Code: updated all @link docblock references
* Code: renamed Sptable_i18n to Sptable_I18n to follow PEAR naming conventions

= 1.0.0 =
* Initial release

== Upgrade Notice ==

= 1.1.0 =
Security and compatibility update. Fixes a critical bug that prevented tables from displaying and adds nonce protection to the add-to-cart AJAX action. Upgrade recommended for all users.
