Question on sort for classifieds

tcbetka
05-21-2012, 05:48 AM
Hi Scott, I have a question for you...

When you sort the classifieds to organize by boat brand, I think there's a problem. Let's say I am looking for a Ranger boat, so I sort by boat brand. Then I find a few boats I'd like to check out. So I click on the first one in the list of Rangers, and it takes me to that ad. But then there is no way to get back to the list of sorted ads--you either have to use the "back" button in your browser to get back to the (unsorted) list; or you have to click on the "Search Ads" menu choice. Either way, the sort has been lost and you have to re-sort by brand again. But you can only do that at the top of the list, so if you are searching for a boat brand that appears in the middle of the list of boats, then it takes forever to actually evaluate several boats.

I think the sort should be maintained. I've never done any .NET web programming, but I have done a bunch of .NET programming in general. I would think that the sort preference can be maintained when paging, and this link seems to suggest that it is possible:

http://www.xefteri.com/articles/show.cfm?id=19

Anyway, I just thought I would bring this up as it would add convenience for potential buyers here on the site.

Thanks for all the work you do on the site though, as it's a great place to hang out...especially during Winternet season!

TB

Golden
05-21-2012, 07:17 AM
I"ll have the programmer take a look at it.

It's not .NET programming, this is a unix box and it's all PHP and we are using a third party program to sort but it might still be an option.

tcbetka
05-21-2012, 09:54 AM
I"ll have the programmer take a look at it.

It's not .NET programming, this is a unix box and it's all PHP and we are using a third party program to sort but it might still be an option.

OK, I see. I could probably come up with some code examples as well, although I have never written PHP before. I actually just picked up a text on ASP.NET from Barnes & Noble this morning. I have a degree in Computer Science and have written quite a bit of C, C++ and (more recently) C# code...but I haven't done much web development at all. However my MI chapter has asked if I would "maintain" the website, so here I go.

Yay.

(Thanks for answering the post, btw...)

TB

Golden
05-21-2012, 10:09 AM
I haven't heard back from the programmer yet.

Hey, once you get comfortable with asp.net and .NET I can sure use someone to work on the Live Leaderboard website.....hint, hint

tcbetka
05-21-2012, 10:20 AM
Yea, I saw that...lol. I'll get back to you when that happens, say in like 2015!

Seriously, I recently retired from my "regular job" so I am now trying to do stuff like this out of a home office. But I simply don't have the requisite experience on ASP.NET just yet, so I didn't contact you. Give me a month or two though, and it might well be a different story.

TB

tcbetka
05-25-2012, 12:38 PM
Scott,

Any news from the programmer on this request?

I looked at the page source for the classifieds, and think I might see an easy way to get this to work. This code here:


function clearForm() {

document.main.keyword.value = "";
//var selectBox =
document.main.ad_category.options[document.main.ad_category.selectedIndex].value = 0
document.main.location_state.options[document.main.location_state.selectedIndex].value = "AA"
document.main.sort_order.options[document.main.sort_order.selectedIndex].value = 0
document.main.recentAds.checked = false;

document.main.submit();

}



...seems to always be called whenever the page is loaded; and apparently when it's reloaded using the back arrow in the browser. So the sort_order value then gets set to '0' each time the page is loaded, which hoses the sort order preference just entered by the user. If you look at the HTML code for the page, you can see where the sort order options are defined:



<select name="sort_order">
<option Value="1" >Most Recent Ads First</option>
<option Value="2" >By State</option>
<option Value="3" >Title</option>
<option Value="4" >Ad Category</option>
<option Value="5" >Price</option>
<option Value="6" >Brand</option>
<option Value="7" >Year</option>
</select>



...so all we somehow need to do is add a function to the js code, that saves the value of sort_order before doing any sorting operation, and then uses that (instead of '0') when the user wants to use the back arrow in their browser. In other words, something like this...


if (sort_order > 0 && sort_order < 7)
var desiredSortOrder = sort_order.value;


...then just use the value stored in "tempSortOrder" when the clearForm() function is called the next time around--as long as the page is not being loaded for the first time again. Or...maybe there's a new function needed, something like "reloadSortedForm()" that gets called to restore the previous state based upon how the user has sorted the page. Anyway, just an idea.

I've been using the sort function a LOT lately, looking at the various Ranger boats listed. It's very cumbersome to keep sorting, scrolling through the entire list, and then trying to remember which of the boats you've already looked at. So I've just been thinking about the problem and how I might go about solving it in C or C++. I have no js-writing experience mind you, but it doesn't seem like rocket science based upon what I've seen in the page source.

TB

James Morris
10-15-2012, 09:37 AM
Back to the top for the new management to consider...

modadmin
10-16-2012, 11:00 AM
Hello James,

Thanks for bringing this back up. I will read it over and let my I.T team have a look over.

Regards,

Mo