You are here:  » Sorting by price


Sorting by price

Submitted by thepricesite on Wed, 2006-09-13 15:40 in

Hi all,
Does anyone know how i can add an option to all my products to sort by price such as :-

By Price:
Under £40
£40 - £120
£120 - £180
£180 - £300
Over £300

I presume this would need to be added onto the products.php page?

Also - can anyone help me add a section on the index page to show recently reviewed items?

Any thoughts would be good!

Regards,
Michael :)

Submitted by support on Wed, 2006-09-13 17:08

Hi Michael,

A couple of people have had a go at price range searching the in past, but it turns out to be a lot more complicated than you might imagine! For example, the price range would need to be reflective of the products in the result - set, a £40 - £100 range would not be much use on a page showing Plasma TVs for example. If you search the forum for "price range" and "price search" you will find a few threads on the subject that you might find interesting.

Regarding links to the latest reviewed product, have a go with something like this:

<?php
  $sql 
"SELECT * FROM reviews ORDER BY approved DESC LIMIT 5";
  if (
database_querySelect($sql,$reviews))
  {
    foreach(
$reviews as $review)
    {
      if (
$config_useRewrite)
      {
        
$reviewHREF "review/".tapestry_hyphenate($review["product_name"]).".html";
      }
      else
      {
        
$reviewHREF "reviews.php?q=".urlencode($review["product_name"]);
      }
      print 
"<p><a href='".$reviewHREF."'>".$review["product_name"]."</a></p>";
    }
  }
?>

Hope this helps!

Cheers,
David.

Submitted by thepricesite on Thu, 2006-09-14 07:18

Thank you David,
I will have a look over the weekend re the review pages.
It seems my site is being crawlled at last :) So should hopefully see some visitors over the coming weeks.

Michael @ ThePriceSite