Profit Products Tables For Woocommerce Shortcodes

Below, you’ll find a detailed guide on how to add the Profit Products Tables For Woocommerce Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Profit Products Tables For Woocommerce Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Profit Products Tables For Woocommerce Plugin and the shortcodes it provides:

Plugin Icon
Active Products Tables for WooCommerce. Professional products tables for WooCommerce store 

"Active Products Tables for WooCommerce is a professional plugin that enhances your WooCommerce store by creating efficient, engaging product tables. Boost your profits with this easy-to-use tool."

★★★★☆ (14) Active Installs: 2000+ Tested with: 6.3.2 PHP Version: 7.2
Included Shortcodes:
  • [woot]
  • [woot_button]

Profit Products Tables For Woocommerce [woot] Shortcode

The ‘woot’ shortcode from the Profit-Products-Tables-for-Woocommerce plugin creates a product table on a WooCommerce site. The shortcode checks if a table with the specified ID exists. It generates a unique HTML ID for the table if one isn’t provided. It also applies different themes based on the ‘skin’ argument. The shortcode further allows for customization of the table’s appearance and functionality, including text search, filter form, and display cell info. It returns a rendered HTML table with the specified settings.

Shortcode: [woot]

Parameters

Here is a list of all possible woot shortcode parameters and attributes:

  • id – Identifies the specific table to display.
  • table_html_id – Specifies a unique HTML ID for the table.
  • skin – Changes the table’s appearance with different skins.
  • action – Defines the action to be performed by the table.
  • display_cell_info – Toggles the display of cell information.
  • disable_filter_form – Disables the table’s filter form.
  • mode – Determines the format of the table’s output.
  • filter_form – Defines the filter form data for the table.
  • hide_text_search – Hides the text search functionality.
  • text_search_min_symbols – Sets the minimum symbols for text search.
  • text_search_placeholder – Sets placeholder text for the search field.
  • classes – Assigns specific CSS classes to the table.
  • hide_filter_form – Hides the filter form of the table.
  • orderby_select_fields – Defines fields for order-by select options.
  • cart_position – Sets the position of the cart in the table.
  • table_view – Sets the view mode of the table.

Examples and Usage

Basic example – Display a table with a specific ID

[woot id="1"]

Advanced examples

Display a table with a specific ID and a unique HTML ID for the table

[woot id="1" table_html_id="my_unique_table"]

Display a table with a specific ID and disable the filter form

[woot id="1" disable_filter_form="true"]

Display a table with a specific ID and a custom skin

[woot id="1" skin="my_custom_skin"]

Display a table with a specific ID, hide the text search, and set a custom minimum symbol for text search

[woot id="1" hide_text_search="true" text_search_min_symbols="5"]

Display a table with a specific ID and set a custom placeholder for the text search

[woot id="1" text_search_placeholder="Search for products..."]

Display a table with a specific ID and set a custom action

[woot id="1" action="my_custom_action"]

Display a table with a specific ID and hide the filter form

[woot id="1" hide_filter_form="true"]

Display a table with a specific ID and set a custom cart position

[woot id="1" cart_position="2"]

Display a table with a specific ID and set a custom table view

[woot id="1" table_view="grid"]

PHP Function Code

In case you have difficulties debugging what causing issues with [woot] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('woot', array($this, 'do_shortcode'));

Shortcode PHP function:

function do_shortcode($args) {
        $this->include_assets();

        $args = (array) $args;

        $table_id = 0;
        if (isset($args['id'])) {
            $table_id = intval($args['id']);
        }

        if ($table_id > 0) {
            if (!$this->tables->is_exists($table_id)) {
                return '<div class="woot-notice">' . sprintf(esc_html__('Table #%s does not exists!', 'profit-products-tables-for-woocommerce'), $table_id) . '</div>';
            }
        }

        $table_html_id = '';

        //+++

        if ($table_id > 0 AND!isset($args['table_html_id'])) {
            $table_html_id = $this->columns->options->get($table_id, 'table_html_id', '');
        }

        if (isset($args['table_html_id'])) {
            $table_html_id = $args['table_html_id'];
        }

        if (empty($table_html_id)) {
            $table_html_id = uniqid('t');
        }

        //***

        $args['action'] = WOOT_WooCommerce::$action; //HARDCODED FOR WOOT
        //***
        $style = '';

        //for skin switcher
        if (isset($_GET['woot_skin'])) {
            $args['skin'] = WOOT_HELPER::sanitize_text($_GET['woot_skin']);
        }

        if (isset($args['skin'])) {
            $style = $this->skins->get_theme_css($args['skin'], $table_html_id);
        } else {
            $style = $this->skins->get_theme_css($table_id, $table_html_id);
        }

        if (isset($args['id'])) {
            $style .= woot()->columns->get_colums_css($table_id, $table_html_id);
            $style .= WOOT_Settings::get_table_custom_prepared_css($table_id, $table_html_id);
        }

        //***
        //simple shortcode [woot]
        if (!isset($args['id']) AND!isset($args['columns'])) {
            $args['columns'] = implode(',', $this->default_columns);
        }

        //***

        $args['no_found_text'] = apply_filters('woot_no_found_text', '', $table_id);

        $classes = apply_filters('woot_table_classes', $args)['classes'];

        if ($table_id > 0) {
            if (woot()->columns->options->get($table_id, 'display_cell_info', false)) {
                $classes .= ' woot-define-display-cell-info';
            }
        }

        if (isset($args['display_cell_info']) AND $args['display_cell_info']) {
            $classes .= ' woot-define-display-cell-info';
        }

        //+++
        $disable_filter_form = isset($args['disable_filter_form']) ? boolval($args['disable_filter_form']) : ($table_id > 0 ? boolval($this->columns->options->get($table_id, 'disable_filter_form', false)) : FALSE);

        if (isset($args['mode'])) {
            if (in_array($args['mode'], ['json', 'to_json'])) {
                $disable_filter_form = true;
            }
        }

        $filter = NULL;
        if (!$disable_filter_form) {
            $filter = $this->filter->draw_filter_form_data((isset($args['filter_form']) ? $args['filter_form'] : ''), $table_id);
        }

        $args = apply_filters('woot_review_shortcode_args', $args);

        return WOOT_HELPER::render_html('views/table.php', array(
                    'table_html_id' => $table_html_id,
                    'table_id' => $table_id,
                    'published' => ($table_id > 0 && $this->tables->get($table_id)) ? $this->tables->get($table_id)['status'] : true,
                    'hide_text_search' => isset($args['hide_text_search']) ? boolval($args['hide_text_search']) : ($table_id > 0 ? !boolval($this->columns->options->get($table_id, 'show_text_search', true)) : false),
                    'skin' => isset($args['skin']) ? strval($args['skin']) : ($table_id > 0 ? strval($this->skins->get($table_id)) : ''),
                    'text_search_min_symbols' => isset($args['text_search_min_symbols']) ? intval($args['text_search_min_symbols']) : ($table_id > 0 ? $this->columns->options->get($table_id, 'text_search_min_symbols', 3) : 0),
                    'placeholder' => isset($args['text_search_placeholder']) ? WOOT_Vocabulary::get($args['text_search_placeholder']) : ($table_id > 0 ? WOOT_Vocabulary::get($this->columns->options->get($table_id, 'text_search_placeholder', esc_html__('search by title', 'profit-products-tables-for-woocommerce') . ' ...')) : ''),
                    'action' => $table_id > 0 ? WOOT::get_table_action($table_id) : (isset($args['action']) ? $args['action'] : ''),
                    'classes' => $classes,
                    'filter' => $filter,
                    'has_filter' => isset($args['filter_form']) ? boolval(!empty($args['filter_form'])) : ($table_id > 0 ? boolval(count((array) woot()->columns->filter->get_acceptor_keys($table_id))) : FALSE),
                    'hide_filter_form' => isset($args['hide_filter_form']) ? boolval($args['hide_filter_form']) : ($table_id > 0 ? boolval($this->columns->options->get($table_id, 'hide_filter_form', false)) : FALSE),
                    'style' => $style,
                    'orderby_select' => WOOT_WooCommerce::get_select_orderby_options(isset($args['orderby_select_fields']) ? $args['orderby_select_fields'] : (($table_id > 0 AND $this->columns->options->get($table_id, 'is_sort_droptdown_shown', 0)) ? $this->columns->options->get($table_id, 'orderby_select_fields', '') : ''), $table_id),
                    'cart_position' => isset($args['cart_position']) ? intval($args['cart_position']) : (($table_id > 0 ? $this->columns->options->get($table_id, 'cart_position', 0) : 0)),
                    'table_view' => isset($args['table_view']) ? $args['table_view'] : ''
                )) . $this->draw_table_data($args, $table_html_id);
    }

Code file location:

profit-products-tables-for-woocommerce/profit-products-tables-for-woocommerce/index.php

Profit Products Tables For Woocommerce [woot_button] Shortcode

The Profit Products Tables for WooCommerce shortcode, ‘woot_button’, is used to create a customizable button. It includes parameters for button title, popup title, help title, help link, and class. This shortcode includes assets and provides options to customize the button title. If no title is specified, it defaults to ‘click on me’. It also allows setting up a popup title and help title. You can link the help title to a URL using the ‘help_link’ parameter. Lastly, you can add custom classes to style the button.

Shortcode: [woot_button]

Parameters

Here is a list of all possible woot_button shortcode parameters and attributes:

  • title – Defines the text displayed on the button
  • popup_title – Sets the title of the popup when the button is clicked
  • help_title – Sets the title of the help tooltip on hover
  • help_link – Specifies the URL for the help link
  • class – Allows you to set a custom CSS class for the button

Examples and Usage

Basic example – Display a button with a predefined title “Click on me”. The button will open a popup with a default title.

[woot_button /]

Advanced examples

Display a button with a custom title “Buy Now”. The button will open a popup with a title “Product Details”.

[woot_button title="Buy Now" popup_title="Product Details" /]

Display a button with a custom title “More Info” and a custom CSS class “my-button”. The button will open a popup with a title “Product Info” and a help link that redirects to a specific URL.

[woot_button title="More Info" popup_title="Product Info" help_link="http://example.com/help" class="my-button" /]

Display a button with a custom title “Details”, a custom CSS class “info-button”, a help title “Need Help?”, and a help link that redirects to a specific URL.

[woot_button title="Details" help_title="Need Help?" help_link="http://example.com/help" class="info-button" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [woot_button] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('woot_button', array($this, 'do_shortcode_button'));

Shortcode PHP function:

function do_shortcode_button($args) {
        $this->include_assets();

        $title = '';
        if (isset($args['title'])) {
            $title = WOOT_Vocabulary::get($args['title']);
            unset($args['title']);
        }

        if (empty($title)) {
            $title = WOOT_Vocabulary::get(esc_html__('click on me', 'profit-products-tables-for-woocommerce'));
        }

        $popup_title = '';
        if (isset($args['popup_title'])) {
            $popup_title = WOOT_Vocabulary::get($args['popup_title']);
            unset($args['popup_title']);
        }

        $help_title = '';
        if (isset($args['help_title'])) {
            $help_title = WOOT_Vocabulary::get($args['help_title']);
            $help_title = trim($help_title, '"');
            $help_title = trim($help_title, "'");
            unset($args['help_title']);
        }

        $help_link = '';
        if (isset($args['help_link'])) {
            $help_link = $args['help_link'];
            unset($args['help_link']);
        }

        $class = '';
        if (isset($args['class'])) {
            $class = $args['class'];
            unset($args['class']);
        }

        $args_json = json_encode($args);

        return WOOT_HELPER::draw_html_item('a', [
                    'href' => "javascript: new Popup23({title: \"{$popup_title}\",help_title: \"{$help_title}\",help_link: \"{$help_link}\",post_id: -1, what: JSON.stringify({$args_json})}); void(0);",
                    'title' => $popup_title,
                    'class' => $class
                        ], $title);
    }

Code file location:

profit-products-tables-for-woocommerce/profit-products-tables-for-woocommerce/index.php

Conclusion

Now that you’ve learned how to embed the Profit Products Tables For Woocommerce Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *