close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Sorting product and seach result

Thread begun 1/27/2010 5:23 am by tolushayoo193471 | Last modified 2/01/2010 6:07 pm by Eric Mittman | 3302 views | 9 replies |

tolushayoo193471

Sorting product and seach result

Hi
1) I will like my product page to show recent products that I've just being added to the database instead of being the last. I want it to show first. please help.

2) And another problem am having is that if i search for a particular product on my hompage the result will bring out all the products in the database instead of bringing out the one that was search for.

please help

Sign in to reply to this post

Eric Mittman

The products will list on this page by ascending order based on the id, so the last added products will show last in the list. To update this you just need to go the the line that has the recordset on in and change the ASC at the end to be DESC.

Products_Results.php
end of line 155

change from this:

php:
ProductID) = ProductID ORDER BY products.ProductName ASC";



to this:

php:
ProductID) = ProductID ORDER BY products.ProductName DESC";



As for the search it should be using keyword searches using like, so if you type in the partial name of a product it should return any product that has that partial term in it. Do you have a link to your site and a test search value so we can see this?

Sign in to reply to this post

tolushayoo193471

Sorting product and seach result

I've check the recordet and I cant seem to find these line
ProductID) = ProductID ORDER BY products.ProductName ASC";

thanks

Sign in to reply to this post

Eric Mittman

If you can post back with the product results page I can show you where to make this edit.

As for the search what should the result be of the search term you posted? I can see that there are hundreds of results when I use that search string.

As a simple test of the search I used the word snail and got back 3 products with the word snail in them. I then searched for moses and got 4 results. If I search for moses snail I get back six results (one of the items fits both searches). So the search is using an or comparison as the space separator. Would you like it to use 'AND' for this rather than 'OR' and ensure that all of the terms entered match?

Sign in to reply to this post

tolushayoo193471

please find he attached
thanks

Sign in to reply to this post

Eric Mittman

I had added the order by clause to the page myself and forgot this was not a part of the default file. I'm including an updated copy of this page for you. It should list the products by the id in descending order, so the last products added should be at the top of the list.

As for the search what do you think about this? Would you like to change it to have to match all of the search terms or is having it find results for any search terms ok?

Sign in to reply to this post

tolushayoo193471

Sorting product and seach result

Thank you very much. I like to change it to have to match all of the search terms but i dont know how

Sign in to reply to this post

Eric Mittman

In the products results page on line 46 is the line that controls how the search terms are treated. Currently the AND separator is ", " and the OR separator is just a space " ". So if you have more than one work separated by just a space then it will use or and find any matches for any of the terms.

You can change this around so that a dash is the separator for the OR by making it like this:

php:
$WADbSearch1->keywordComparison($KeyArr1,"".((isset($_GET["S_ProductName"]))?$_GET["S_ProductName"]:"")  ."","AND","Includes",",%20","-","%22","%22",0);



This will make it search for the entire string in the product name.

So if you want to have it combine the terms with an explicit or you would separate the words by with a - rather than a space (word1-word2), if you want to explicitly use and you would use a comma space like this (word1, word2).

Sign in to reply to this post

tolushayoo193471

Sorting product and seach result

thank you for your help. God bless

Sign in to reply to this post

Eric Mittman

Your welcome, let us know if you have any further questions or if you encounter any problems.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...