Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breadcrumbs drops 'Shop' on move to category pages. #1993

Closed
SOHOIT opened this issue Dec 16, 2012 · 8 comments
Closed

Breadcrumbs drops 'Shop' on move to category pages. #1993

SOHOIT opened this issue Dec 16, 2012 · 8 comments

Comments

@SOHOIT
Copy link

SOHOIT commented Dec 16, 2012

WooCommerce ver. 1.6.6
WordPress vers. 3.4.X and 3.5

On the 'Shop' page woocommerce_breadcrumb() displays:

'Home > Shop'

Moving past the top level shop page woocommerce_breadcrumb() drops the 'Shop' and displays:

'Home > CATEGORY_NAME' for example 'Home > Polymer Ribs'

There is no link to the 'Shop' page.

Should display 'Home > Shop > CATEGORY_NAME'

@coenjacobs
Copy link
Contributor

+1 on this, it should show the Shop page in between. Maybe not for all setups though, maybe it should respect the URL structure? I hate this becoming another option, but that might be the only possibility to suit all needs.

@mikejolley What do you think?

@sjeden
Copy link
Contributor

sjeden commented Dec 18, 2012

+1 on this, although i personally think the breadcrumb structure needs to be overhauled as voiced in previous tickets :)

love your guys work though :) making this even more immmense!

@mikejolley
Copy link
Member

In 2.0, if in permalink settings you give the categories a base containing shop/ it will be added to the breadcrumb. As @coenjacobs said. Guess he didn't realise I coded it :)

@kukac7
Copy link
Contributor

kukac7 commented May 10, 2013

Hi,

I have removed the link to the shop from breadcrumb.
the following options:

woo

The shop link: http://mylink.com/termekek

How can I display a link between the shop and the main categories?

Thanks for your help!

@jnthnmrgn
Copy link

+1 on this too!
Has anyone made any progress on this?
It's pretty frustrating :(

@jhoffmcd
Copy link

I believe @mikejolley answered above. Yet I'm still unclear as I have tried setting product category and tag bases to shop/ and the breadcrumbs do not reflect any change.

@janzikmund
Copy link

Hi, I was debugging the original issue and unfortunatelly Woocommerce doesn't use any hooks to directly adjust the breadcrumbs array. So if you want to modify the breadcrumbs shown without changing your permalinks structure, best is to copy the breadcrumbs template file from plugin ( /woocommerce/templates/global/breadcrumb.php) into your theme (/theme_name/woocommerce/global/) and there add the code to inlude the link before the output loop starts. I only do it for product category, tag and detail but you can add other conditionals if you like.

<?php
/**
 * Shop breadcrumb
 *
 * @author      WooThemes
 * @package     WooCommerce/Templates
 * @version     2.3.0
 * @see         woocommerce_breadcrumb()
 */

if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

if ( $breadcrumb ) {

    // add shop home url to breadcrumbs
    if( is_product_category() || is_product_tag() || is_product() ) {
        $shop_page_id = wc_get_page_id( 'shop' );
        $shop_home_arr = array( get_the_title($shop_page_id), get_permalink($shop_page_id));

        // insert to breadcrumbs array on second position
        array_splice($breadcrumb, 1, 0, array($shop_home_arr));
    }

    echo $wrap_before;

    foreach ( $breadcrumb as $key => $crumb ) {

        echo $before;

        if ( ! empty( $crumb[1] ) && sizeof( $breadcrumb ) !== $key + 1 ) {
            echo '<a href="' . esc_url( $crumb[1] ) . '">' . esc_html( $crumb[0] ) . '</a>';
        } else {
            echo esc_html( $crumb[0] );
        }

        echo $after;

        if ( sizeof( $breadcrumb ) !== $key + 1 ) {
            echo $delimiter;
        }
    }
    echo $wrap_after;
}

@swinggraphics
Copy link

I don't understand why this was closed. Adding the shop page slug to the "Product category base" in Permalinks has no effect on the breadcrumbs.

Update: I think I see now. I have set the single Product Permalinks to include the shop page slug, and also given the categories a base including the shop page slug. It got 404 errors on category pages when the product permalinks included the category, though. I ended up with these settings:

  • Product category base: /shop/category
  • Product Permalinks: Shop base

@woocommerce woocommerce locked and limited conversation to collaborators Mar 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants