Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Hide Bread Crumbs From Hidden Categories? Rate Topic   - - - - -

 

Posted 16 April 2018 - 08:50 PM #1

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..? 



 
  • Hungryweb
  • Senior Member
  • Authorized Reseller
  • Join Date: 10-Feb 12
  • 1200 posts

Posted 17 April 2018 - 03:36 AM #2

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:

<?php

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:

<?php

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


Edited by Hungryweb, 17 April 2018 - 03:46 AM.


 

Posted 18 April 2018 - 08:59 PM #3

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.?