Woocommerce Product Vendor Plugin - Wrapper problem

Hi,

I have problem with wrapper, it doesn’t work in woocommerce product vendor.
Product vendor is plugin for woocommerce that adds new taxonomy named ‘Product Vendor’ (shop_vendor), and when I click on a Vendor (which should be taxonomy page) wrapper not working.

I have tried to add taxonomy-shop_vendor.php with woocmmerce_content(), but nothing.

Help pls?

Thanks in advanced

BR
V

Are you certain it’s a new taxonomy and not a new custom post type? The latter would use archive-shop_vendor.php.

Can you also expand on what you mean by the wrapper isn’t working? Have you followed the steps that Chris outlines here?

Hi F,

You can check for yourself: http://bit.ly/1dgoytC
There are some products that have ‘by Vendor 1’, and then when you click on Vendor name, it takes you to vendor taxonomy.

By not working I mean, it’s not wrapping content.
I have removed pretty url’s.

When I go view source I see all is wrapped in div id=page, and when I do search in all files for that string there is no such template.

I have created file named: woocommerce.php with content:

<?php get_template_part('templates/page', 'header'); ?>
<?php get_template_part('templates/content', 'wcpage'); ?>

content-wcpage.php then has content:

<?php woocommerce_content(); ?>

I have also created page: archive-shop_vendor.php with same content (get header and content), but template is not loaded.

Hm,

I have done everything like in blog post, but now I have problem with category view as well.
header, footer and sidebar are double :stuck_out_tongue:

It is a taxonomy, so I would see if the fix you tried works with a more general template (such as taxonomy.php).

The duplicate headers would suggest that you haven’t modified the Woocommerce templates by removing the get_header/get_footer calls. The other workaround people often use is creating blank header.php and footer.php files; this means that you can leave the default templates in tact.

Hi,

I have tried all sorts of templates, but it’s not working, archive, taxonomy, tag, category…
I’m stuck

In which case you’ll have to find out how the plugin is setting the template file (try looking for template_redirect or template_include filters).

It includes template ‘archive-product.php’, but now becuase i have empty footer/header/sidebar.php on this page there is no headers and footer.

I really don’t get this. Is there anyhitng else I can do?

I would guess that the priority of that include filter is higher than 99 (which is the point at which the wrapper kicks in). You could try setting a later priority for the wrapper (higher number): see the last line of lib/wrapper.php .

Not helping.
In plugin is set:

// Setup vendor shop page (taxonomy archive)
add_action( 'template_redirect', array( $this, 'load_product_archive_template' ) );

Can I somehow go around this base.php?

The problem with template_redirect is that it runs before the wrapper kicks in. So you’ll have to add an action with a higher numbered priority (or lower numbered priority and use exit()) in order to redirect before the plugin does.

There may be a simpler way if the plugin code has a filter.

I had a quick think and something like this could work:

function template_override_with_wrapper(){
  $template = Your_Plugin_Class::load_product_archive_template(); // select your template
  include Roots_Wrapping::wrap($template); // set up wrapper with template
  exit();
}

add_action('template_redirect', 'template_override_with_wrapper', 9); // run before defaults

You will of course need to add conditionals inside the function or this will run on every page, but I’ll leave that up to you.

Well, just to inform that I have found the solution.
I’m not happy with it, but it works…

I have created blank header/footer/sidebar files and added markup inside only for taxonomy shop vendor with:

if( is_archive('shop_vendor');

if is, then markup is loaded, if not file is blank.

Hey guys,

I am having a similar issue and hope someone can help. I have not had any issues editing the WooCommerce template files but I cannot figure out why my Product Vendor pages are missing all head/header content as well as the footer. It’s just a blank page… http://198.20.249.142/~sennco/vendor/best-buy/

The product vendors plugin calls the archive-product.php Woo template. I copied those templates and then removed the multiple header instances, etc. Then I noticed the blank product vendors page… It’s only outputting the content, no head, header, footer , etc. I am confused since all the other Woo templates are displaying fine and outputting the correct files…

What am I missing? Any feedback is greatly appreciated!

It’s simply not loading anything from base.php - Any suggestions?

My guess is the plugin is including the template directly and in doing so the standard WordPress template hierarchy is being ignored or bypassed.

Checking the woocommerce_get_template would be the starting point.

The quick fix would be to duplicate the majority of base.php in the archive-product.php template.

The other option would be to try manually invoking the wrapper but that will largely depend on when the woo function kicks in.

Hi,

I had same issue, what I have done is created:
taxonomy-shop_vendor.php with:

<?php get_template_part('archive-product'); ?>

header.php and footer.php in root theme folder with:
header.php: http://pastebin.com/7WkJKzTB

footer.php: http://pastebin.com/biTJqU4K

Not much happy with it, but it works.
Hope this helps.

BR
V

Try adding the following to the very top of your archive-product.php template:

<?php 
if (!isset(Roots_Wrapping::$main_template)) { 
  return Roots_Wrapping::wrap(__FILE__); 
} 
?>

Thanks for the feedback guys! I really appreciate it. @Foxaii - your php snippet causes a fatal error / blank page… I really wish I understood more about the Roots Wrapping function.

Any idea what error?

It’s meant to allow woocommerce to load the template it chooses, the template invokes the wrapper and the wrapper returns back;
woo calls template -> template calls wrapper -> wrapper includes template.