Advertisement:

Author Topic: Order of breadcrumb navigation on item page  (Read 314 times)

door

  • Newbie
  • *
  • Posts: 35
Order of breadcrumb navigation on item page
« on: April 08, 2019, 10:49:40 pm »
When viewing an item for sale page, the breadcrumb navigation is missing the sub category link.

Currently it looks like:

My Site > Main Category > Item that is for sale

This item is posted in a sub category, under the Main Category, but it does not show in the breadcrumb menu.

I want it to be:

My Site > Main Category > Sub Category > Item that is for sale

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Order of breadcrumb navigation on item page
« Reply #1 on: April 09, 2019, 01:58:33 am »
Hi, you can try Full Breadcrumbs plugin on Market:
https://market.osclass.org/plugins/seo/full-breadcrumbs_149

door

  • Newbie
  • *
  • Posts: 35
Re: Order of breadcrumb navigation on item page
« Reply #2 on: April 09, 2019, 02:34:33 am »
This should be a simple fix in breadcrumb.php, don't want to get a whole plugin for it

door

  • Newbie
  • *
  • Posts: 35
Re: Order of breadcrumb navigation on item page
« Reply #3 on: April 09, 2019, 02:52:22 am »
Hi, you can try Full Breadcrumbs plugin on Market:
https://market.osclass.org/plugins/seo/full-breadcrumbs_149

Since you seem to be knowledgeable on how this works, can you share the one line of code needed to be adjusted in order to accomplish this?

door

  • Newbie
  • *
  • Posts: 35
Re: Order of breadcrumb navigation on item page
« Reply #4 on: April 09, 2019, 03:55:20 am »
Can anyone help get this code in breadcrumb.php to display the Main category on the item page:

Code: [Select]

     switch($this->getLocation()) {
                case('item'):
                    if( $this->getSection() == 'item_add' ) {
                        $l = array('title' => $this->title['item_add' ]);
                        $this->addLevel($l);
                        break;
                    }

                    $aCategory = osc_get_category('id', osc_item_category_id());
                    // remove
                    View::newInstance()->_erase('categories');
                    View::newInstance()->_erase('subcategories');
                    View::newInstance()->_exportVariableToView('category', $aCategory);

                    $l = array(
                        'url'   => osc_search_category_url(),
                        'title' => osc_category_name()
                    );
                    $this->addLevel($l);



vivekshan

  • Jr. Member
  • **
  • Posts: 70
Re: Order of breadcrumb navigation on item page
« Reply #5 on: April 10, 2019, 02:56:54 pm »
sorry for the long wait
Find this

$aCategory = osc_get_category('id', osc_item_category_id());
                    // remove
                    View::newInstance()->_erase('categories');
                    View::newInstance()->_erase('subcategories');
                    View::newInstance()->_exportVariableToView('category', $aCategory);
                    $l = array(
                        'url'   => osc_search_category_url(),
                        'title' => osc_category_name()
                    );
                    $this->addLevel($l);


and Replace

$aCategory = osc_get_category('id', osc_item_category_id());
                    $parentCategory = osc_get_category('id', $aCategory['fk_i_parent_id']);
                    // remove
                    View::newInstance()->_erase('categories');
                    View::newInstance()->_erase('subcategories');
                    View::newInstance()->_exportVariableToView('category', $parentCategory);

                    $l = array(
                        'url'   => osc_search_category_url(),
                        'title' => osc_category_name()                    );
                    $this->addLevel($l);
                   
                    View::newInstance()->_exportVariableToView('category', $aCategory);
                    $l = array(
                        'url'   => osc_search_category_url(),
                        'title' => osc_category_name()
                    );
                    $this->addLevel($l);

If this helps mark this as Solved

door

  • Newbie
  • *
  • Posts: 35
Re: Order of breadcrumb navigation on item page
« Reply #6 on: April 10, 2019, 09:36:25 pm »
Thank you, this works.

The code is in this file: yourdomain.com/oc-includes/osclass/classes/Breadcrumb.php

vivekshan

  • Jr. Member
  • **
  • Posts: 70
Re: Order of breadcrumb navigation on item page
« Reply #7 on: April 10, 2019, 10:57:16 pm »
ok good to hear from you that it works

so mark this thread as solved

vivekshan

  • Jr. Member
  • **
  • Posts: 70
Re: Order of breadcrumb navigation on item page
« Reply #8 on: April 12, 2019, 11:36:37 am »
This is why we dont help others

After getting solution People forget to mark thread as solved

Thread mark as solved help people to find real answer

Do it now mr door

Qosmio Studio

  • Jr. Member
  • **
  • Posts: 71
Re: Order of breadcrumb navigation on item page
« Reply #9 on: July 10, 2019, 10:03:47 pm »
hope the admin can do it..