VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: Miku on April 03, 2015, 08:10:55 AM

Title: Category description in categories' view
Post by: Miku on April 03, 2015, 08:10:55 AM
Hi,
I would like to display category description in categories layout and looking for help from someone skilled. It looks like that in order to do this we have to override categories.php sublayout using this code <?php echo $this->category->category_description?>
But whereever I have placed the code I'm not able to gain the expected result (the layout is broken) Below is the code where in all probability I should place the trigger, but where do I have to place it?
// Show Category ?>
    <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>


Someone will help?

VM 3.0.6
J! 3.4.1
Title: Re: Category description in categories' view
Post by: Miku on April 03, 2015, 11:38:12 AM
I'll reply to myself  ;) This seems to do the trick
<?php echo shopFunctionsF::limitStringByWord ($category->category_description250' ...'?>
Title: Re: Category description in categories' view
Post by: Miku on April 03, 2015, 20:47:56 PM
It wasn't so simple as I originally thought :( The code works (it nicely displays the category description) but there's definitely something wrong... I mean when I have changed a description of particular category or added the description , there is no effect in the categories view... No change.  :o  What's wrong?  Below is the code
      // Show Category ?>
    <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);
          
//} ?>

        </h2>
<h5>
<?php echo shopFunctionsF::limitStringByWord ($category->category_description300' ...'?>
</h5>
</a>
      </div>
    </div>

Looks like this trigger
<?php echo shopFunctionsF::limitStringByWord ($category->category_description300' ...'?>
doesn't update the data from categories. How is it possible that it displays the description correctly, yet when we have changed something there's no effect. :o :o :o ? What can be wrong?
Title: Re: Category description in categories' view
Post by: Miku on April 04, 2015, 11:53:53 AM
I'm over my head now.. :-\
Why in the world this code below works properly with J!2.5.8 and VM 3.0.7 and doesn't work with J!3.4.1 and VM 3.0.7 - the category description shows up but doesn't update the data after I have changed something in the description :o
<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>
<?php // Category Short Description
          
if (!empty($category->category_description)) {
            
?>

            <h5>
              <?php echo shopFunctionsF::limitStringByWord ($category->category_description300'...'?>
            </h5>
        <?php ?>
      </div>