VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: panoss on August 31, 2016, 09:17:21 AM

Title: How to display categories' description in frontpage?
Post by: panoss on August 31, 2016, 09:17:21 AM
My VM frontpage displays categories.
But displays only the image, not the description.
How can I make it display the description?
Title: Re: How to display categories' description in frontpage?
Post by: VMTemplates.net on August 31, 2016, 10:42:41 AM
Hi,

you may need to use html override. If you already have it please open /templates/YOUR_TEMPLATE/html/com_virtuemart/sublayouts/categories.php
and paste this code below somewhere between lines 67 and 79:

<?php echo shopFunctionsF::limitStringByWord ($category->category_description150' ...'?>

in these lines:

    <div class="category floatleft<?php echo $category_cellwidth $show_vertical_separator ?>">
      <div class="spacer">
        <h2>
          <a href="<?php echo $caturl ?>" title="<?php echo vmText::_($category->category_name?>">
          <?php echo vmText::_($category->category_name?>
          <br />
          <?php // if ($category->ids) {
            
echo $category->images[0]->displayMediaThumb("",false);
          
//} ?>

          </a>
        </h2>
      </div>
    </div>


If your template does not provide override you can make it by copy
/components/com_virtuemart/sublayouts/categories.php
and paste it to
/templates/YOUR_TEMPLATE/html/com_virtuemart/sublayouts/
Title: Re: How to display categories' description in frontpage?
Post by: panoss on August 31, 2016, 11:13:47 AM
I put it directly in the code, without override, works fine.

I just hoped that it could be done without changing the code (not even with an override).
I guess it can't be done in some other way.

Thank you for your help!
Title: Re: How to display categories' description in frontpage?
Post by: Studio 42 on August 31, 2016, 11:36:13 AM
panoss, you cannot update virtuemart, or you loose your changes, it's why overide is better.
Title: Re: How to display categories' description in frontpage?
Post by: panoss on August 31, 2016, 11:46:34 AM
I didn't think of this, thanks, I'll make an override.