1

How can i show full category names in breadcrumb on product details page. Currently it is coming like https://www.screencast.com/t/5o9uZEu8xnV I want like this https://www.screencast.com/t/1pfZkoVSWLov

0

To display category name in bread cums you have to override block breadcrumbs of default magento to your module.

You can override block with reference block using layout file. like below.

add layout file catalog_product_view.xml in your module Path should be: app\code\Vendor\Module\view\frontend\layout\catalog_product_view.xml

<?xml version="1.0"?>
<page>
    <body>
    <referenceBlock name="breadcrumbs" remove="true" />
    <referenceContainer name="page.top">
        <block class="Vendor\Module\Block\Crumbblock" name="crumbs" as="crumbs" template="Vendor_Module::crumbs.phtml" />
    </referenceContainer>
    </body>
</page>

Check this reference link for more details.

  • will this show categories, sub cat everything? have you tried this code? – Nafsss Jul 9 '20 at 9:42
  • This is working but creating problem when one product belongs to more than one category – Nafsss Jul 9 '20 at 10:08
  • it was worked fine for me.. there might be a problem if you are using custom theme. and also code may not work due to magento different version. so you have to debug. – Chirag Patel Jul 9 '20 at 10:24
0

Simply you install this extension.

After Install extension run below commands :-

php bin/magento s:up
php bin/magento s:s:d -f
php bin/magento c:c
php bin/magento c:f

After you install you got this error like :-

Notice: Undefined index: id in E:\xampp\htdocs\magento\vendor\magento\module-config\Model\Config\Structure\Element\Iterator.php on line 63

How to solve this error follow this step

1.) Go to this path :- app/code/Eadesigndev/FullBreadcrumbs/etc/adminhtml and Open the system.xml file.

2.) Change this code like :-

In section tag above add this code

<tab id="eadesign_extensions" translate="label" sortOrder="2000">
  <label>Custom Tab</label>
</tab>

UPDATE

<?xml version="1.0"?>
<config
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
    <system>
        <tab id="eadesign_extensions" translate="label" sortOrder="2000">
            <label>Custom Tab</label>
        </tab>
        <section id="ea_fullbreadcrumbs" sortOrder="150" type="text" showInDefault="1" showInWebsite="1"
                 showInStore="1">
            <label>Full Breadcrumbs</label>
            <tab>eadesign_extensions</tab>
            <resource>Eadesigndev_FullBreadcrumbs::fullbreadcrumbs_configuration</resource>
            <group id="fullbreadcrumbs" translate="label" sortOrder="10" type="text" showInDefault="1" showInWebsite="1"
                   showInStore="1">
                <label>Full Breadcrumbs</label>
                <field id="enabled" translate="label" sortOrder="10" type="select" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Enable</label>
                    <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="bad_categories" translate="label comment" sortOrder="20" showInDefault="1" showInWebsite="1"
                       showInStore="1">
                    <label>Exluded categories</label>
                    <comment>Enter the IDs of the categories that will be excluded from Full Breadcrumbs. ex:
                        4,12,15,14,78
                    </comment>
                </field>
            </group>
        </section>
    </system>
</config>

And After you chnage run below command :-

php bin/magento c:c
php bin/magento c:f

Thanks .

  • Does this work when you have one product in multiple categories?? which category path it takes? – Nafsss Jul 9 '20 at 11:18
  • Hello @StevenHarris Yes, working one product in multiple categories and i kindly suggest you install and check – Mohit Patel Jul 9 '20 at 12:26
  • Hi, what to change in system.xml please explain properly – Nafsss Jul 16 '20 at 12:49
  • you open this file Eadesigndev/FullBreadcrumbs/etc/adminhtml and Open the system.xml and section tag above add this code <tab id="eadesign_extensions" translate="label" sortOrder="2000"> <label>Custom Tab</label> </tab>. – Mohit Patel Jul 21 '20 at 12:14
  • And solve the issues accept answer so useful other community . – Mohit Patel Jul 21 '20 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.