Please help us to make AbanteCart Ideal Open Source Ecommerce Solution for everyone.

Support AbanteCart eCommerce

Author Topic: Breadcrumbs with all categories  (Read 7481 times)

Offline otterslide

  • Newbie
  • *
  • Posts: 17
  • Karma: +3/-0
    • View Profile
Breadcrumbs with all categories
« on: October 25, 2014, 05:44:10 PM »
Hello,

The problem I'm having is when clicking on a "latest product" while viewing another product

The category at the top lists
Home > Product

but if I go to it's category and click on it then I get
Home > Category > Product

I think that even when going from "Latest" there should be a category, and if the product is in multiple categories, it could also list all of them.

Any pointers where these breadcrumbs are set would be appreciated, so I can set them to all categories.





Offline otterslide

  • Newbie
  • *
  • Posts: 17
  • Karma: +3/-0
    • View Profile
Re: Breadcrumbs with all categories
« Reply #1 on: October 25, 2014, 09:36:59 PM »
I've managed to do it on my own, if anyone is interested they can show their support here.

I think for SEO purpose, search engines don't want to see that breadcrumb differ depending on the route they took.   I also would not like it being a visitor.. It's really annoying when you arrive a product and you don't know what category it's part of so you can see more products like it.
« Last Edit: October 25, 2014, 09:40:43 PM by otterslide »

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1798
  • Karma: +520/-7
    • View Profile
Re: Breadcrumbs with all categories
« Reply #2 on: October 25, 2014, 10:22:55 PM »
sharing a solution to an issue is always welcomed in an open source project.  Please let us know what you've changed to make it like you wish.

Lee

Offline llegrand

  • Hero Member
  • *****
  • Posts: 1798
  • Karma: +520/-7
    • View Profile
Re: Breadcrumbs with all categories
« Reply #3 on: October 26, 2014, 08:34:51 PM »
Hello all,  I wasn't quite sure what Ottercreek was wanting here but he responded to me directly as he was having trouble posting links here.    I think that has something to do with his Newbie status?!?!   Anyway I took at look at a couple of this links and now I get it,  and think it has some merit.   So I offered to post his solution for him  (being an old-timer here on the board 8)

here's a couple of places that show what he's talking about -  note the listing when an product in in multiple categories.

http://www.iherb.com/Y-S-Organic-Bee-Farms-Bee-Pollen-Powder-Plus-Papaya-Powder-10-6-oz-300-g/23682

http://hobbyking.com/hobbyking/store/__60491__Universal_Remote_Control_Infrared_Shutter_IR_RC_1g.html

The following is from the email I got from otterslide -  and now that I have seen what he was describing in the above links -  I too hink it is a good addition -   ADMINS -  maybe added to 1.2??

And thanks Otterslide for sharing with us. 

 It's not the most elegant solution but here it is..
 
 It will work if you just have a category and sub-category for an item, but if you have multiple category + sub categories for an item, it will just list all of them in  one giant breadcrumb line.
 
 Turns out my items don't have more than one Category + SubCategory so this works for me.  It would get complicated to have multiple lines of breadcrumbs since the data type would have to change and I didn't want to go so far..
 
 The main idea is to just get the categories for the product and loop them adding them as a breadcrumb,..
 
 so in
 AbanteCart\storefront\controller\pages\product\product.php
 you could add the code below, while commenting other the other three breadcrumb creators around like 42-95.
 
 I added the code after this line  to make sure product model is loaded. 
 


 
Code: [Select]
$prod_cats = $this->model_catalog_product->getProductCategories($product_id);
 
                 if(isset($prod_cats)) {
                         foreach($prod_cats as $prod_cat_id) {
                                 $cat_info = $this->model_catalog_category->getCategory($prod_cat_id);
 
                                 $this->document->addBreadcrumb( array (
                                                 'href'      => $this->html->getSEOURL('product/category','&path=' . $prod_cat_id, '&encode'),
                                                 'text'      => $cat_info['name'],
                                                 'separator' => $this->language->get('text_separator')
                                          ));
 
                         }
                 }
 



 

[/font]You will also have to copy/paste getProductCategories function from admin/model/catalog/product to  model/catalog/product , as it's only available in the admin side.. I'm not sure if this was the best way to do this or there was a way to re-use it?
 
 Quick and dirty solution.
   
 [/font]

   

« Last Edit: October 26, 2014, 08:38:08 PM by llegrand »

 

Powered by SMFPacks Social Login Mod