Hi David,
Happy New Year! I hope that 2010 is a prosperous one for you and all your customers, especially ME!
As I work in Wordpress mostly, I wonder whether there is a way of limiting the number results that are shown in post such as 10 or 12 for example, as I use the following calling code in posts, the number of results are sometime verbose with lots of products results which can span across lots of pages. I would quite like the idea of showing say the top 10 best selling ideas from say a merchant, or of a particular type of product.
I suspect it wowuld be through using an sql query and the LIMIT statement, but don't know how to incorporate it? I hoped you could help.
My current calling code...
<?php if (!$_GET["product"]): ?>
<div id="pricehi-lo">
<a href="?maxPrice=30.00">Under £30</a> |
<a href="?minPrice=30.00&maxPrice=50.00">£30 - £50</a> |
<a href="?minPrice=50.00&maxPrice=100.00">£50 - £100</a> |
<a href="?minPrice=100.00&maxPrice=200.00">£100 - £200</a> |
<a href="?minPrice=200.00">Over £200</a> |
<a href="?sort=priceAsc">Price - Low to High</a> |
<a href="?sort=priceDesc">Price - High to Low</a>
</div><br/>
<?php endif; ?>
<?php
$external_baseHREF = "{link saved}";
$external_path = "{code saved}";
if (!$_GET["q"] && !$_GET["r"] && !$_GET["merchant"])
{
$_GET["q"] = "category:PT Summerdresses,BeachSkirts and Dresses,Day Dresses,GODDIVA UNIQUE,CELEBRITY DRESSES,Maxi Dresses,Casual Dress,Home Dresses All Dresses,Home Dresses 10 Off Dresses";
if (!$_GET["sort"]) $_GET["sort"] = "priceDesc";
if (!$_GET["minPrice"]) $_GET["minPrice"] = "20.00";
if (!$_GET["maxPrice"]) $_GET["maxPrice"] = "1000.00";
}
require($external_path."external.php");
?>
Thanks again
Paul
Hi david,
Thanks for this
I have updated the extermal.php and used the calling code below:
<?php
$external_baseHREF = "http://www.s229581664.websitehome.co.uk/mystore/";
$external_path = "/kunden/homepages/45/d229581650/htdocs/mystore/";
if (!$_GET["q"] && !$_GET["r"] && !$_GET["merchant"])
{
$_GET["q"] = "category:PT Summerdresses,BeachSkirts and Dresses,Day Dresses,GODDIVA UNIQUE,CELEBRITY DRESSES,Maxi Dresses,Casual Dress,Home Dresses All Dresses,Home Dresses 10 Off Dresses";
if (!$_GET["sort"]) $_GET["sort"] = "priceDesc";
if (!$_GET["minPrice"]) $_GET["minPrice"] = "20.00";
if (!$_GET["maxPrice"]) $_GET["maxPrice"] = "1000.00";
}
$external_maxResults = 10;
require($external_path."external.php");
?>
Though I get a result, I get 8 x 3 rows of results rather than the 10 requested?
Any ideas please?
Paul
Hi Paul,
Ah - a little more code required sorry - in place of the modification described above, use:
$resultCount = $rows[0]["resultcount"];
if ($external_maxResults)
{
if ($resultCount > $external_maxResults)
{
$resultCount = $external_maxResults;
$sql = str_replace($offset.",".$config_resultsPerPage,$external_maxResults,$sql);
}
}
Cheers,
David.
Hi Daavid,
Perfecto! works a treat.
Thanks Again
Paaul
Hi Paul,
Happy new year likewise!
That should be straight forward to plumb in. First, add a new variable to your calling code (on the line before external.php is called), e.g.:
$external_maxResults = 10;
And then in your external.php, look for the following code around about line 502:
$resultCount = $rows[0]["resultcount"];
...and REPLACE that with:
$resultCount = $rows[0]["resultcount"];
if ($external_maxResults)
{
if ($resultCount > $external_maxResults) $resultCount = $external_maxResults;
}
Note that hf $external_maxResults is less than or equal to your $config_resultsPerPage setting then the navigation bar will not be displayed which may be the effect you're after.
Hope this helps!
Cheers,
David.