user3340565
user3340565

Reputation: 45

opencart make table of categories insted of carousel

I am just trying to remake manufacturers carousel so that it will show categories with their images. Part of it I have done. Now i jast want to show them in table 4 in a row. Here is the code that is file catalog/view/module/carousel.tpl/

<div id="carousel<?php echo $module; ?>" class="owl-carousel">
   <div class="category"> 
        <table>
    <?php if($categories) { ?>
    <?php $count = 0;?>
        <?php foreach ($categories as $category) { ?>
        <?php if($count % 4 == 1){?>
         <tr>
         <?php}?>
        <td>
        <a href="<?php echo $category['href']; ?>" <?php echo $category['name']; ?></a>
       <img src="<?php echo $category['image'] ?>" alt="<?php echo $category['name']; ?>" title="<?php echo $category['name']; ?>" class="img-thumbnail" />
      <p><?php echo $category['name']?> 
      </td>
       <?php if($count % 4 == 0){?>
       </tr>
        <?php}?> 
      <?php } ?>
      <?php } ?>
        </table>
      </div>
</div>
<script type="text/javascript"><!--
$('#carousel<?php echo $module; ?>').owlCarousel({
    items: 15,
    autoPlay: 1000000,
    navigation: false,
    navigationText: ['<i class="fa fa-chevron-left fa-5x"></i>', '<i class="fa fa-chevron-right fa-5x"></i>'],
    pagination: false


});
--></script>

As a result of it I am getting error unexpected end of file. What am I doing wrong? Are their better solutions? I am using opencart version 2.0.1.1

Upvotes: 1

Views: 170

Answers (1)

Code Lღver
Code Lღver

Reputation: 15593

You need to make some minor changes and this will work:

<?php if($count % 4 == 0){?>
   </tr>
<?php } ?> //here you need to change
$count++;

Give the space after <?php tag. due to this the error occurs. There is require a space after this tag.

And you are increasing the value of $count.

Upvotes: 1

Related Questions