Forum Replies Created

Viewing 15 replies - 226 through 240 (of 567 total)
  • Hi @silverfox93,

    Can you check your browser’s dev tools console? Pull it up before trying to delete/modify and see if any warnings or error messages pop up.

    Can you also check your site’s debug.log file? It’s located in the wordpress/wp-content folder. You may need to enable debugging.

    Bringing up the wrong forms is very strange. You may want to try clearing your browser cache and cookies.

    Let me know what you find,
    Jon

    Hi @sacredsamf,

    That’s a good catch. I will add it to our TODO list.

    Jon

    Hi @dwc_user,

    If you are just looking to import products, you may look into the WooCommerce CSV importer. It’s a tool built-in to WooCommerce.

    You’ll perform an export on your old site (making sure to check the include custom meta box) and then you’ll perform an import on your new site (making sure to select “Update Existing Posts”). It should add the missing meta to each of your products.

    Take a backup before doing the import in case you need to change something.

    Let me know if that helps,
    Jon

    Hi @bureauit,

    So an issue like that almost certainly means that database entries have been modified without correctly unserializing and re-serializing the data. This is generally due to manual editing of database entries or performing activities like a search and replace with tools that don’t handle serialized data.

    If I take the array of information out of that serialized data and build the data correctly like this:

    array(
    	array(
    		'title' => 'Брошюры',
    		'id' => 'брошюры',
    		'content' => '<a href="https://interanalyt.ru/wp-content/uploads/2021/05/gc-2014-flyer-03.18.pdf" rel="nofollow ugc">ГХ 2014 (пдф)</a>'
    	)
    )

    And I run that through the serialize function I get this:

    a:1:{i:0;a:3:{s:5:"title";s:14:"Брошюры";s:2:"id";s:14:"брошюры";s:7:"content";s:125:"<a href="https://interanalyt.ru/wp-content/uploads/2021/05/gc-2014-flyer-03.18.pdf" rel="nofollow ugc">ГХ 2014 (пдф)</a>";}}

    Serialized data is labeled sort of like this: type:length:"content". If you make changes to the data (such as through a search and replace) but don’t change the length property, the data will no longer be valid.

    Let me know if that helps,
    Jon

    Hi @andrew55,

    That code is actually javascript, so you will want to save it as a .js file in your theme and then enqueue it using wp_enqueue_script. You will write the code to enqueue your new js file in your functions.php file.

    Let me know if that helps,
    Jon

    Hi @amanfredini,

    Ah, I totally misunderstood what you were looking to do. You actually want to write data to the database.

    The tabs are stored as post meta, so you can use the update_post_meta function. yikes_woo_products_tabs is the meta key. You’ll want to shape the data this:

    array(
    	array(
    		'title' => 'Tab Title',
    		'id' => 'tab-title',
    		'content' => '<p>Some html</p>'
    	)
    )

    Let me know if that helps,
    Jon

    Thank you @silverfox93! Glad we could help 🙂

    Hi @amanfredini,

    So the add filter is going to run each time a product page loads. We just need to check (inside the filter function) if you are on the correct product.

    add_filter( 'woocommerce_product_tabs', 'yikes_edit_tab_content', 98 );
    
    function yikes_edit_tab_content( $tabs ) {
    	global $product;
    	$id = $product->get_id();
    
    	// Check desired product ID.
    	if ( $id === 0 ) {
    		foreach( array_keys( $tabs ) as $key ) {
    			if ('tab-slug' === $key) {
    				$tabs[$key]['content'] = 'My new content';	
    			}
    		}
    	}
    
    	return $tabs;
    }

    If you need to do this with multiple products, you can create an associative array above the function call that is keyed on the product ID with the content as the value. Something like this:

    $arr = array(
            10 => 'My content for product ID 10',
    );

    Then you’ll pull the content value from the array above instead of setting it manually in your filter function.

    That being said, the reason for using a plugin like ours is to avoid doing that sort of thing. If you need conditional content for a single product it can make sense to do this, but otherwise, you are probably better off defining a shortcode and adding that shortcode to a product tab using our plugin.

    Let me know if that helps,
    Jon

    Hi @bureauit,

    Looking at your screenshot, I see some products with tab data and some without. When I look at the frontend of your site, it looks like the markup for those tabs is not being echoed. That can be caused by a number of issues, but if you deleted the plugin and reinstalled it, the tab data is likely no longer there. Most plugins clean up their database entries when deleted, and our plugin does as well.

    Can you check once again on your post meta table and see if the entries remain?

    Thanks,
    Jon

    Hi @dwc_user,

    You can definitely acquire all of the data by selecting all records from wp_postmeta where meta_key is yikes_woo_products_tabs, but you probably cannot directly copy. Each row in wp_postmeta has an ID and you don’t want to override any existing ID’s by copying in new rows.

    I’d recommend exporting that data to a CSV or JSON file and then writing a script to update each post with the associated key. This way you can assign the right value to the right post, but let your new site take care of the ID’s. A custom WP_CLI command would probably be the simplest option here. Have it take the path of your CSV file as an argument. Load the file, loop through each row, and update the post meta.

    Using WP_CLI requires SSH access to the server. If you don’t have that, you can take a look at either creating a REST API route or an admin page with an upload form.

    Let me know if that helps,
    Jon

    @herbalbliss Could you elaborate more on them being overridden? Do you see the tabs on the admin side?

    @videogamedepot Are you saying that your Saved Tabs are no longer being applied to your products, but the Product Tabs are? Do you still see the Saved Tabs on the plugin page?

    To clarify – you would wrap the entire thing in an if statement checking if you are on the correct product.

    Hi @amanfredini,

    Yes. If the loop hasn’t been modified, get_the_ID() should work. Alternatively, you can use this:

    global $product;
    $id = $product->get_id();

    Jon

    Hi @amanfredini,

    Here is a docs page on editing the list of tabs by using a filter – https://docs.woocommerce.com/document/editing-product-data-tabs/.

    The tabs created by our plugin have a “content” key which can be modified through this filter. Something like this should work:

    add_filter( 'woocommerce_product_tabs', 'yikes_edit_tab_content', 98 );
    
    function yikes_edit_tab_content( $tabs ) {
    	foreach( array_keys( $tabs ) as $key ) {
    		if ('tab-slug' === $key) {
    			$tabs[$key]['content'] = 'My new content';	
    		}
    	}
    
    	return $tabs;
    }

    Let me know if that helps,
    Jon

    Hi @mimate,

    Tabs can either be created as Saved Tabs or Product Tabs. If you create a Saved Tab, it still needs to be assigned to a given Product through the Edit Product page.

    The premium version of our plugin allows Saved Tabs to be assigned via taxonomy.

    Does that answer your question? I’m not sure I completely understood.

    Thanks,
    Jon

Viewing 15 replies - 226 through 240 (of 567 total)