Skip Navigation

[Resolved] Template WooCommerce prodcut

This thread is resolved. Here is a description of the problem and solution.

Problem:

It should be a compatibility problem of Catchbox theme and Views content template, I use a content template for WooCommerce products, it is not working anymore.

Solution:

You setup a theme file to render the content template directly
See the solution in post:
https://toolset.com/forums/topic/template-woocommerce-prodcut/#post-624481

Relevant Documentation:

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 15 replies, has 3 voices.

Last updated by Dido 6 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#621065

Hi, I use a content template for WooCommerce products on
hidden link

It is not working anymore.
I had the same layout as this: hidden link

I don't know why it changed and can you tell me what to do?

#621209

Hi,

I checked the "Debug information" you provided, you are not using the Layout plugin.

I assume we are talking about a singe product post, and you are going to design it with Views content template, please check these:
1) You are following our document to setup the "Woocommerce View" setting and the layout for single product post:
https://toolset.com/documentation/user-guides/getting-started-woocommerce-views/#product-template-file
section "Product Template File"
https://toolset.com/documentation/user-guides/editing-view-templates/setting-view-templates-for-single-pages/
Selecting a Content Template to display Single posts

2) deactivate other plugins and switch to wordpress default theme, and test again

3) If the problem still persists, please provide a database dump file (ZIP file) of your website in below private detail box, I need to test and debug it in my localhost, thanks

#622295

Hi, I tested with twenty-seventeen. In that theme, it works good.
so, it is not working anymore with my theme (Catchbox).

Do you have a direction for me?

#622375

It should be a compatibility problem between your theme and Views content template, please follow our document to check function name that your theme is using
https://toolset.com/documentation/user-guides/editing-view-templates/theme-support-for-content-templates/

Content Templates modify the content when called from the WordPress’ built-in the_content function. Some themes do not use the_content function, but define their own function. In this case, Content Templates are not applied to selected posts on the front-end.

If you still need assistance for it, please provide a copy of your theme file "Catchbox", I need to test and debug it in my localhost.

#623859

Hi, is this what you mean?

function catchbox_url_grabber() {
if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) )
return false;

return esc_url_raw( $matches[1] );
}

And if so, then what?

#623861
content.jpg

O Luo! I was logged in with another account, from hetty. I'm sorry.
See my screenshot, it is not helping, maybe I do something wrong?

#624115

As I mentioned above, It should be a compatibility problem of your theme, If you still need assistance for it, please provide a copy of your theme file "Catchbox" in below private message box, I need to test and debug it in my localhost.

#624475

Thanks for the details, I can download theme file "Catch box", I am checking it in my localhost, will feedback if there is anything found

#624481

You setup a theme file to render the content template directly, for example, you can try this:
1) Create a theme file single-product.php in your theme folder, with below codes:

<?php
/**
 * Template Name: Single product page
 * Description: A Page Template that disables a sidebar to pages
 *
 * @package Catch Themes
 * @subpackage Catch Box
 * @since Catch Box 1.0
 */

get_header(); ?>

				<?php while ( have_posts() ) : the_post(); ?>

	<div class="entry-content">
		<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		<?php 
			$ct_id = get_post_meta(get_the_ID(), '_views_template', true);
			echo render_view_template($ct_id);
		?>
		</article><!-- #post-<?php the_ID(); ?> -->
	</div><!-- .entry-content -->

					<?php comments_template( '', true ); ?>

				<?php endwhile; // end of the loop. ?>

		</div><!-- #content -->
        
		<?php 
        /** 
         * catchbox_after_content hook
         *
         */
        do_action( 'catchbox_after_content' ); ?>
            
	</div><!-- #primary -->
    
	<?php 
    /** 
     * catchbox_after_primary hook
     *
     */
    do_action( 'catchbox_after_primary' ); ?>    

<?php get_footer(); ?>

2) Dashboard-> Toolset-> Woocommerce Views
section "Product Template File", choose option "Catch Box child Theme Single product page"

3) Edit the product post, in section "Content Template", choose the content template, for example the content templat ID is 12345,

4) In your theme/functions.php, add below codes:

add_filter('wpv_filter_wpv_render_view_template_force_suppress_filters', 'my_func', 10, 5);
function my_func($res, $ct_post, $post_in, $current_user_in, $args){
	if($ct_post->ID == 12345){
		
		$res = true;
	}
	return $res;
}

Please replace 12345 with your content template ID

#624587
template.jpg

Hi Luo,

It is not doing what I want 🙁
I used now css to remove the WC compartiments.

.woocommerce-product-gallery, .summary, .wc-tabs {display:none;}
.woocommerce div.product .woocommerce-tabs .panel {margin-top: -44px;}

the problem was not the template, but what WC shows in the content.
Before the major update frome WC, it was no problem.

#624806

Yes, I assume you are going to display the content template directly, without those }"product image, summary and tabs" from woocommerce plugin.

The workaround I provided above works fine in my localhost:
https://toolset.com/forums/topic/template-woocommerce-prodcut/#post-624481

It can display the content template without "product image, summary and tabs" from woocommerce plugin.

If you still assistance for it, please provide a test site with same problem, I can setup a demo for you.

#625611

Hi Luo,
Can you setup a demo for me?
Kind regards

#626083

Sorry, we don't provide test site host service, please update this thread when your test site is ready, you just need to add a sub folder in your website, install a fresh wordpress installation + Toolset plugins + Woocommece plugin + Catch Box theme, and provide the credentials and ftp access in below private message box, then I can setup the demo for you.

#626232

Hi Luo,

for now I think I solved the problem (with css, display none). I am not happy with it but it is very time consuming. If you think it would be realy necessary to solve this, let me know. Than I will dig further.

#626371

You are right, you can use custom CSS codes to solve the problem easily, and it depends on yourself.

As you can see, it is a compatibility problem with "Catch box" theme, according to our support policy:
https://toolset.com/toolset-support-policy/
We cannot always fix compatibility issues arising from third-party plugins and themes.

And I have already provide a workaround in above post:
https://toolset.com/forums/topic/template-woocommerce-prodcut/#post-624481

If you still need a test site, I can setup one for you, it is ready for you to test here
hidden link
user/pass: admin/111111

For your reference.