Jump to content

Display the category description on product detail page


Pragati P

Recommended Posts

Hello 

I had tried to display the category description on product detail page but it is not displaying and mess up all page below syntax i have use to display description

{if $category.description}
       <div id="category-description" class="text-muted">{$category.description nofilter}</div>
{/if}

I have to display on product detail page can you help me how can I show it and in which file need to do modification

 

image.thumb.png.18593d810edec7ba0c01929151d3603e.png

Link to comment
Share on other sites

image.thumb.png.e4850a72151c590c116bbde38beef918.png

42 minutes ago, prestashopfree.com said:

Man, he gave you a link to the whole module. download it from github as a zip and install it.

Their are only 2 files in github code one is controller and another is .tpl it wouldn't be upload thats why I said for whole structure

Link to comment
Share on other sites

In categorydesconproductpage.php change

public function install()
    {
        return (parent::install()
            && $this->registerHook('displayProductAdditionalInfo')
        );
    }

to 

public function install()
    {
        return (parent::install()
            && $this->registerHook('displayProductActions')
        );
    }

and replace categorydesconproductpage.tpl with 

<button type="button" class="btn btn-primary ml-2" data-bs-toggle="modal" data-bs-target="#categorydesconproductpage-modal">ICON</button>

<div id="categorydesconproductpage-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="{l s='Close' d='Shop.Theme.Global'}">
          <span aria-hidden="true"><i class="material-icons">close</i></span>
        </button>
        <p class="modal-title h6">Category description</p>
      </div>
      <div class="modal-body">
        {$description nofilter}
      </div>
    </div>
  </div>
</div>

or if it is not working with 

<button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#categorydesconproductpage-modal">ICON</button>

<div id="categorydesconproductpage-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="{l s='Close' d='Shop.Theme.Global'}">
          <span aria-hidden="true"><i class="material-icons">close</i></span>
        </button>
        <p class="modal-title h6">Category description</p>
      </div>
      <div class="modal-body">
        {$description nofilter}
      </div>
    </div>
  </div>
</div>

Then reset the module. You will need to correct the HTML code to display the icon you want

  • Thanks 1
Link to comment
Share on other sites

59 minutes ago, Piotr3qx said:

In categorydesconproductpage.php change

public function install()
    {
        return (parent::install()
            && $this->registerHook('displayProductAdditionalInfo')
        );
    }

to 

public function install()
    {
        return (parent::install()
            && $this->registerHook('displayProductActions')
        );
    }

and replace categorydesconproductpage.tpl with 

<button type="button" class="btn btn-primary ml-2" data-bs-toggle="modal" data-bs-target="#categorydesconproductpage-modal">ICON</button>

<div id="categorydesconproductpage-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="{l s='Close' d='Shop.Theme.Global'}">
          <span aria-hidden="true"><i class="material-icons">close</i></span>
        </button>
        <p class="modal-title h6">Category description</p>
      </div>
      <div class="modal-body">
        {$description nofilter}
      </div>
    </div>
  </div>
</div>

or if it is not working with 

<button type="button" class="btn btn-primary ml-2" data-toggle="modal" data-target="#categorydesconproductpage-modal">ICON</button>

<div id="categorydesconproductpage-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="{l s='Close' d='Shop.Theme.Global'}">
          <span aria-hidden="true"><i class="material-icons">close</i></span>
        </button>
        <p class="modal-title h6">Category description</p>
      </div>
      <div class="modal-body">
        {$description nofilter}
      </div>
    </div>
  </div>
</div>

Then reset the module. You will need to correct the HTML code to display the icon you want

I have added description to the category it working fine on localhost but in live it doesnt show any thing

https://ebinger-test.lcmx.at/home/167-testing-product.html

you can check the above link

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...