<div id='products_page_container' class="wrap wpsc_container">
	
	
	<?php 
if (wpsc_has_breadcrumbs()) {
    ?>
		<div class='breadcrumb'>
			<a href='<?php 
    echo get_option('product_list_url');
    ?>
'><?php 
    echo get_option('blogname');
    ?>
</a> &raquo;
			<?php 
    while (wpsc_have_breadcrumbs()) {
        wpsc_the_breadcrumb();
        ?>
				<?php 
        if (wpsc_breadcrumb_url()) {
            ?>
 	   
					<a href='<?php 
            echo wpsc_breadcrumb_url();
            ?>
'><?php 
            echo wpsc_breadcrumb_name();
            ?>
</a> &raquo;
				<?php 
        } else {
<?php
global $wpsc_query, $wpdb;
?>
<div id='products_page_container' class="wrap wpsc_container">

<?php if(wpsc_has_breadcrumbs()) : ?>
		<div class='breadcrumb'>
			<a href='<?php echo get_option('home'); ?>'><?php echo get_option('blogname'); ?></a> &raquo;
			<?php while (wpsc_have_breadcrumbs()) : wpsc_the_breadcrumb(); ?>
				<?php if(wpsc_breadcrumb_url()) :?> 	   
					<a href='<?php echo wpsc_breadcrumb_url(); ?>'><?php echo wpsc_breadcrumb_name(); ?></a> &raquo;
				<?php else: ?> 
					<?php echo wpsc_breadcrumb_name(); ?>
				<?php endif; ?> 
			<?php endwhile; ?>
		</div>
	<?php endif; ?>
	
	<?php do_action('wpsc_top_of_products_page'); // Plugin hook for adding things to the top of the products page, like the live search ?>

	<?php if(wpsc_display_categories()): ?>
	  <?php if(get_option('wpsc_category_grid_view') == 1) :?>
			<div class='wpsc_categories wpsc_category_grid'>
				<?php wpsc_start_category_query(array('category_group'=> get_option('wpsc_default_category'), 'show_thumbnails'=> 1)); ?>
					<a href="<?php wpsc_print_category_url();?>" class="wpsc_category_grid_item" title='<?php wpsc_print_category_name();?>'>
						<?php wpsc_print_category_image(45, 45); ?>
					</a>
					<?php wpsc_print_subcategory("", ""); ?>
				<?php wpsc_end_category_query(); ?>
				<div class='clear_category_group'></div>
			</div>
Exemple #3
0
/**
* Output breadcrumbs if configured
* @return None - outputs breadcrumb HTML
*/
function wpsc_output_breadcrumbs($options = array())
{
    $products_page_id = wpec_get_the_post_id_by_shortcode('[productspage]');
    $products_page = get_post($products_page_id);
    if (!wpsc_has_breadcrumbs()) {
        return;
    }
    $filtered_products_page = array('url' => get_option('product_list_url'), 'name' => $products_page->post_title);
    $filtered_products_page = apply_filters('wpsc_change_pp_breadcrumb', $filtered_products_page);
    // If home if the same as products apge only show the products-page link and not the home link
    if (get_option('page_on_front') != $products_page_id) {
        echo isset($options['before-breadcrumbs']) ? $options['before-breadcrumbs'] : '<div class="wpsc-breadcrumbs">';
        echo isset($options['before-crumb']) ? $options['before-crumb'] : '';
        echo '<a class="wpsc-crumb" id="wpsc-crumb-home" href="' . get_option('home') . '">' . get_option('blogname') . '</a>';
        echo isset($options['after-crumb']) ? $options['after-crumb'] : '';
        echo isset($options['crumb-separator']) ? $options['crumb-separator'] : ' &raquo; ';
    }
    echo isset($options['before-crumb']) ? $options['before-crumb'] : '';
    echo '<a class="wpsc-crumb" id="wpsc-crumb-' . $products_page_id . '" href="' . $filtered_products_page['url'] . '">' . $filtered_products_page['name'] . '</a>';
    echo isset($options['after-crumb']) ? $options['after-crumb'] : '';
    while (wpsc_have_breadcrumbs()) {
        wpsc_the_breadcrumb();
        echo isset($options['crumb-separator']) ? $options['crumb-separator'] : ' &raquo; ';
        echo isset($options['before-crumb']) ? $options['before-crumb'] : '';
        if (wpsc_breadcrumb_url()) {
            echo '<a class="wpsc-crumb" id="wpsc-crumb-' . wpsc_breadcrumb_slug() . '" href="' . wpsc_breadcrumb_url() . '">' . wpsc_breadcrumb_name() . '</a>';
        } else {
            echo wpsc_breadcrumb_name();
        }
        echo isset($options['after-crumb']) ? $options['after-crumb'] : '';
    }
    if (isset($options['after-breadcrumbs'])) {
        echo $options['after-breadcrumbs'];
    } else {
        echo '</div>';
    }
}
/**
* Output breadcrumbs if configured
* @return None - outputs breadcrumb HTML
*/
function wpsc_output_breadcrumbs($options = null)
{
    /**
     * Filter the arguments passed to wpsc_output_breadcrumbs.
     *
     * @since 3.9.0
     * @param array $options {
     *     associative array of options for outputting the breadcrumbs to this page.
     *
     *     'before-breadcrumbs' string  HTML output to start the breadcrumb.
     *     'after-breadcrumbs'  string  HTML output at the end of the breadcrumb eg closing tag.
     *     'before-crumb'       string  output before each step in path, typically decorative.
     *     'after-crumb'        string  output after each step in path.
     *     'crumb-separator'    string  demarks space between steps in path.
     *     'show_home_page'     bool    Whether to include home page as step at start of path.
     *     'show_products_page' bool    Whether to include products-page as second step in path.
     *     'echo'               bool    if true, outputs constructed string; if false, returns constructed string.
     *     'products_page_id'   int     Override the page id used for products_page
     *     }
     *
     */
    // Defaults
    $options = apply_filters('wpsc_output_breadcrumbs_options', $options);
    $options = wp_parse_args((array) $options, array('before-breadcrumbs' => '<div class="wpsc-breadcrumbs">', 'after-breadcrumbs' => '</div>', 'before-crumb' => '', 'after-crumb' => '', 'crumb-separator' => ' &raquo; ', 'show_home_page' => true, 'show_products_page' => true, 'echo' => true, 'products_page_id' => wpsc_get_the_post_id_by_shortcode('[productspage]')));
    $output = '';
    $products_page_id = absint($options['products_page_id']);
    $products_page = get_post($products_page_id);
    if (!wpsc_has_breadcrumbs()) {
        return;
    }
    $filtered_products_page = array('url' => get_option('product_list_url'), 'name' => apply_filters('the_title', $products_page->post_title, $products_page_id));
    /**
     * Filter the values used to create the products-page step.
     *
     * Overrides the url and text show for the products-page step in breadcrumb.
     *
     * @since 3.9.0
     * @param array $filtered_products_page {
     *     associative array of options for outputting the breadcrumbs to this page.
     *
     *     'url'   string  Fully-qualified url to products-page.
     *     'name'  string  The name that will appear for the products-page in breadcrumb.
     *     }
     *
     */
    $filtered_products_page = apply_filters('wpsc_change_pp_breadcrumb', $filtered_products_page);
    // Home Page Crumb
    // If home if the same as products page only show the products-page link and not the home link
    if (get_option('page_on_front') != $products_page_id && $options['show_home_page']) {
        $output .= $options['before-crumb'];
        $output .= '<a class="wpsc-crumb" id="wpsc-crumb-home" href="' . get_option('home') . '">' . get_option('blogname') . '</a>';
        $output .= $options['after-crumb'];
    }
    // Products Page Crumb
    if ($options['show_products_page']) {
        if (!empty($output)) {
            $output .= $options['crumb-separator'];
        }
        $output .= $options['before-crumb'];
        $output .= '<a class="wpsc-crumb" id="wpsc-crumb-' . $products_page_id . '" href="' . $filtered_products_page['url'] . '">' . $filtered_products_page['name'] . '</a>';
        $output .= $options['after-crumb'];
    }
    // Remaining Crumbs
    while (wpsc_have_breadcrumbs()) {
        wpsc_the_breadcrumb();
        if (!empty($output)) {
            $output .= $options['crumb-separator'];
        }
        $output .= $options['before-crumb'];
        if (wpsc_breadcrumb_url()) {
            $output .= '<a class="wpsc-crumb" id="wpsc-crumb-' . wpsc_breadcrumb_slug() . '" href="' . wpsc_breadcrumb_url() . '">' . wpsc_breadcrumb_name() . '</a>';
        } else {
            $output .= '<span class="wpsc-crumb" id="wpsc-crumb-' . wpsc_breadcrumb_slug() . '">' . wpsc_breadcrumb_name() . '</span>';
        }
        $output .= $options['after-crumb'];
    }
    /**
     * Filter the assembled breadcrumb.
     *
     * @since 3.9.0
     * @param string $output The constructed breadcrumb string.
     * @param array $options {@see 'wpsc_output_breadcrumbs_options'}
     *
     */
    $output = $options['before-breadcrumbs'] . apply_filters('wpsc_output_breadcrumbs', $output, $options) . $options['after-breadcrumbs'];
    if ($options['echo']) {
        echo $output;
    } else {
        return $output;
    }
}
/**
* Output breadcrumbs if configured
* @return None - outputs breadcrumb HTML
*/
function wpsc_output_breadcrumbs($options = null)
{
    // Defaults
    $options = apply_filters('wpsc_output_breadcrumbs_options', $options);
    $options = wp_parse_args((array) $options, array('before-breadcrumbs' => '<div class="wpsc-breadcrumbs">', 'after-breadcrumbs' => '</div>', 'before-crumb' => '', 'after-crumb' => '', 'crumb-separator' => ' &raquo; ', 'show_home_page' => true, 'show_products_page' => true, 'echo' => true));
    $output = '';
    $products_page_id = wpsc_get_the_post_id_by_shortcode('[productspage]');
    $products_page = get_post($products_page_id);
    if (!wpsc_has_breadcrumbs()) {
        return;
    }
    $filtered_products_page = array('url' => get_option('product_list_url'), 'name' => apply_filters('the_title', $products_page->post_title));
    $filtered_products_page = apply_filters('wpsc_change_pp_breadcrumb', $filtered_products_page);
    // Home Page Crumb
    // If home if the same as products page only show the products-page link and not the home link
    if (get_option('page_on_front') != $products_page_id && $options['show_home_page']) {
        $output .= $options['before-crumb'];
        $output .= '<a class="wpsc-crumb" id="wpsc-crumb-home" href="' . get_option('home') . '">' . get_option('blogname') . '</a>';
        $output .= $options['after-crumb'];
    }
    // Products Page Crumb
    if ($options['show_products_page']) {
        if (!empty($output)) {
            $output .= $options['crumb-separator'];
        }
        $output .= $options['before-crumb'];
        $output .= '<a class="wpsc-crumb" id="wpsc-crumb-' . $products_page_id . '" href="' . $filtered_products_page['url'] . '">' . $filtered_products_page['name'] . '</a>';
        $output .= $options['after-crumb'];
    }
    // Remaining Crumbs
    while (wpsc_have_breadcrumbs()) {
        wpsc_the_breadcrumb();
        if (!empty($output)) {
            $output .= $options['crumb-separator'];
        }
        $output .= $options['before-crumb'];
        if (wpsc_breadcrumb_url()) {
            $output .= '<a class="wpsc-crumb" id="wpsc-crumb-' . wpsc_breadcrumb_slug() . '" href="' . wpsc_breadcrumb_url() . '">' . wpsc_breadcrumb_name() . '</a>';
        } else {
            $output .= '<span class="wpsc-crumb" id="wpsc-crumb-' . wpsc_breadcrumb_slug() . '">' . wpsc_breadcrumb_name() . '</span>';
        }
        $output .= $options['after-crumb'];
    }
    $output = $options['before-breadcrumbs'] . apply_filters('wpsc_output_breadcrumbs', $output, $options) . $options['after-breadcrumbs'];
    if ($options['echo']) {
        echo $output;
    } else {
        return $output;
    }
}