Plugin Directory

Changeset 355080

Timestamp:
03/04/2011 01:47:03 AM (13 years ago)
Author:
jghazally
Message:

Fix blank the_content for empty product categries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-e-commerce/branches/3.8-development/wpsc-core/wpsc-functions.php

    r354366 r355080  
    418418    $is_404 = false;
    419419    if(isset($wp_query->query_vars['term']) && in_array($wp_query->query_vars['term'], $wpsc_page_titles)){
    420         $product_page_id = wpec_get_the_post_id_by_shortcode('[productspage]');
    421420        $wp_query = new WP_Query( 'pagename='.$wpsc_page_titles['products'].'/'.$wp_query->query_vars['term'] );
    422421
    423422    }elseif ( null == $wpsc_query ) {
    424         if($wp_query->is_404 || (isset( $wp_query->query['pagename']) && strpos( $wp_query->query['pagename'] , $wpsc_page_titles['products'] ) !== false ) && !isset($wp_query->post)){
     423        if( ( $wp_query->is_404 && !empty($wp_query->query_vars['paged']) ) || (isset( $wp_query->query['pagename']) && strpos( $wp_query->query['pagename'] , $wpsc_page_titles['products'] ) !== false ) && !isset($wp_query->post)){
     424            //what was this for?
    425425            global $post;
    426426            $is_404 = true;
     
    433433                $wpsc_query_vars['wpsc_product_category'] = $wp_query->query_vars['name'];
    434434        }
    435         $products_page = $wpsc_page_titles['products'];
    436         $checkout_page = $wpsc_page_titles['checkout'];
    437         $userlog_page = $wpsc_page_titles['userlog'];
    438435        if ( count( $wpsc_query_vars ) <= 1 ) {
    439436            $wpsc_query_vars = array(
     
    501498       
    502499            add_filter( 'pre_get_posts', 'wpsc_generate_product_query', 11 );
    503        
     500
    504501            $wpsc_query = new WP_Query( $wpsc_query_vars );
    505502            //for 3.1 :|
    506503            if(empty($wpsc_query->posts) && isset($wpsc_query->tax_query) && isset($wp_query->query_vars['wpsc_product_category'])){
    507 
    508504                $wpsc_query_vars = array();
    509505                $wpsc_query_vars['wpsc_product_category'] = $wp_query->query_vars['wpsc_product_category'];
     
    515511                }
    516512                $wpsc_query = new WP_Query( $wpsc_query_vars );             
     513
     514
    517515            }
    518516        }
     
    520518
    521519    if(  $is_404 || ( ( isset($wpsc_query->post_count) && $wpsc_query->post_count == 0 ) && isset($wpsc_query_vars['wpsc_product_category'] )  )){
     520
    522521        $args = array_merge($wp_query->query, array('posts_per_page' => get_option('wpsc_products_per_page')));
    523522        $wp_query = new WP_Query($args);
    524523
     524
     525
     526
     527
    525528    }
    526529
Note: See TracChangeset for help on using the changeset viewer.