Hi David,
another question, another thread - I hope this is ok ;-)
A pagination at the product site (the comparison table) would be nice - list 10 products at the same time and then show a link with "more products" or better links to product-site1, product-site2 and so on.
Thank you and best regards,
Alex
Works fine! Thank you... again ;-)
Best regards,
Alex
Hello David,
i have same problem and i have integrate your script but the link in the bottom not have $q values...
For example i see this page ../products.php?q=ACCESSORI+Cinture&all=1 (in this moment have 88 prices) i dispaly 10 prices and in the bottom 2 link Previus Page and More Prices but the value of this link not save $q and if i click i return to ../products.php (blank page)...
Have any solutions ???
Thank's
Hi Marco,
Here's the final replacement from above for use without rewrite:
</table>
<?php
if ($k > ($pricesPerPage-1)) print " <a href='?q=".urlencode($q)."&page=".($pricesPage - 1)."'>Previous Page</a>";
if ($k < (count($prices["products"])-1)) print " <a href='?q=".urlencode($q)."&page=".($pricesPage + 1)."'>More Prices...</a>";
?>
Cheers,
David.
--
PriceTapestry.com
Hi David
I would like to add to the below if that is ok.
I am making individual pages for example products.php and using the following code:
<?php
$_GET["q"] = "category:Football-Gifts";
require("searchcode.php");
require("html/searchresults.php");
?>
The problem i have is it is displaying the amount of products that is listed in the config.php file which is 50.
Can i ask how do i add a next a previous option on the page and have it so it only lists 15 products then the custom clicks on next and it lists the next 15 products and so on.
{link saved}
Many thanks
Paul
Hi Paul,
You could override the results per page at the top of searchcode.php e.g.
$config_resultsPerPage = 15;
Then to add the pagination just call in html/navigation.php after the search results e.g.
<?php
$_GET["q"] = "category:Football-Gifts";
require("searchcode.php");
require("html/searchresults.php");
require("html/navigation.php");
?>
Cheers,
David.
--
PriceTapestry.com
Hi Alex,
It's reasonably straight forward to add pagination into your products page prices table. In your html/prices.php, look for the following code around line 9:
<?php foreach($prices["products"] as $product): ?>
...and REPLACE that with:
<?php foreach($prices["products"] as $k => $product): ?>
<?php
$pricesPerPage = 10;
$pricesPage = (isset($_GET["page"])?$_GET["page"]:1);
if ($k < ($pricesPerPage * ($pricesPage-1))) continue;
if ($k > (($pricesPerPage * $pricesPage))-1) break;
?>
Next, look for where the prices table is closed by this code at line 19:
</table>
...and REPLACE that with:
</table>
<?php
if ($k > ($pricesPerPage)) print " <a href='?page=".($pricesPage - 1)."'>Previous Page</a>";
if ($k < (count($prices["products"])-1)) print " <a href='?page=".($pricesPage + 1)."'>More Prices...</a>";
?>
This will give you "More Prices..." and "Previous Page" links where there are more results than $pricesPerPage as set in the first part of the modification...
Cheers,
David.
--
PriceTapestry.com