theme.functions.php breaks thematic sidebar

This topic is: not resolved

This topic contains 10 replies, has 8 voices, and was last updated by  adambomb 1 year, 8 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
Author Posts
Author Posts
May 12, 2011 at 4:34 am #104923

cannobbio

Hello,
I’m using WP 3.1.2 and Thematic Theme Framework 0.9.7.8 (rev.762 stable) with a standard child theme as usual with WPEC 3.8.3

After upgrading from 3.8.2 to 3.8.3 all my widget areas in WPEC pages are missing (primary aside, secondary aside, subsidiary asides and content asides).
I’ve looked in the WPEC SVN for changes and noticed some in theme.functions.php
If I revert this file to revision 377693 (v3.8.2) everithing goes back to normal.

This are the diffrences between revisions 377693 and 382573:

rev 377693:

function wpsc_all_products_on_page(){
	global $wp_query,$wpsc_query;
	do_action('wpsc_swap_the_template');
	$products_page_id = wpec_get_the_post_id_by_shortcode('[productspage]');

	if($wp_query->query_vars['post_type'] == 'wpsc-product' || isset($wp_query->query_vars['wpsc_product_category']) || ( isset( $wp_query->post ) && $wp_query->post->ID == $products_page_id )){

		if (isset($wp_query->post_count) && 1 == $wp_query->post_count && file_exists(STYLESHEETPATH.'/single-wpsc-product.php')){
			include(STYLESHEETPATH. '/single-wpsc-product.php');
			exit();
		}elseif(file_exists(STYLESHEETPATH.'/page.php')){
			include(STYLESHEETPATH. '/page.php');
			exit();
		}elseif(file_exists(STYLESHEETPATH.'/single.php')){
			include(STYLESHEETPATH. '/single.php');
			exit();
		}elseif(file_exists(STYLESHEETPATH.'/index.php')){
			include(STYLESHEETPATH. '/index.php');
			exit();
		}
	}
	return;

}
add_action('template_redirect', 'wpsc_all_products_on_page');

rev 382573:

function wpsc_thesis_compat( $loop ) {
	$loop[1] = 'page';
	return $loop;
}

function wpsc_all_products_on_page(){
	global $wp_query,$wpsc_query;
	do_action('wpsc_swap_the_template');
	$products_page_id = wpec_get_the_post_id_by_shortcode('[productspage]');
	$term = get_query_var( 'wpsc_product_category' );
	$obj = get_queried_object();
	$id = isset( $obj->ID ) ? $obj->ID : null;

	if( get_query_var( 'post_type' ) == 'wpsc-product' || $term || ( $id == $products_page_id )){

		$templates = array();

		if ( $term && ! is_single() ) {
			array_push( $templates, "taxonomy-wpsc_product_category-{$term}.php", 'taxonomy-wpsc_product_category.php' );
		}

		array_push( $templates, 'page.php', 'single.php' );

		if ( is_single() )
			array_unshift( $templates, 'single-wpsc-product.php' );

		// have to pass 'page' as the template type. This is lame, btw, and needs a rewrite in 4.0
		if ( ! $template = get_query_template( 'page', $templates ) )
			$template = get_index_template();

		add_filter( 'thesis_custom_loop', 'wpsc_thesis_compat' );

		include( $template );
		exit;
	}
}
add_action('template_redirect', 'wpsc_all_products_on_page');

So the problem resides on the new template hierarchy?
I see you made a Thesis Compatibility function, ¿is there a way to include compatibility with Thematic?.
¿Could there be any error in the template hierarchy in the new code?

Well, hope you can awenser me…
Thanx in advance.

May 12, 2011 at 6:03 am #104924

bradleysa

Hi cannobbio. Thanks for reporting on this. I’m using Thematic as well, and also experiencing problems with the update(s).

The customizations I made to the WPEC store CSS seem to have been overridden. It seems that the WPEC developers change their overly-complicated theme structure for each update. For some reason, I thought I made my custom store theme last time, and I would not have to worry about updates changing the look of the store/site. I guess I was wrong again.

I’m also missing the widgets for the sidebar.

The only good news here is that I’ve learned, especially with WPEC, to test updates on a development site, not a live production site. However, I’d much prefer that the live production site was running the latest versions of WP, etc… but currently it’s running WordPress 3.0.5, WPEC 3.7.8, WPEC Gold Cart 2.7, and Thematic 0.9.7.7 with a Child Theme.

Help to resolve these unexpected problems caused by normal updates, is greatly appreciated!

BTW, other WPEC and Thematic users are requesting help on this issue as well:

3.8 beta breaks Thematic sidebar
http://getshopped.org/forums/topic.php?id=17170

3.8 is faulty – removes sidebars, footer and widgets
http://getshopped.org/forums/topic.php?id=20293

May 16, 2011 at 10:57 pm #104925

genoma

Replacing that part of the code solved the problem in all my 2 small e-shop, so thank you very much you’ve saved my day.

May 18, 2011 at 12:06 am #104926

blanched

Hello cannobbio,

This is interesting. I am having the same problem (WPEC 3.8.3 & Thematic removes the sidebars ) but do not seem to be able to resolve it by just inserting your code (above) into the current version of the theme.function.php file (3.8.3) described above. Can you please (pretty please) give more details on how you have set this up, how you are using Thematic, how you are calling the thematic_sidebar etc

I agree it seems that certain pages just do not appear to be calling the rest of the Thematic Template properly, hence they are not calling the sidebar.

thanks

May 20, 2011 at 6:57 am #104927

siliconstudio
Contributor

My products page on a fresh WPEC 3.8.3 install is also missing its sidebar. Previous version worked fine. Any ideas?

Thanks

May 21, 2011 at 1:33 am #104928

cannobbio

@bradleysa:

It seems that the WPEC developers change their overly-complicated theme structure for each update.

I took the decision of starting my own css from scratch. I agree the default theme is too overstyled, so I deregisterd everything that was complicating me and made a custom wpsc-default.css

// Deregister WPEC CSS styles
function wpsc_deregister_styles() {
//	wp_deregister_style( 'wpsc-theme-css' );			// Main stylesheet | wpsc-default.css
	wp_deregister_style( 'wp-e-commerce-dynamic');			// Dinamic styles | inline css
	wp_deregister_style( 'wpsc-theme-css-compatibility' );		// Compatibility styles | compatibility.css
	wp_deregister_style( 'wpsc-product-rater' );			// Rating stars | product_rater.css
	wp_deregister_style( 'wpsc-thickbox' );				// Thickbox | thickbox.css
	wp_deregister_style( 'wpsc-gold-cart' );			// Gold Cart styles | gold_cart.css
}
add_action( 'wp_print_styles', 'wpsc_deregister_styles', 100 );

Also deregistered Thickbox JS since I’m using another lightbox plugin. You can deregister WPEC scripts with this code:

// Deregister WPEC JS
function wpsc_deregister_scripts() {
	wp_deregister_script( 'wpsc-thickbox' );
//	wp_deregister_script( 'jquery-rating' );
//	wp_deregister_script( 'wp-e-commerce' );
//	wp_deregister_script( 'jQuery' );
//	wp_deregister_script( 'infieldlabel' );
//	wp_deregister_script( 'wp-e-commerce-ajax-legacy' );
//	wp_deregister_script( 'wp-e-commerce-dynamic' );
//	wp_deregister_script( 'livequery' );
//	wp_deregister_script( 'wp-e-commerce-legacy' );
//	wp_deregister_script( 'l10n' );
//	wp_deregister_script( 'wpsc-gold-cart' );
}
add_action( 'wp_print_scripts', 'wpsc_deregister_scripts', 100 );

@genoma:
Glad it worked out for you =)

@blanched:
Just replace /wp-content/plugins/wp-e-commerce/wpsc-includes/theme.functions.php of your WPEC 3.8.3 with the theme.functions.php of version 3.8.2. It’s here on my public Dropbox: http://dl.dropbox.com/u/15696922/theme.functions-rev377693.zip
I’m using Thematic with a standard child theme with all the wpsc theme files moved to the child theme directory. The thematic sidebar gets called by the framework, I’m not using any template override files (single.php, page.php, etc.) on my child theme, just a lot of functions in my functions.php none regarding how the sidebar areas get called.

@siliconstudio:
Try the the file above.

June 5, 2011 at 7:18 pm #104929

ando

This seems to do the trick. Thanks cannobbio!

One problem – my store page now displays the blog, not the store. If I go to store/page/1 my products appear fine, but that kinda sucks. Has that happened to anyone else? (sorry, can’t post a link as the site’s not live yet.)

June 5, 2011 at 10:48 pm #104930

ando

Oops, ignore that last part – realised my store page was using the blog template instead of the default template.

So this fix works a treat.

June 16, 2011 at 7:44 pm #104931

blanched

Just wanted to say thanks for all your input Cannobbio.

I have still been unable to fully resolve the issue so I have reverted to WPEC 3.7.8 until the guys can sort out a release that is compatible with Thematic….

Shame !

August 28, 2011 at 2:26 pm #222286

peterthimaging
New Member

THis doest work for me. somehow i have my primary sidebar working and i remember i did something for that some weeks ago but now i cant get my custom thematic new aside areas to show up!

any more hints here?

September 23, 2011 at 6:58 pm #226011

adambomb
New Member

Simplest solution I’ve found is this (And seems to work perfectly.)

Open up theme.functions.php

Search for this line:

add_action('template_redirect', 'wpsc_all_products_on_page');

Replace it with this:

add_action('template_redirect', 'wpsc_all_products_on_page', 11);

Everything should work again.

Viewing 11 posts - 1 through 11 (of 11 total)

The forum ‘3.8 Stable Release’ is closed to new topics and replies.