Post by bobbycs » Fri Dec 10, 2010 7:33 pm

Hi guys, the search results are shown by default one product next to the other, i want to know if its posible to show one over the other (vertical) on /catalog/../../../templates/products/search.tpl

i found this, but i couldt make it work

Code: Select all

 <table class="list">
      <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
      <tr>
        <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
        <td width="25%"><?php if (isset($products[$j])) { ?>
          <a href="<?php echo $products[$j]['href']; ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
          <a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br />
          <span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
          <?php if ($products[$j]['rating']) { ?>
          <img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
          <?php } ?><?php echo html_entity_decode($products[$j]['description']);?>

          <?php } ?></td>
        <?php } ?>
      </tr>
      <?php } ?>
    </table>

Newbie

Posts

Joined
Fri Dec 10, 2010 6:07 pm

Post by rezter » Fri Dec 10, 2010 11:27 pm

This is really simple. Just do something like this:

Code: Select all

 
    <ul>
      <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
        <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
        <li><?php if (isset($products[$j])) { ?>
          <a href="<?php echo $products[$j]['href']; ?>"><img src="<?php echo $products[$j]['thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
          <a href="<?php echo $products[$j]['href']; ?>"><?php echo $products[$j]['name']; ?></a><br />
          <span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span><br />
          <?php if ($products[$j]['rating']) { ?>
          <img src="catalog/view/theme/default/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
          <?php } ?><?php echo html_entity_decode($products[$j]['description']);?>
          <?php } ?>
          </li>
        <?php } ?>
      <?php } ?>
    </ul>
You could add a class to <ul> and <li> if you want to change the appearance of the list. See this article for more information on that.

Newbie

Posts

Joined
Tue Dec 07, 2010 10:09 am
Who is online

Users browsing this forum: No registered users and 6 guests