3

I've updated the default breadcrumbs.phtml which now displays the company logo within the breadcrumb section, however I do not need the logo to show on category pages.

I have tried to update my catalog_category_view.xml to pass an argument to the block:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
            <arguments>
                <argument name="show_logo" xsi:type="boolean">false</argument>
            </arguments>
        </block>
    </body>
</page>

and within my breadcrumbs.phtml I am trying to get the value of the show_logo by:

echo $this->getData('show_logo');

Unfortunately, this isn't working?

Can anyone please help me to understand why this isn't working and how I can get this to work so that I can check the argument so I can check whether to show the logo or not?

Thanks

  • You can easily check by current page, if current page is catalog_category_view then hide it – Keyur Shah Nov 24 '17 at 10:27
  • Hi Keyur, any advise on how to check the current page? Sorry, i'm new to magento development and haven't really got any clue on how to do anything at the moment :/ – heady12 Nov 24 '17 at 10:33
  • if you try the echo false its normal see anything – Mohamed El Mrabet Nov 24 '17 at 11:50
1

You have to use the following method instead of:

$this->getShowLogo();

If you want to know the value, use vardump() or print_r().Hope it help you!

| improve this answer | |
  • $this->getData('show_logo') can you please explain why this won't work? – Kalyan Chakravarthi V Sep 6 '18 at 16:07
  • 1
    @KalyanChakravarthiV you should use $this->getDataByKey('show_logo') – Mirko Rapisarda Aug 14 '19 at 10:40
  • Thanks for the clarification Mirko :) – Kalyan Chakravarthi V Aug 14 '19 at 10:56

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.