Newbie

Posts

Joined
Sun Nov 01, 2009 12:49 pm

Post by thanaa » Sat Nov 07, 2009 2:15 am

Yes, you need to re-write part of product/category.tpl and change :

Code: Select all

    <?php if ($products) { ?>
    <div class="sort">
      <div class="div1">
        <select name="sort" onchange="location=this.value">
          <?php foreach ($sorts as $sorts) { ?>
          <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
          <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
          <?php } else { ?>
          <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
          <?php } ?>
          <?php } ?>
        </select>
      </div>
      <div class="div2"><?php echo $text_sort; ?></div>
    </div>
    <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><br />
          <?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 } ?>
          <?php } ?>
          <?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 } ?>
    </table>
to :

Code: Select all

    <?php if ($products) { ?>
    <div class="sort">
      <div class="div1">
        <select name="sort" onchange="location=this.value">
          <?php foreach ($sorts as $sorts) { ?>
          <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
          <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
          <?php } else { ?>
          <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
          <?php } ?>
          <?php } ?>
        </select>
      </div>
      <div class="div2"><?php echo $text_sort; ?></div>
    </div>
    <ul class="list">
      <?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 ($display_price) { ?>
          <?php if (!$products[$j]['special']) { ?>
          <span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span><br />
          <?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 } ?>
          <?php } ?>
          <?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 } ?></li>
        <?php } ?>
    
      <?php } ?>
  </ul>
You will then need to adjust your css respectively to make it display how you wish. Basically though all i did was replace the <table class="list"> with <ul class="list"> and removed the <tr> and </tr> and replaced the <td></td> with <li></li> .

New member

Posts

Joined
Tue May 05, 2009 2:12 am

Post by thanaa » Sat Nov 07, 2009 7:50 am

soo on teh way home i realized i forgot to modify one other part, so replace your actual code w/ this section, not the one i linked above. The one above would create extra <li> elements if your count was under 4.

Code: Select all

 <?php if ($products) { ?>
    <div class="sort">
      <div class="div1">
        <select name="sort" onchange="location=this.value">
          <?php foreach ($sorts as $sorts) { ?>
          <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
          <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
          <?php } else { ?>
          <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
          <?php } ?>
          <?php } ?>
        </select>
      </div>
      <div class="div2"><?php echo $text_sort; ?></div>
    </div>
    <ul class="list">
      <?php for ($j = 0; $j < sizeof($products); $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 ($display_price) { ?>
          <?php if (!$products[$j]['special']) { ?>
          <span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span><br />
          <?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 } ?>
          <?php } ?>
          <?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 } ?></li>
    
      <?php } ?>
  </ul>

New member

Posts

Joined
Tue May 05, 2009 2:12 am

Post by brandonyim » Sat Nov 07, 2009 9:04 am

thanaa wrote:soo on teh way home i realized i forgot to modify one other part, so replace your actual code w/ this section, not the one i linked above. The one above would create extra <li> elements if your count was under 4.

Code: Select all

 <?php if ($products) { ?>
    <div class="sort">
      <div class="div1">
        <select name="sort" onchange="location=this.value">
          <?php foreach ($sorts as $sorts) { ?>
          <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
          <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
          <?php } else { ?>
          <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
          <?php } ?>
          <?php } ?>
        </select>
      </div>
      <div class="div2"><?php echo $text_sort; ?></div>
    </div>
    <ul class="list">
      <?php for ($j = 0; $j < sizeof($products); $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 ($display_price) { ?>
          <?php if (!$products[$j]['special']) { ?>
          <span style="color: #900; font-weight: bold;"><?php echo $products[$j]['price']; ?></span><br />
          <?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 } ?>
          <?php } ?>
          <?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 } ?></li>
    
      <?php } ?>
  </ul>
HI, cant.. It shows "Parse error: syntax error, unexpected $end in /home/bigcurve/public_html/catalog/view/theme/default/template/product/category.tpl on line 86"

http://www.bigcurve.my
http://www.facebook.com/bigcurve
http://www.lelong.com.my/brandonyim
http://www.mudah.my/bigcurve
http://brandslife.blogspot.com


Newbie

Posts

Joined
Sun Nov 01, 2009 12:49 pm

Post by thanaa » Sat Nov 07, 2009 8:08 pm

both code sections i posted display without php errors (although the first one behaved abnormally) Just guessing because i cant see you actual code, that line 86 is the last line in that file. If thats the case then you've probably got an unclosed if statement somewhere, my guess is you accidentally deleted the one right before the <?php if($products) {?> line. Post the contents of your category.tpl and i could tell you for certain. But what i posted up there is correct, i just re-downloaded the default theme and re-modified it to check and make sure.

New member

Posts

Joined
Tue May 05, 2009 2:12 am

Post by brandonyim » Mon Nov 16, 2009 7:29 pm

Hi, below are my codes in category.tpl

Code: Select all

<div class="top">
  <h1><?php echo $heading_title; ?></h1>
</div>
<div class="middle">
  <?php if ($description) { ?>
  <div style="margin-bottom: 15px;"><?php echo $description; ?></div>
  <?php } ?>
  <?php if ($categories) { ?>
  <table class="list">
    <?php for ($i = 0; $i < sizeof($categories); $i = $i + 4) { ?>
    <tr>
      <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
      <td width="25%"><?php if (isset($categories[$j])) { ?>
        <a href="<?php echo $categories[$j]['default/template/product/href']; ?>"><img src="<?php echo $categories[$j]['default/template/product/thumb']; ?>" title="<?php echo $categories[$j]['name']; ?>" alt="<?php echo $categories[$j]['name']; ?>" style="margin-bottom: 3px;" /></a><br />
        <a href="<?php echo $categories[$j]['default/template/product/href']; ?>"><?php echo $categories[$j]['name']; ?></a>
        <?php } ?></td>
      <?php } ?>
    </tr>
    <?php } ?>
  </table>
  <?php } ?>
  <?php if ($products) { ?>
    <div class="sort">
      <div class="div1">
        <select name="sort" onchange="location=this.value">
          <?php foreach ($sorts as $sorts) { ?>
          <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
          <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
          <?php } else { ?>
          <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
          <?php } ?>
          <?php } ?>
        </select>
      </div>
      <div class="div2"><?php echo $text_sort; ?></div>
    </div>
    <ul class="list">
      <?php for ($j = 0; $j < sizeof($products); $j++) { ?>
     
        <li><?php if (isset($products[$j])) { ?>
          <a href="<?php echo $products[$j]['default/template/product/href']; ?>"><img src="<?php echo $products[$j]['default/template/product/thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
          <a href="<?php echo $products[$j]['default/template/product/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><br />
          <?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 } ?>
          <?php } ?>
          <?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 } ?></li>
   
      <?php } ?>
  </ul>
    <?php } ?>
  </table>
  <div class="pagination"><?php echo $pagination; ?></div>
  <?php } ?>
</div>
<div class="bottom">&nbsp;</div>
Hope anyone can help. Thanks.

http://www.bigcurve.my
http://www.facebook.com/bigcurve
http://www.lelong.com.my/brandonyim
http://www.mudah.my/bigcurve
http://brandslife.blogspot.com


Newbie

Posts

Joined
Sun Nov 01, 2009 12:49 pm

Post by thanaa » Mon Nov 16, 2009 10:21 pm

brandonyim wrote:Hi, below are my codes in category.tpl

Code: Select all

<div class="top">
  <h1><?php echo $heading_title; ?></h1>
</div>
<div class="middle">
  <?php if ($description) { ?>
  <div style="margin-bottom: 15px;"><?php echo $description; ?></div>
  <?php } ?>
  <?php if ($categories) { ?>
  <table class="list">
    <?php for ($i = 0; $i < sizeof($categories); $i = $i + 4) { ?>
    <tr>
      <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
      <td width="25%"><?php if (isset($categories[$j])) { ?>
        <a href="<?php echo $categories[$j]['default/template/product/href']; ?>"><img src="<?php echo $categories[$j]['default/template/product/thumb']; ?>" title="<?php echo $categories[$j]['name']; ?>" alt="<?php echo $categories[$j]['name']; ?>" style="margin-bottom: 3px;" /></a><br />
        <a href="<?php echo $categories[$j]['default/template/product/href']; ?>"><?php echo $categories[$j]['name']; ?></a>
        <?php } ?></td>
      <?php } ?>
    </tr>
    <?php } ?>
  </table>
  <?php } ?>
  <?php if ($products) { ?>
    <div class="sort">
      <div class="div1">
        <select name="sort" onchange="location=this.value">
          <?php foreach ($sorts as $sorts) { ?>
          <?php if (($sort . '-' . $order) == $sorts['value']) { ?>
          <option value="<?php echo $sorts['href']; ?>" selected="selected"><?php echo $sorts['text']; ?></option>
          <?php } else { ?>
          <option value="<?php echo $sorts['href']; ?>"><?php echo $sorts['text']; ?></option>
          <?php } ?>
          <?php } ?>
        </select>
      </div>
      <div class="div2"><?php echo $text_sort; ?></div>
    </div>
    <ul class="list">
      <?php for ($j = 0; $j < sizeof($products); $j++) { ?>
     
        <li><?php if (isset($products[$j])) { ?>
          <a href="<?php echo $products[$j]['default/template/product/href']; ?>"><img src="<?php echo $products[$j]['default/template/product/thumb']; ?>" title="<?php echo $products[$j]['name']; ?>" alt="<?php echo $products[$j]['name']; ?>" /></a><br />
          <a href="<?php echo $products[$j]['default/template/product/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><br />
          <?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 } ?>
          <?php } ?>
          <?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 } ?></li>
   
      <?php } ?>
  </ul>
    <?php } ?>
  </table>
  <div class="pagination"><?php echo $pagination; ?></div>
  <?php } ?>
</div>
<div class="bottom">&nbsp;</div>
Hope anyone can help. Thanks.
Remove the <?php }?> that comes after the line

Code: Select all

 <div class="pagination"><?php echo $pagination; ?></div>

New member

Posts

Joined
Tue May 05, 2009 2:12 am

Post by vimal » Wed Mar 17, 2010 4:41 am

Hi All,

I have tried to use this code. What it does is instead of showing the products in the grid, it shows in a list. However, it doesn't show any product text etc. Is it possible to have product with product name, say 100 words from product description shown in one row?

Thanks!
Vimal.

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by vimal » Wed Mar 17, 2010 6:13 am

So far, I have managed to play around with the code and get the thing to be shown nicely by just playing around with td and tr. The whole thing is solved if there is a way to display the product description in the catalog/view/theme/your_theme/template/product/category.tpl file.

Tried to add <?php echo $description; ?> but it doesn't show description. I know I must do something to the controller file but dont know what..hehe

Also, is there a way to cap the max words of description in this page to say 100 words only?

Code: Select all

<table class="list">
      
      <td>
	  <?php for ($i = 0; $i < sizeof($products); $i = $i + 4) { ?>
        <?php for ($j = $i; $j < ($i + 4); $j++) { ?>
        <tr><?php if (isset($products[$j])) { ?>
			<td width="25%">
				<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 />
			</td>
			<td style="width:60%; text-align: left;>
				<a style="font-size:12px; font-weight:bold;" 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/><br/>
				<?php echo $description; ?>
			</td>
			<td style="width:15%; text-align:right">
			  <?php if ($display_price) { ?>
			  <?php if (!$products[$j]['special']) { ?>
			  <span style="color: #3c97e6; font-weight: bold;"><?php echo $products[$j]['price']; ?></span><br />
			  <?php } else { ?>
			  <span style="color: #3c97e6; font-weight: bold; text-decoration: line-through;"><?php echo $products[$j]['price']; ?></span> <span style="color: #F00;"><?php echo $products[$j]['special']; ?></span>
			  <?php } ?>
			  <?php } ?>
			  <?php if ($products[$j]['rating']) { ?>
			  <img src="catalog/view/theme/bathroom/image/stars_<?php echo $products[$j]['rating'] . '.png'; ?>" alt="<?php echo $products[$j]['stars']; ?>" />
			  <?php } ?>
			  <?php } ?>
			</td>
		</tr>
        <?php } ?>
      </td>
      <?php } ?>
    </table>

www.beeshop.se
Starta webbshop, Starta e-butik, Starta e-handel


Active Member

Posts

Joined
Wed Aug 26, 2009 8:54 am
Location - Sweden

Post by Horgan » Mon Jul 19, 2010 10:16 pm

Hi, which css file should I edit?

Newbie

Posts

Joined
Mon Jul 19, 2010 10:13 pm

Post by lotus » Wed Oct 06, 2010 9:20 pm

Horgan wrote:Hi, which css file should I edit?
Hi,

Anyone can lead me to which css file to edit here? 8)

Vimal, did you get this working fully?

New member

Posts

Joined
Fri Jul 16, 2010 9:50 pm
Who is online

Users browsing this forum: No registered users and 65 guests