Support » Plugin: WooCommerce Custom Product Tabs Lite » [Plugin: WooCommerce Custom Product Tabs Lite] More than one tab

Viewing 15 replies - 1 through 15 (of 15 total)
  • Hi,
    absolutely ECSTATIC to find this plugin!

    For months we’ve been toiling over outsourcing a PHP developer to custom program this functionality into our WordPress backend. You see, due to the nature of our products, they have ALOT of information for each, which requires quite a lot of scrolling… and this has quite a negative effect on our Bounce Rate.

    Without sounding ungrateful it would, however, be even better if multiple custom tabs could be added.

    Is this on the cards?

    Again, THANK YOU THANK YOU THANK YOU for this!!

    jim

    (@jimcallender)

    yes please – another request from us!

    maryefern

    (@maryefern)

    I also have the need for more than one tab. Is there a simple way we can code this in? Love, love, love this plugin!!

    Would also love to see a second custom tab. This is the only other option I’ve come across: http://www.benblanco.com/how-to-add-custom-product-tab-to-woocommerce-single-product-page/

    +1

    Please for the option to active more than 1 tab. This would be great!

    OOOhh yes! Please more tabs!
    Having one is excellent…having more than one will make the world a much better place 😉

    even if it’s just some way of installing the plugin twice?!

    Hi there, i found a solution, but it’s not really a smart one !
    ok, so here is what i did :

    I simply recreate a class named “WoocommerceCustomProductTabsLite2”
    with exactly the same functions as the original WoocommerceCustomProductTabsLite.

    You only have to modify some little things such as using another “product_tabs meta data” name …

    here is the code I put at the end of woocommerce-custom-product-tabs-lite.php (NB : I also replaced the text area by TinyMCE Area)

    /*  Add a tab
    */
    
    if (!class_exists('WoocommerceCustomProductTabsLite2')) :
    
    class WoocommerceCustomProductTabsLite2 {
    	private $tab_data = false;
    	const VERSION = "1.2.0";
    
    	public function __construct() {add_action( 'woocommerce_init', array(&$this, 'init2' ));if (is_admin() && !defined('DOING_AJAX')) $this->install();}
    	public function init2() {
    		add_action('woocommerce_product_write_panel_tabs', array($this, 'product_write_panel_tab2'));
    		add_action('woocommerce_product_write_panels',	 array($this, 'product_write_panel2'));
    		add_action('woocommerce_process_product_meta',	 array($this, 'product_save_data2'), 10, 2);
    		add_action('woocommerce_product_tabs',	   array($this, 'custom_product_tabs2'),	   25);  // in between the attributes and reviews panels
    		add_action('woocommerce_product_tab_panels', array($this, 'custom_product_tabs_panel2'), 25);
    		add_filter( 'woocommerce_custom_product_tabs_lite_content2', 'do_shortcode' );
    	}
    
    	public function custom_product_tabs2() {
    		global $product;
    
    		if($this->product_has_custom_tabs2($product)) {
    			foreach($this->tab_data as $tab) {
    				echo "<li><a href=\"#{$tab['id']}\">".__($tab['title'])."</a></li>";
    			}
    		}
    	}
    
    	public function custom_product_tabs_panel2() {
    		global $product;
    
    		if($this->product_has_custom_tabs2($product)) {
    			foreach($this->tab_data as $tab) {
    				/*add class entry-content*/
    				echo '<div class="panel entry-content" id="'.$tab['id'].'">';
    				echo '<h2>' . $tab['title'] . '</h2>';
    				echo apply_filters( 'woocommerce_custom_product_tabs_lite_content2', $tab['content'], $tab['id'] );
    				echo '</div>';
    
    			}
    		}
    	}
    
    	private function product_has_custom_tabs2($product) {
    		if($this->tab_data === false) {
    			$this->tab_data = maybe_unserialize( get_post_meta($product->id, 'frs_woo_product_tabs_2', true) );
    		}
    		// tab must at least have a title to exist
    		return !empty($this->tab_data) && !empty($this->tab_data[0]) && !empty($this->tab_data[0]['title']);
    	}
    
    	public function product_write_panel_tab2() {
    		echo "<li><a style=\"color:#555555;line-height:16px;padding:9px;text-shadow:0 1px 1px #FFFFFF;\" href=\"#product_tabs2\">".__('Custom Tab 2')."</a></li>";
    	}
    
    	public function product_write_panel2() {
    		global $post;  // the product
    
    		$tab_data = maybe_unserialize( get_post_meta($post->ID, 'frs_woo_product_tabs_2', true) );
    		if(empty($tab_data)) {
    			$tab_data[] = array('title' => '', 'content' => '');
    		}
    		foreach($tab_data as $tab) {
    			// display the custom tab panel
    			echo '<div id="product_tabs2" class="panel woocommerce_options_panel">';
    			woocommerce_wp_text_input( array( 'id' => '_tab_title2', 'label' => __('Tab Title 2'), 'description' => __('Required for tab to be visible'), 'value' => $tab['title'] ) );
    			$this->woocommerce_wp_textarea_input2( array( 'id' => '_tab_content2', 'label' => __('Content 2'), 'placeholder' => __('HTML and text to display2.'), 'value' => $tab['content'], 'style' => 'width:70%;height:21.5em;' ) );
    			echo '</div>';
    		}
    	}
    
    	private function woocommerce_wp_textarea_input2( $field ) {
    		global $thepostid, $post;
    
    		if (!$thepostid) $thepostid = $post->ID;
    		if (!isset($field['placeholder'])) $field['placeholder'] = '';
    		if (!isset($field['class'])) $field['class'] = 'short';
    		if (!isset($field['value'])) $field['value'] = get_post_meta($thepostid, $field['id'], true);
    
    		echo '<style type="text/css">';
    		echo '.quicktags-toolbar input {width: auto;}';
    		echo '#wp-'.$field['id'].'-editor-container {background-color: white;}';
    		echo '</style>';
    		echo '<p> Content </p>';
    		/* TinyMCE */
    		the_editor( $field['value'],$field['id']);
    
    	}
    
    	public function product_save_data2( $post_id, $post ) {
    
    		$tab_title   = stripslashes($_POST['_tab_title2']);
    		$tab_content = stripslashes($_POST['_tab_content2']);
    
    		if(empty($tab_title) && empty($tab_content) && get_post_meta($post_id, 'frs_woo_product_tabs_2', true)) {
    			// clean up if the custom tabs are removed
    			delete_post_meta($post_id, 'frs_woo_product_tabs_2');
    		} elseif(!empty($tab_title) || !empty($tab_content)) {
    			$tab_data = array();
    
    			$tab_id = '';
    			if($tab_title) {
    				// convert the tab title into an id string
    				$tab_id = strtolower($tab_title);
    				$tab_id = preg_replace("/[^\w\s]/",'',$tab_id);  // remove non-alphas, numbers, underscores or whitespace
    				$tab_id = preg_replace("/_+/", ' ', $tab_id);	// replace all underscores with single spaces
    				$tab_id = preg_replace("/\s+/", '-', $tab_id);   // replace all multiple spaces with single dashes
    				$tab_id = 'tab-'.$tab_id;						// prepend with 'tab-' string
    			}
    
    			// save the data to the database
    			$tab_data[] = array('title' => $tab_title,
    								'id' => $tab_id,
    								'content' => $tab_content);
    			update_post_meta($post_id, 'frs_woo_product_tabs_2', $tab_data);
    			echo $tab_content;
    		}
    	}
    
    	private function install() {
    		if(get_option('woocommerce_custom_product_tabs_lite_db_version') != WoocommerceCustomProductTabsLite2::VERSION) {
    			$this->upgrade();
    
    			// new version number
    			update_option('woocommerce_custom_product_tabs_lite_db_version', WoocommerceCustomProductTabsLite2::VERSION);
    		}
    	}
    
    	private function upgrade() {
    		global $wpdb;
    		if(!get_option('woocommerce_custom_product_tabs_lite_db_version')) {
    			// this is one of the couple of original users who installed before I had a version option in the db
    			 // rename the post meta option 'product_tabs' to 'frs_woo_product_tabs_2'
    			$wpdb->query("UPDATE {$wpdb->postmeta} SET meta_key='frs_woo_product_tabs_2' WHERE meta_key='product_tabs2';");
    		}
    	}
    
    	public static function on_activation() {
    		// checks if the woocommerce plugin is running and disables this plugin if it's not (and displays a message)
    		if (!is_plugin_active('woocommerce/woocommerce.php')) {
    			deactivate_plugins(plugin_basename(__FILE__));
    			wp_die(__('The WooCommerce Product Tabs Lite requires <a href="http://www.woothemes.com/woocommerce/" target="_blank">WooCommerce</a> to be activated in order to work. Please install and activate <a href="http://www.woothemes.com/woocommerce/" target="_blank">WooCommerce</a> first. <a href="'.admin_url('plugins.php').'"> <br> &laquo; Go Back</a>'));
    		}
    
    		// set version number
    		update_option('woocommerce_custom_product_tabs_lite_db_version', WoocommerceCustomProductTabsLite2::VERSION);
    	}
    }
    
    /**
     * instantiate class
     */
    $woocommerce_product_tabs_lite2 = new WoocommerceCustomProductTabsLite2();
    
    endif; // class exists check
    
    /**
     * run the plugin activation hook
     */
    register_activation_hook(__FILE__, array('WoocommerceCustomProductTabsLite2', 'on_activation'));

    Hey Guys, there is no plan to add the ability to have a second tab to this plugin I’m afraid; it’s really meant to be the ‘lite’ version of the paid Tab Manager plugin now available on WooThemes http://www.woothemes.com/products/woocommerce-tab-manager/ which allows for multiple tabs, rearranging tabs, global shared tabs, content editing using the rich editor, improved support, and more.

    Sorry about this, I try to provide some free plugins as a service to those who don’t need the full functionality that the paid ones provides, but I only have so much time to allocate for the freebies as the paid plugins I release are actually the main way I pay the bills around here. Thanks!

    Hi,

    This sites claims to offer “woocommerce tab manager” extension but I think it does not exist as a plugin. Even if I paid via paypal for this product they did not send me any download link or add the product to my account.

    If such a plugin does not exist, it is not ethically right to sell it online. The funny thing is after I sent the mail to them that I provide some feedback about the payment, they do not look at the paypal account and when I sent any email that highlights this problem, they merge request again and again instead of solving the problem. 🙂

    Please make sure that this plugin really exists then buy it.

    Cheers…

    Hi,

    Yess. This plugin exists 🙂 Mark Forrester handled the issue. I thought that this extension is just a wish or dream because it was so good to be true but it exist. Downloaded and it works. Thank you so much Mark.

    Respect…

    Hai tamerch!

    Your are really great!

    Thanks for the code.

    Regards,
    Jay

    hi can have the product description and review tab for categories discription…

    thanks

    Thank you for this plugin it’s great and just what I| needed however, on the product view page I don’t get any tabs only text do I need to click or activate something somewhere.

    Thanks
    Chris

    closing this as there are no plans to add support for additional tabs at this point

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘[Plugin: WooCommerce Custom Product Tabs Lite] More than one tab’ is closed to new replies.