You are here:  » Products under/over $xx

Support Forum



Products under/over $xx

Submitted by Harvey on Wed, 2006-08-23 17:39 in

Thought an ebay style "product under $xx" would make a nice addition to most price comparison sites' home page. A bit like the ebay one.

I'd *imagine* the best way to go about this would be to add a variable in the URL (correct me if I have no idea what I'm talking about...) such as "&maxprice=" and have PHP say if it's set (isset I believe), do the normal things but the price must be

Submitted by support on Wed, 2006-08-23 19:56

Hi Harvey,

This actually ends up being quite a bit more compliated than it sounds i'm afraid. In addition to creating a new query parameter; that parameter then has to be persisted in all the subsequent links to other results pages (page 2,3,4 etc, reorder by relevance, price etc.).

Bear with me on this and let me have a look at the code and consider re-working the way the follow on links work as making them automatically inherit all the query parameters would make this and other modifications far easier...!

Cheers,
David.

Submitted by Harvey on Sat, 2006-08-26 15:26

Hi David,

Thanks for that. Please let me know if you're planning to do the above in the next week or so or if I should outsource it.

Cheers!

Submitted by support on Sat, 2006-08-26 17:44

Hiya,

Could you perhaps describe a little more about exactly how you see this working (as you'd have to do this if you outsource the project anyway)...

Do you want to incorporate price range features on both the search form and search results pages? How do you want to handle variation in suitable price ranges for different classes of product? (price ranges for Home Electronics products would probably not be suitable for clothing, for example)

In particular; what do you want to see on the search form (a drop down price range box, for example)?

Sorry that this one isn't just an easy mod - it really is quite complex i'm afraid - there are performance issues as well (price searching requires a full table scan - which might be very slow on low-end server equipment with thousands of products)...!

Cheers,
David.

Submitted by Harvey on Sun, 2006-08-27 16:47

Hi David,

Thanks for your help. I don't want to waste your time so will outsource it - sounds a bit more work than I anticipated!

The price range modification would serve two purposes. Firstly, users would be able to click a link on the homepage (i.e. for organically referred visitors) - eg. "Diamond rings under $300".

Secondly, having done the above coding I would add two text fields just below the search box (in the header of all my pages), so the user could specify their own range.

As for performance issues, I'll have to test the waters on that. I'm on a shared (but fairly fast) server, so it may present problems.

Thanks

Submitted by support on Mon, 2006-08-28 08:31

Hi Harvey,

I've put together a couple of test scripts for you to evaluate the performance issues of doing this - check your email!

It works as you've described, although I haven't made the follow on links automatically inherit the search form values so they're manually coded in - it works - just not the most elegant way to go about it!

Cheers,
David.

Submitted by Harvey on Tue, 2006-08-29 18:07

Hi David,

Works perfectly! I'll email you the scripts now - not sure whether my coder's changed anything :)

Submitted by atman on Sun, 2006-09-17 02:57

hi david,

is the mod script available for public?

thank you.

Submitted by support on Sun, 2006-09-17 03:02

Hi Alex,

No problem - i'll send you my original test mods by email. There's 3 files that have changed (quite considerably), so I suggest that you experiment by copying them into a test installation of Price Tapestry to see if it does what you want, then merge the changes into your site.

If anybody else wants the mods feel free to drop me an email - but do consider that these changes invoke a full table scan on the database which has performance implications and is not recommended for large sites!

Cheers,
David.

Submitted by stevewales20 on Tue, 2012-11-13 21:09

Hi David,

Would you consider a product database of around 60,000 to be large? Any chance you could email this test script over to me?

Thanks
Steve

Submitted by support on Wed, 2012-11-14 09:23

Hi Steve,

Price Range filtering is actually now built in to the script so you can check it out as follows; first make your query leading to a page for example

/search.php?q=ring

...and then add a max price parameter e.g.

/search.php?q=ring&maxPrice=100.00

If all looks good, you can easily modify the search form to contain min/max price by replacing html/searchform.php with the following alternative version:

<div class='searchform'>
  <form name='search' action='<?php print $config_baseHREF ?>search.php'>
    <input type='text' name='q' id='q' size='35' value='<?php print (isset($q)?$q:""); ?>' />
    from
    <?php print $config_currencyHTML?><input type='text' name='minPrice' size='4' value='<?php print (isset($minPrice)?$minPrice:""); ?>' />
    to
    <?php print $config_currencyHTML?><input type='text' name='maxPrice' size='4' value='<?php print (isset($maxPrice)?$maxPrice:""); ?>' />
    <input type='submit' value='<?php print translate("Search"); ?>' />
  </form>
</div>

Cheers,
David.
--
PriceTapestry.com

Submitted by stevewales20 on Wed, 2012-11-14 10:30

So with a little adaption I could get the filter to work like so:

Under £4
£4 - £10
Above £20

I thougt perhaps the scripts you'd sent was perhaps similar to what I've mentioned above.

Thanks,
Steve

Submitted by support on Wed, 2012-11-14 10:59

Hi Steve,

Sure - as links on the search results page,

<a href='<?php print $config_baseHREF."search.php?q=".urlencode($q); ?>&maxPrice=4.00'>Under £4</a>
<a href='<?php print $config_baseHREF."search.php?q=".urlencode($q); ?>&minPrice=4.00&maxPrice=10.00'>£4 - £10</a>
<a href='<?php print $config_baseHREF."search.php?q=".urlencode($q); ?>&minPrice=10.00&maxPrice=20.00'>£10 - £20</a>
<a href='<?php print $config_baseHREF."search.php?q=".urlencode($q); ?>&minPrice=4.00'>Above £20</a>

Cheers,
David.
--
PriceTapestry.com

Submitted by stevewales20 on Wed, 2012-11-14 13:15

Thank you David.