Post by Tiger1937 » Fri Apr 01, 2011 3:51 pm

Hi,

I want to list my category items in a single column without a picture, just showing :-

Name / Rating / Price / Add Button

on a single line

Any ideas ? I thought I'd done it, but when there's only a single line to show I get an error ;-(

New member

Posts

Joined
Fri Mar 05, 2010 7:42 pm

Post by Tiger1937 » Fri Apr 01, 2011 6:03 pm

Worked it out now, works a treat ;-) Thanks

New member

Posts

Joined
Fri Mar 05, 2010 7:42 pm

Post by scanreg » Fri Apr 01, 2011 7:30 pm

How did you do it?

Active Member

Posts

Joined
Thu May 06, 2010 12:15 am

Post by Tiger1937 » Fri Apr 01, 2011 8:11 pm

Rightly or Wrongly....

I modified the code in /catalog/view/theme/default/template/product/category.tpl to th listing below. The 'if' is just a check on the model, as I wanted everything else to be in 4 columns as normal, but for one product range to be in 1 column as there are so many products.

Check out the code, compared to the standard and you'll see straight away what#s been added.

If you find a better way, please let me know ;-) , I'm still pretty new to this.




Code: Select all

<?php
$supp=substr($products[0]['model'],0,1);
if ($supp=="M")
{?>
    <table class="left">
      <?php for ($i = 0; $i < sizeof($products); $i = $i + 1) { ?>
      <tr>
        <?php for ($j = $i; $j < ($i + 1); $j++) { ?>
        <td width="65%"><?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>
   <!--
          <span style="color: #999; font-size: 11px;"><?php echo $products[$j]['model']; ?></span>
   -->
	</td>
        <td width="10%" align = "left">

          <?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 } else { ?> 
           No Rating
          <?php } ?>

         </td>
         <td width = "15%" align = "right">
          <?php if ($display_price) { ?>
          <?php if (!$products[$j]['special']) { ?>
          <span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span>
          <?php } else { ?>
          <span style="color: #900; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
          <?php } ?>
	  </td>

          <td width = "5%" align = "right">
          <a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
		  <?php } ?>
          <br />

          <?php } ?>
          <br />
          </td>

        <?php } ?>
      </tr>
      <?php } ?>

<?php } else { ?>
    <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 ($display_price) { ?>
          <?php if (!$products[$j]['special']) { ?>
          <span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span>
          <?php } else { ?>
          <span style="color: #900; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
          <?php } ?>
          <a class="button_add_small" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" >&nbsp;</a>
		  <?php } ?>
          <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 } ?></td>
        <?php } ?>
      </tr>
      <?php } ?>

<?php } ?>


    </table>

New member

Posts

Joined
Fri Mar 05, 2010 7:42 pm
Who is online

Users browsing this forum: No registered users and 10 guests