Page 3 of 4

Re: Featured / Special Offer / Latest Products

Posted: Mon Aug 18, 2008 8:59 pm
by Qphoria
I wouldn't be the expert intermediate developer I am today without those 2 tools.

Re: Featured / Special Offer / Latest Products

Posted: Tue Aug 26, 2008 9:45 pm
by ptal
Wow,
I got it working. It wasn't 'white-space:nowrap;' after all. It seemed that Firefox took the width as 33.3% from the .products in the default.css .
I added a new .featured in the default.css and changed the width to 100%; pointed the class ="featured" in the featured.php and firefox leaped with joy. This should probably be an update because it will affect any shopper who uses firefox for every store.

It now works like a charm.

Phil

Re: Featured / Special Offer / Latest Products

Posted: Thu Aug 28, 2008 11:48 am
by johny2k
bruce wrote: I recently installed this contribution as follows and it works perfectly.

After following the installation instructions, I put the following (some surrounding code shown for positioning) into catalog\controller\home.php

Code: Select all

        $template->set('content', $view->fetch('content/home.tpl'));

        $template->set($module->fetch());

        $template->set('show_latest', true);
        $template->set('show_specials', true);
        $template->set('show_featured', true);

        $response->set($template->fetch('layout.tpl'));
and modified catalog\template\default\layout.tpl as follows

Code: Select all

  <div id="content">
    <?php 
        if (isset($content)) echo $content; 
        if (isset($latest) & isset($show_latest)) echo $latest; 
        if (isset($featured) & isset($show_featured)) echo $featured; 
        if (isset($specials) & isset($show_specials)) echo $specials; 
    ?>  
  </div>
So for example, $latest is set if the module is enabled and you only have to set $show_latest in the template of the controller(s) where you want to display the latest products.

Please note
  • the code snippet as shown, would display them all on in the home page.
  • the isset check on $content that was around the content div is moved inside the content div
  • putting everything including $content inside the content div maintains a continuous line on the left side for the default template
Thanks for your sharing Bruce, i have been follow the code you provide. below is my home.php code,

catalog/controller/home.php

Code: Select all

		$view->set('products', $product_data);

		$template->set('content', $view->fetch('content/home.tpl'));

		$template->set($module->fetch());
	
        $template->set('show_specials', true);
        $template->set('show_featured', true);

		$response->set($template->fetch('layout.tpl'));
	}
}
?>
& my catalog/template/defaul/layout.tpl code:

Code: Select all

  <div id="column">
    <?php if (isset($cart)) { ?>
    <?php echo $cart; ?>
    <?php } ?>
    <?php if (isset($category)) { ?>
    <?php echo $category; ?>
    <?php } ?>
    <?php if (isset($review)) { ?>
    <?php echo $review; ?>
    <?php } ?>
    <?php if (isset($information)) { ?>
    <?php echo $information; ?>
    <?php } ?>
  </div>
  <div id="content">
    <?php 
        if (isset($content)) echo $content; 
        if (isset($featured) & isset($show_featured)) echo $featured; 
        if (isset($specials) & isset($show_specials)) echo $specials; 
    ?>  
  </div>
  <?php if (isset($footer)) { ?>
  <div id="footer"><?php echo $footer; ?></div>
  <?php } ?>
</div>
<?php if (isset($time)) { ?>
<div id="time"><?php echo $time; ?></div>
<?php } ?>
</body>
</html>
& i only enable module special offer extensions, but my layout looks like got problem (please see the picture below). Can you tell me why? & what should i do? Thank you.

Re: Featured / Special Offer / Latest Products

Posted: Thu Aug 28, 2008 1:07 pm
by david.gilbert
Looks to me like your missing the CSS to style it correctly.

-Dave

Re: Featured / Special Offer / Latest Products

Posted: Thu Aug 28, 2008 1:41 pm
by johny2k
david.gilbert wrote: Looks to me like your missing the CSS to style it correctly.

-Dave
Hi, Dave, i`m still not understand. Can you show me where should i fix it? Thank you.

Regards,
John

Re: Featured / Special Offer / Latest Products

Posted: Thu Aug 28, 2008 3:13 pm
by bruce
Hi John,

There is nothing broken with the code or layout. Except that it is not beautiful.  ;)

You just need to change the file catalog\template\default\module\featured.tpl (and specials.tpl) to produce a more pleasing result. These templates use default.css as the source of styles so you may need to add some styles there too.

Re: Featured / Special Offer / Latest Products

Posted: Thu Aug 28, 2008 3:23 pm
by johny2k
david.gilbert wrote: Looks to me like your missing the CSS to style it correctly.

-Dave
Hi, Dave & Bruce. I have been solve it myself, below is the code i modify. Really thanks to all of you, especially Bruce. I will try my best to help other member to solve the problem.  ;) :-*

I modify catalog\template\default\module\special.tpl

From:

Code: Select all

<p class="heading"><?php echo $heading_title; ?></p>

<?php if ($products) { ?>
  <table style="width:100%;">
  <?php foreach ($products as $product) { ?>
    <tr class="products">
	<td style="width:33.3%;"><a href="<?php echo $product['href']; ?>">
         <img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>"
           alt="<?php echo $product['name']; ?>" /></a></td>
       <td><b><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></b> - <?php echo $product['desc']; ?></td>
	  <td><?php echo $product['price']; ?></td>
    </tr>
  <?php } ?>
  </table>
<?php } else { ?>
  <p><?php echo $text_notfound; ?></p>
<?php } ?>
Change to:

Code: Select all

<p class="heading"><?php echo $heading_title; ?></p>

<?php if (isset($products)) { ?>
  <?php foreach ($products as $product) { ?>
<div class="products"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a><br />
  <b><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></b><br />
  <?php echo $product['price']; ?></div>
  <?php } ?>
<?php } else { ?>
  <p><?php echo $text_notfound; ?></p>
<?php } ?>
So now my layout looks like picture below, hope this can provide some help to who need it, cheers............!!!!!

Re: Featured / Special Offer / Latest Products

Posted: Fri Aug 29, 2008 3:48 am
by kellen
So I'm not sure if anyone is interested or not, but I will post code for my modified featured.tpl and a picture. I got rid of the product descriptions, then used only 2 columns and added a 3rd larger column for pictures or text or something. Please note that the large pictures are hard coded in because I'm not skilled enough to add something to the admin menu

Like I said, not sure if anyone is interested but I thought id see if I could contribute a bit with my n00bish abilities.

Code: Select all

<!-- Initialize Counter -->
<?php $monkeycount = 0; ?>
<!-- Heading -->
<p class="heading"><?php echo $heading_title; ?></p>
<!-- Main containment table -->
<table style="width: 100%; text-align: center; padding: 0px">
	<tr>
		<td style="width: 50%">
			<!-- Product table -->
			<table style="width: 100%; text-align: center; padding: 0px">
				<tr>
					<?php if ($products) { ?>
						<?php foreach ($products as $product) { ?>
							<td style="width: 25%" valign="top">
								<div class="products2">
									<a href="<?php echo $product['href']; ?>">
										<img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>">
									</a><br />
									<b><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></b><br />
									<?php echo $product['price']; ?>
								</div>
							</td>
							<!-- New row if statement -->
							<?php $monkeycount = $monkeycount + 1; ?>
							<?php if($monkeycount > 1) { ?>
								</tr><tr>
								<?php $monkeycount = 0; ?>
							<?php } ?>
						<?php } ?>
					<?php } else { ?>
						<p><?php echo $text_notfound; ?></p>
					<?php } ?>
				</tr>
			</table>
		</td>
		<!-- Picture column -->
		<td style="width: 75%; border-left: 1px solid #000000" valign="top">
			<div style="text-align: center; width: 100%">
				<img class="bigimage" src="/replace_imgagePATH/" width="90%" height="90%" alt=""/>
			</div>
			<br />
			<div style="text-align: center; width: 100%">
				<img class="bigimage" src="/replace_imgagePATH/" width="90%" height="90%" alt=""/>
			</div>
		</td>
	</tr>
</table>

Re: Featured / Special Offer / Latest Products

Posted: Fri Aug 29, 2008 10:57 am
by bruce
Don't be shy, this is really good. And the way you did the unique large images is the only way of doing it, so well done there too.

Re: Featured / Special Offer / Latest Products

Posted: Wed Sep 03, 2008 12:07 pm
by kellen
:) thanks bruce!

Re: Featured / Special Offer / Latest Products

Posted: Thu Sep 11, 2008 8:26 pm
by WallyJ
I like ptal's suggestion below... but I'm not sure how to add the class to the featured.php.

I already added the new "featured" class to the default css, but I don't see a class in the featured.php and am unsure of where to add this new class to fix the firefox bug.

Thanks.
ptal wrote: Wow,
I got it working. It wasn't 'white-space:nowrap;' after all. It seemed that Firefox took the width as 33.3% from the .products in the default.css .
I added a new .featured in the default.css and changed the width to 100%; pointed the class ="featured" in the featured.php and firefox leaped with joy. This should probably be an update because it will affect any shopper who uses firefox for every store.

It now works like a charm.

Phil

Re: Featured / Special Offer / Latest Products

Posted: Thu Sep 11, 2008 9:04 pm
by bruce
Yes, not featured.php but catalog\template\default\module\featured.tpl

Re: Featured / Special Offer / Latest Products

Posted: Fri Sep 12, 2008 10:01 am
by WallyJ
Thanks Bruce.... I made the change to 100%, changed "products" to "featured" in featured.ptl, but nothing happened...

What could I have missed?

Re: Featured / Special Offer / Latest Products

Posted: Fri Sep 12, 2008 10:05 am
by bruce
Possibly you put

featured

instead of

.featured

in default.css

If this page is on your web site, could you post a link?

Re: Featured / Special Offer / Latest Products

Posted: Fri Sep 12, 2008 10:40 am
by WallyJ
www.actforums.com is the site...

Here is the section of my default.css

Code: Select all


.products, .images, .categories {
	float: left;
	width: 33.3%; 
	text-align: center; 
	cursor: pointer;
	font-size: 10px; 
	height: 140px;
}

.featured {
	float: left;
	width: 100%; 
	text-align: center; 
	cursor: pointer;
	font-size: 10px; 
	height: 140px;
}


still not sure what to do. Thanks for taking a look! Looks fine in IE, not firefox... and is there a way to shorten the descriptions, like the Review sidebox does...  But first, the Firefox fix... hehe

Re: Featured / Special Offer / Latest Products

Posted: Fri Sep 12, 2008 1:47 pm
by bruce
The style applied is not "featured" but is instead 

Code: Select all

.products, .images, .categories (line 220)
{
   float: left;
   width: 33.3%;
   text-align: center;
   cursor: pointer;
   font-size: 10px;
   height: 140px;
}
you need to change          to   

It is not a "bug" in firefox either. Safari displays the same. IE tends to interpret width percentages based on page width whereas firefox does it based on the container width.

To get them all working the same, set the width as a fixed pixel amount.

Re: Featured / Special Offer / Latest Products

Posted: Fri Sep 12, 2008 8:13 pm
by WallyJ
At first I was confused, because I knew I had made that change in the tpl file. But I realized that I only made the change in the "featured.tpl" file, and not the files for "latest" and "specials".

You have to make the change in all files that you are showing on the home page.

Thanks Bruce.

Re: Featured / Special Offer / Latest Products

Posted: Fri Sep 12, 2008 8:52 pm
by bruce
My pleasure.

Re: Featured / Special Offer / Latest Products

Posted: Tue Dec 23, 2008 8:30 pm
by drkramik
bruce wrote:
The answer to your second question has been answered many times on the forums. You only need to search.
You may post links then because i couldn't find the answer browsing the forum...
I have found the footer.tpl but i would like to know where is located the "$text_powered_by" and being able to modify it. Thanks.

Re: Featured / Special Offer / Latest Products

Posted: Tue Dec 23, 2008 10:01 pm
by JNeuhoff
I have found the footer.tpl but i would like to know where is located the "$text_powered_by" and being able to modify it. Thanks.
It's located in file /catalog/language/english/extension/module/footer.php