From 4ca9102239ff2768789c84e02d4f4d7e70c39546 Mon Sep 17 00:00:00 2001 From: Shramee Srivastav Date: Sat, 30 Nov 2019 14:35:17 +0800 Subject: [PATCH] Addressing #751 page builder shop --- .../woocommerce/class-ppb-for-woocommerce.php | 6 ++++ .../inc/ext/woocommerce/inc/class-admin.php | 16 +++++++++- .../inc/ext/woocommerce/inc/class-public.php | 29 +++++++++++++++++-- readme.txt | 4 +-- 4 files changed, 50 insertions(+), 5 deletions(-) diff --git a/ppbpro/inc/ext/woocommerce/class-ppb-for-woocommerce.php b/ppbpro/inc/ext/woocommerce/class-ppb-for-woocommerce.php index 3fc48d2..de32b0d 100755 --- a/ppbpro/inc/ext/woocommerce/class-ppb-for-woocommerce.php +++ b/ppbpro/inc/ext/woocommerce/class-ppb-for-woocommerce.php @@ -96,6 +96,7 @@ private function __construct( $file ) { add_action( 'init', array( $this, 'init' ) ); add_action( 'admin_init', array( $this, 'check_ppb_version' ) ); + } // End __construct() /** @@ -140,6 +141,9 @@ private function _admin() { add_filter( 'pootlepb_content_block_fields', array( $this->admin, 'content_block_fields' ) ); //Add our awesome stuff add_action( 'pootlepb_content_block_wc_prods_tab_after_fields', array( $this->admin, 'wc_required_notice' ) ); + // Adds shop replace setting + add_action( 'admin_init', array( $this->admin, 'admin_init' ) ); + } @@ -157,6 +161,8 @@ private function _public() { add_filter( 'woocommerce_tab_manager_tab_panel_content', array( $this->public, 'wc_tabs_filter' ), 7, 3 ); //Add the products to content block add_action( 'pootlepb_render_content_block', array( $this->public, 'render_products' ), 52 ); + // Process PPB shop page + add_action( 'woocommerce_archive_description', array( $this->public, 'maybe_clear_shop_content' ), 99 ); } // End enqueue() diff --git a/ppbpro/inc/ext/woocommerce/inc/class-admin.php b/ppbpro/inc/ext/woocommerce/inc/class-admin.php index 5c06433..ff4f322 100755 --- a/ppbpro/inc/ext/woocommerce/inc/class-admin.php +++ b/ppbpro/inc/ext/woocommerce/inc/class-admin.php @@ -32,7 +32,7 @@ class pootle_page_builder_for_WooCommerce_Admin{ /** * Main Pootle Slider Instance * Ensures only one instance of Storefront_Extension_Boilerplate is loaded or can be loaded. - * @return pootle_page_builder_for_WooCommerce instance + * @return self instance * @since 1.0.0 */ public static function instance() { @@ -305,4 +305,18 @@ public function wc_required_notice() { return; } } + + public function admin_init() { + register_setting( 'pootlepage-display', 'ppb_wc_shop' ); + add_settings_field( 'ppb_wc_shop', __( 'Enable Page Builder Shop', 'ppb-panels' ), [ $this, 'render_shop_field' ], 'pootlepage-display', 'display' ); + } + + public function render_shop_field() { + ?> + + + +