function wpsc_products_page($content = '') { global $wpdb, $wp_query, $wpsc_query, $wpsc_query_vars, $_wpsc_is_in_custom_loop; $output = ''; if (!in_the_loop()) { return $content; } if (preg_match("/\\[productspage\\]/", $content)) { global $more; $more = 0; remove_filter('the_content', 'wpautop'); list($wp_query, $wpsc_query) = array($wpsc_query, $wp_query); // swap the wpsc_query object $_wpsc_is_in_custom_loop = true; $GLOBALS['nzshpcrt_activateshpcrt'] = true; // get the display type for the productspage $saved_display = wpsc_get_customer_meta('display_type'); $display_type = !empty($saved_display) ? $saved_display : wpsc_check_display_type(); ob_start(); do_action('wpsc_display_products_page', $display_type); wpsc_include_products_page_template($display_type); $is_single = false; $output .= ob_get_contents(); ob_end_clean(); $output = str_replace('$', '\\$', $output); if ($wp_query->post_count > 0) { $product_id = $wp_query->post->ID; $product_meta = get_post_meta($product_id, '_wpsc_product_metadata', true); list($wp_query, $wpsc_query) = array($wpsc_query, $wp_query); // swap the wpsc_query objects back $_wpsc_is_in_custom_loop = false; if ($is_single == false || $product_meta['enable_comments'] == '0') { wp_reset_postdata(); } } $wp_query->current_post = $wp_query->post_count; return preg_replace("/(<p>)*\\[productspage\\](<\\/p>)*/", $output, $content); } elseif (is_archive() && wpsc_is_viewable_taxonomy()) { remove_filter('the_content', 'wpautop'); return wpsc_products_page('[productspage]'); } else { return $content; } }
function wpsc_products_page($content = '') { global $wpdb, $wp_query, $wpsc_query, $wpsc_query_vars; $output = ''; if (preg_match("/\\[productspage\\]/", $content)) { global $more; $more = 0; remove_filter('the_content', 'wpautop'); list($wp_query, $wpsc_query) = array($wpsc_query, $wp_query); // swap the wpsc_query object $GLOBALS['nzshpcrt_activateshpcrt'] = true; // get the display type for the productspage $display_type = get_option('product_view'); if (isset($_SESSION['wpsc_display_type'])) { $display_type = $_SESSION['wpsc_display_type']; } ob_start(); wpsc_include_products_page_template($display_type); $is_single = false; $output .= ob_get_contents(); ob_end_clean(); $output = str_replace('$', '\\$', $output); $product_id = $wp_query->post->ID; $product_meta = get_post_meta($product_id, '_wpsc_product_metadata', true); list($wp_query, $wpsc_query) = array($wpsc_query, $wp_query); // swap the wpsc_query objects back if ($is_single == false || $product_meta['enable_comments'] == '0') { $GLOBALS['post'] = $wp_query->post; } $wp_query->current_post = $wp_query->post_count; return preg_replace("/(<p>)*\\[productspage\\](<\\/p>)*/", $output, $content); } elseif (is_archive() && wpsc_is_viewable_taxonomy()) { remove_filter('the_content', 'wpautop'); return wpsc_products_page('[productspage]'); } else { return $content; } }