How To Hide Bread Crumbs From Hidden Categories?

I have products that are in hidden categories.. only shown as associated product in a block.. - but that link to that product page produces a breadcrumb trail of hidden categories...

any ideas..?

1. Hide breadcrumbs for hidden categories

The simplest solution is to hide manual the block from category update page > Layouts tab, please check video here https://cl.ly/0n1x3S3N3T35

also can be done dynamic for all the hidden categories:

please add file:


app/addons/my_changes/controllers/frontend/categories.post.php

with content:

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }

if ($mode == ‘view’) {
$category_data = Tygh::$app[‘view’]->getTemplateVars(‘category_data’);

if (!empty($category_data['status']) && $category_data['status']=='H') {
	Tygh::$app['view']->assign('breadcrumbs', array());
}

}


2. Hide breadcrumbs for products that are placed in hidden categories

please add file:

app/addons/my_changes/controllers/frontend/products.post.php

with content:

if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }

if ($mode == ‘view’) {
$product = Tygh::$app[‘view’]->getTemplateVars(‘product’);

if (!empty($product['category_ids'])) {
	$has_hidden_category = (int)db_get_field('SELECT COUNT(category_id) FROM ?:categories WHERE status=?s AND category_id IN (?a)', 'H', $product['category_ids']);
	if (!empty($has_hidden_category)) {
		Tygh::$app['view']->assign('breadcrumbs', array());
	}
}

}

*PS: My Changes add-on is required to be active and if category tree is missing please create it


I hope that helps,

---
Valentin
part of hungryweb.net

I have looked at removing this is blocks - however its not really what I want. It leaves the user without breadcrumbs - Which i guess is better than leaving google to index hidden categories..

the dynamic element - doesnt do much more than working with the blocks -- at least as i can tell.

I sell bedding sets - where the main page that is in the category is called tiffany bedding set.. and then i show a collection block of products in sizes like queen, twin, king etc.. and maybe some sheets or accessory pillows and shams or even curtains.

the problem is I cant show twenty thumbnails of each size or accessory -- so i hide them and just feature them in an associated block - parent associated with child products.

I noticed - that csv feed file - category field generates a path - ( like breadcrumbs ) not the category.. Is there anyway to pull this variable for this parent product and replace it in the breadcrumbs..

or perhaps a simpler way since i can use a block and insert a basic patch for the category - but is there a way to add a variable that would catch the name of the page from "parent collection" and just append it to a manual category construct i would do in the block for those products.?