Categories
WP E-Commerce

Category wise products display in WP E-Commerce products page

WP E-Commerce displays all the products from all the categories in the default products page which uses the template file: wpsc-products_page.php for displaying. There are situations when we have product categories, under each category we have different products. Now we have to display all the products grouped by product-categories. Like:

Solution:

We can achieve this using short-codes provided by wp e-commerce, but then we have to write the shortcode that many number of times as we have number of categories.

Find a complete list of wp e-commerce category shortcodes with additional arguments
There are some other problems like: we have to create another product page,write the short codes there and keep the default products page intact, else chances are there that the single product page, category page etc. may break or show page not found error.

So another option is to change the default products-page template file( wpsc-products_page.php ) to display products group by categories. This can be done by running multiple loops in the the products page template file. I have used this once and works fine for me. Use this if it suits your requirement. 🙂

Steps:

— Open the wpsc-products_page.php file.
— Find the products loop statement in the code.

— Find the products loop end statement.

— Copy the whole block in between while and endwhile for the product loop.
— Then enclose those copied code inside the below mentioned condition.
— Save and check the products page.
 

Example Code:

 

Download the modified wpsc-products_page.php !!

 

Categories
WordPress

is_home() || is_front_page() not working ! [solved]

There are some situations when the WP conditional tags doesn’t work. Be it any reason like say: Multiple WordPress loops, faulty use of query_posts(…) or issue in the code itself. Basically this problem occurs when there is a change in the main query by the use of query_posts(). Fortunately WordPress always keeps the original, unaltered query intact. So, to get back that where all the conditional tags works we have to use the wp_reset_query().

Just place this function call wp_reset_query() before the conditional tag to solve this issue of WordPress’s is_home() || is_front_page() is not working. I faced this issue once and wp_reset_query() solved my problem.