diff --git a/inc/features/basics.php b/inc/features/basics.php index 9d96d797..1dcd7073 100644 --- a/inc/features/basics.php +++ b/inc/features/basics.php @@ -21,6 +21,7 @@ class Basics extends Shortcode_Base{ public function run(){ $this->filter('body_class'); $this->action('wpt_bottom', 1, 10, 'edit_button'); + $this->action('wpt_bottom', 1, 10, 'add_new_button'); $this->action('woocommerce_widget_shopping_cart_buttons', 1, 10, 'empty_cart_button'); } @@ -36,7 +37,7 @@ public function body_class( $class ){ } public function edit_button( Shortcode $shortcode ){ - + if( $shortcode->fake_property ) return; if( ! current_user_can( WPT_CAPABILITY ) ) return; ?> @@ -52,6 +53,26 @@ public function edit_button( Shortcode $shortcode ){ fake_property ) return; + if( ! current_user_can( WPT_CAPABILITY ) ) return; + + ?> +
+ + + + +
+ To get More feature, Please create a table by following button. How to create a Product Table +
+
+ + atts['behavior'] ?? ''; - if( $behavior !== 'normal' && ( is_shop() || is_product_taxonomy() || is_product_category() ) ) return; + // if( $behavior !== 'normal' && ( is_shop() || is_product_taxonomy() || is_product_category() ) ) return; self::$reset_button = ""; //end of .search_single self::$cf_search_box = $shortcode->search_n_filter['cf_search_box'] ?? ''; self::$taxonomy_keywords = $shortcode->search_n_filter['taxonomy_keywords'] ?? []; diff --git a/inc/shortcode.php b/inc/shortcode.php index 9bede78f..be75bde5 100644 --- a/inc/shortcode.php +++ b/inc/shortcode.php @@ -274,6 +274,8 @@ public function shortcode($atts){ extract( shortcode_atts( $pairs, $atts ) ); $this->assing_property($atts); + + //Obviously should load on after starup. Even already checked on overr there $this->startup_loader($atts); @@ -505,7 +507,7 @@ public function assing_property( $atts ){ set_query_var( $this->req_post_type, $this->table_id ); $this->is_table = $this->table_id && $this->post_type == $this->req_post_type && $this->status == 'publish'; - if( ! $this->is_table ){ + if( ! $this->is_table && ! empty( $this->atts ) ){ return Msg::not_found($this); } @@ -698,10 +700,53 @@ public function assing_property( $atts ){ $this->is_column_label = $this->table_style['tr.wpt_table_head th']['auto-responsive-column-label'] ?? false; $this->assing_property = true; - + if( empty( $this->atts ) ){ + $this->fake_assing_property();//Msg::not_found($this); + } return $this; } + /** + * Sometime user just page shortcode [Product_Table] + * without atts, + * then we will use this actually + * + * @return void + */ + public function fake_assing_property(){ + $this->fake_property = true; + + $this->args = [ + 'post_type' => 'product', + 'posts_per_page' => 30, + 'wpt_query_type' => 'default', + 'pagination' => '1', + 'suppress_filters' => '1', + 'orderby' => 'menu_order', + 'order' => 'DESC', + 'paged' => $this->args['paged'] ?? 1, + ]; + $this->_enable_cols = [ + // '_price' => '_price', + 'product_title' => 'product_title', + 'stock' => 'stock', + 'price' => 'price', + 'category' => 'category', + 'short_description' => 'short_description', + // 'quantity' => 'quantity', + // 'action' => 'action', + ]; + foreach($this->_enable_cols as $en_col_key => $en_col){ + $this->column_settings[$en_col_key] = [ + 'type' => 'default', + 'type_name' => 'Default', + 'tag_class' => "auto_item_$en_col_key item_$en_col_key", + ]; + } + + $this->is_table_head = true; + } + public function enqueue(){ $this->assets_element_url = $this->assets_url . 'css/elements/'; diff --git a/readme.txt b/readme.txt index 057efc7f..68ab1861 100644 --- a/readme.txt +++ b/readme.txt @@ -338,6 +338,7 @@ You can easily show specific category products. While creating new table click o * Added: New filter hook added for Inner Item. hook: `wpt_item_content`. * Fixed: Search Result has been fixed based on 'relevance'. * Fixed: Sorting Icon fixed and updated to latest icon. +* Added: Displaying tabl without atts - feature added. It's actually for sample table. = 3.4.6 = * Fixed: Asc/Desc icon fixed (Table Title) diff --git a/woo-product-table.php b/woo-product-table.php index 7c0c99ba..e637ee2f 100644 --- a/woo-product-table.php +++ b/woo-product-table.php @@ -33,7 +33,7 @@ } if( ! defined( 'WPT_DEV_VERSION' ) ){ - define( 'WPT_DEV_VERSION', '3.4.7.2' ); + define( 'WPT_DEV_VERSION', '3.4.7.4' ); } if( ! defined( 'WPT_CAPABILITY' ) ){