I found something that could be improved in the plugin. Here are the steps to reproduce the bug:
- I removed the [productspage] shortcode from the Products page.
- For some reason, I prefer to use a custom page template that programmatically calls do_shortcode(‘[wpsc_products]’);
The result is that this breaks the home page, by displaying page.php.
I first thought that was a permalinks issue. Then I read in this thread that “WPeC currently depends on the existence (and published status) of a few pages – the products page is one of them.”.
Indeed, the problem comes from the wpsc_all_products_on_page() function, where $id and $products_page_id are evaluated to null, since wpsc_get_the_post_id_by_shortcode(‘[productspage]’) was not found. (you might take a look to wpsc-includes/theme.functions.php to understand)
In my opinion, testing for the presence of the products page is not a good thing. I am aware that WP E-Commerce comes as a ready to use plugin, and might not be customized that way.
A workaround was to remove wpsc_all_products_on_page() hook using : remove_action( ‘template_redirect’, ‘wpsc_all_products_on_page’ );
I created this thread since I couldn’t find any similar problem in the WP E-Commerce forums.
- The topic ‘WP E-Commerce requires [productspage] shortcode’ is closed to new replies.