Ejemplo n.º 1
0
 function jbst_wpec_cat_template()
 {
     if (wpsc_is_viewable_taxonomy()) {
         get_template_part('pagewpec');
         exit;
     }
 }
Ejemplo n.º 2
0
/**
 * wpsc_the_category_template swaps the template used for product categories with pageif archive template is being used use
 * @access public
 *
 * @since 3.8
 * @param $template (string) template path
 * @return $template (string)
 */
function wpsc_the_category_template($template)
{
    global $wp_query;
    //this bit of code makes sure we use a nice standard page template for our products
    if (wpsc_is_viewable_taxonomy() && false !== strpos($template, 'archive')) {
        return str_ireplace('archive', 'page', $template);
    } else {
        return $template;
    }
}
Ejemplo n.º 3
0
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;
    }
}