Hi David,
I've been playing around with searchresults_external.php trying to get the results to display in a 3 column table, rather than as 1 product per row, as it displays now. Being hopeless at PHP I'm getting into all sorts of knots.
Can you please help? How does this code need to be modified?
searchresults_external.php
<?php
if (file_exists("html/user_searchresults_before.php")) require("html/user_searchresults_before.php");
//echo "<div class='featuredarea'>";
print "<div class='featuredarea'>";
foreach($searchresults["products"] as $product): ?>
<div class="featuredproduct">
<h3><a href='<?php print $product["productHREF"]; ?>' title='<?php print $product["name"]; ?>'><?php print $product["name"]; ?></a></h3>
<?php if ($product["image_url"]): ?>
<p><a href='<?php print $product["productHREF"]; ?>' title='<?php print $product["name"]; ?>'><img width='150' height='150' src='<?php print $product["image_url"]; ?>' alt='<?php print $product["name"]; ?>' title='<?php print $product["name"]; ?>' /></a></p>
<?php endif; ?>
<?php if ($product["numMerchants"] > 1): ?>
<p><em><?php print ("from"); ?></em> <?php print $config_currencyHTML.$product["minPrice"]; ?><br />
<?php else: ?>
<p><?php print $config_currencyHTML.$product["price"]; ?><br />
<?php endif; ?>
<a href='<?php print $product["productHREF"]; ?>' title='<?php print ("Compare Prices"); ?>'><?php print ("Compare Prices"); ?></a>
</p></div>
<?php endforeach; ?>
</div> <div class="clear"></div>
<?php
if (file_exists("html/user_searchresults_after.php")) require("html/user_searchresults_after.php");
?>
Thanks David,
I've just downloaded and it works great.
Just one small bug though. I've noticed that when I use it with searchExternal.php it adds a paragraph above the search results for every 1 product in the search result. Hence, if there's 5 products returned you get 5 spaces preceeding the search results.
In some posts I have around 20 results and it leaves a huge white space gap!
Any ideas on how to eliminate this?
Thanks,
Neil
Hi Neil,
I've come across this before when including HTML with comments into a WordPress page - the comments get wrapped in <p> tags!
To fix this, edit the file and remove the HTML comments from lines 22 and 52...
Cheers,
David.
Hi Neil,
Click here for a version of html/searchresults.php (rename as required) that displays results in columns (you can change the number of columns on line 4)...
Cheers,
David.