Improving on the default Classifieds site

Last post 07-08-2009 8:13 AM by po10cy. 17 replies.

Sort Posts:

  • Improving on the default Classifieds site

    05-13-2009, 2:49 AM
    • Member
      4 point Member
    • po10cy
    • Member since 05-12-2009, 9:35 AM
    • Posts 17
    Hi there

    Ive started customizing my classifieds ads template and its looking pretty good. Functionality wise there are some features that is missing that I'm hoping someone here might be able to help with.

    1) How do I flag a registered user as various user types. eg: Free user, silver user, gold user. Aswell how do I have it so users can select which user type they wish to be when registering and it flags them automatically for me as that.

    2) How do set various levels of importance of an advertisement. eg: i want to be able to flag a ad as 'premium', which will always list it first on top regardless of posted date. gold ads will be viewed next, then silver, then free user ads listed at the bottom.

    3) how do i customise the ad listing of the various advertisement types. eg: premium ads i want to have a blue bar on the right of the listing of each ad with "premium" written in text, gold must have a gold bar etc.

    4) How can i make it so that whenever a users advertisement is about to expire, it emails them informing that it is about to expire?

    5) How can i access from the administrator side a list of all the registered users and have the option to suspend the user account, delete a user account, or re-activate a user account while the site is live. what is the simplest control/method you guys have implemented to have the working on the classifieds site.

    These are the major issues im trying to get working on the site. Great forum!
  • Re: Improving on the default Classifieds site

    05-14-2009, 9:29 PM
    • Contributor
      2,578 point Contributor
    • darkknight187
    • Member since 09-14-2006, 4:35 AM
    • Bothell, Washington
    • Posts 1,010

    Wow, you're asking a lot in a single post.

    I assure you you'll have better results if you take things one step at a time.

    But I'll start you out with managing your users.

    I found a piece of code set in a zip file. All you have to do is register yourself through your normal website registration.

    Put the users.aspx file in your root folder so anyone can access it, type the location your browser, and change your login Id from guest to Admin.

    AND THE MOST IMPORTANT PART IS AFTER YOU HAVE CHANGED YOURSELF TO AN ADMINISTRATOR,
    MOVE THAT FILE TO A PROTECTED AREA OF YOUR SITE.

    I wish I could take credit for writing the code but it was done by TomT, great piece of code.

    Go here http://forums.asp.net/t/1110595.aspx the link for the users.aspx file is at the bottom of the first post.

    And there you go.
    It does leave out one thing though.
    When you use the file above, it does not delete the member from the classifieds database.
    So I added a storedprocedure to do this.

    You should note that I am not using the exact code above.
    I used a users.cs file that I converted to vb.
    But you should be able to make my addition work.

    You need to start with the user file you use for managing your members.
    And you need to understand how it works.

    When it runs through and deletes them member tell it to get the username you want to delete.

    MembersDB.RemoveMemberFromDatabase(ListBox1.SelectedValue)

    That line above tells it to go into App_Data/BLL/Members.vb
    and looks for a sub your about to create, RemoveMemberFromDatabase

    Public Shared Sub RemoveMemberFromDatabase(ByVal UserName As String)

    Using db As New MembersDataAdapter()

    db.RemoveMemberByUsername(UserName, "/")

    End Using

    End Sub

    That sub tells it to look in App_Code/DAL/Members.xsd

    I like to go into the code itself, and I just copied insertmember, deleted the entries, only leaving the top three.
    THE NAMES BELOW ARE ABBREVIATED.

    RETURN

    ASPNETusername

    ASPNETAPPNAME

    Since you copied, don't forget to change ALL insertmember (only in the one you copied) to RemoveMemberByUsername

     

    Now it looks for your stored procedure.

    Here's one I wrote.

    ALTER PROCEDURE RemoveMemberByUsername @AspNetUsername nvarchar(256),

    @AspNetApplicationName nvarchar(256)

    AS

    DELETE FROM classifieds_Members

    WHERE (AspNetUsername = @AspNetUsername) AND (AspNetApplicationName = @AspNetApplicationName)

    And it should work.
    (Note that I am using the final version so it says my members table is classifieds_Members)
    If you are using beta, just remove "classifieds_"

    Make sure you make a backup before trying new code, and test it out before publishing.



     

    For the email notification you need to add code to the hourlyMaintenanceTimer to check for ads to expire.
    It already does a check if it is expired, use that as a guideline,
    And add a if statement to send an email if it will expire in 7 days or whatever you choose.

     

    Questions 1, 2, & 3.
    Use an if statement to tell the app what to do.

    Good Luck

    -Daniel

     

    Please remember to click “Mark as Answer” on the post that helps you.
    This can be beneficial to other community members reading the thread.
  • Re: Improving on the default Classifieds site

    05-15-2009, 12:23 AM
    • Member
      12 point Member
    • ansii
    • Member since 05-13-2009, 9:33 AM
    • Posts 6

     Hi darkknight,

    I have benefited a lot from your postings. Keep up the goodwork. I don't know C#, but your help through the postings helped me a lot in learning it slowly. Would you mind giving the above code in C# to check how to send a mail if it will expire.

    Regarding the answer for 1,2 & 3, you have said put an IF statement to tell what it should do. But, where and how will you store whether the user is a premium, free or silver user. Please forgive me as I  am a novice and learning now only.

    Thanks & Regards

    Anand

  • Re: Improving on the default Classifieds site

    05-16-2009, 8:00 PM
    • Contributor
      2,578 point Contributor
    • darkknight187
    • Member since 09-14-2006, 4:35 AM
    • Bothell, Washington
    • Posts 1,010

    You'll never learn anything if you don't try.
    And if you don't know C# why are you using it?
    There's more helpers in Visual Web Developer for developing using VB.

    Try this for coverting code.

    http://www.developerfusion.com/tools/convert/vb-to-csharp/

     

    Make backups, and try.
    When coding you have to think of it as a very specific map to get to a point.

    I recommend using pen and paper to map it out.
    I find it easier that way.

    I would store your user status, premium or whatever, in the members table.
    Follow the path when a user registers.
    Look for anything that has to do with members.

    One step at a time, your going to have a lot of issues when things don't work.
    And you made a ton of upgrades at a time.
    Pick one upgrade, and work on that.

    Good Luck

    -Daniel

     

    Please remember to click “Mark as Answer” on the post that helps you.
    This can be beneficial to other community members reading the thread.
  • Re: Improving on the default Classifieds site

    05-19-2009, 2:51 AM
    • Member
      4 point Member
    • po10cy
    • Member since 05-12-2009, 9:35 AM
    • Posts 17
    Thanks for the help so far. Another question i have is: when you flag an AD as featured, it is listed on the home page, is there any way to make the featured Ad listed at the top of all the Ads when you browse the categories and have a different background color? I dont want featured Ads to only stand out on the homepage but throughout the entire site. Thanks alot.
  • Re: Improving on the default Classifieds site

    05-19-2009, 3:06 AM
    • Member
      4 point Member
    • po10cy
    • Member since 05-12-2009, 9:35 AM
    • Posts 17
    oh btw the link to the users.zip file to enable me to delete and manage users once the site is live doesnt work?
  • Re: Improving on the default Classifieds site

    05-20-2009, 9:18 AM
    • Contributor
      2,578 point Contributor
    • darkknight187
    • Member since 09-14-2006, 4:35 AM
    • Bothell, Washington
    • Posts 1,010

    For the featured ads sorting change the stored procedure getalladsbyquery.
    At the bottom it tells the system to sort by DateCreated.
    Make it sort by Featured

    And the users.aspx file DOES work, I use it all the time.

    Again you are not giving any information.
    "Doesn't work" is not a statement that anyone can help you with.

    What happens?
    Why do you think it doesn't work?

    Write a complete question.

    Please remember to click “Mark as Answer” on the post that helps you.
    This can be beneficial to other community members reading the thread.
  • Re: Improving on the default Classifieds site

    05-20-2009, 9:42 AM
    • Member
      4 point Member
    • po10cy
    • Member since 05-12-2009, 9:35 AM
    • Posts 17
    Brilliant thanks alot that will help big time!

    I understand that featured ads are listed as priority of 50, and normal ads as 10. is there anyway to make it sort by those numbers and not just "Featured"? this way, i can have it so that perhaps gold users ads are priority of 40, silver as 30, bronze 20 and featured on 50. then it will list all ads in that order based on priority level.

    sorry man, what i said was the "LINK" to the zip file doesnt work, not that the actual file doesnt work, just that I am unable to download it. :)

    All i need now is a way to flag users as bronze, silver or gold when they register, and automatically set the priority level of any ads they post based on that, and my site will be ready to go.

    any help to do that would be hugely appreciated.
  • Re: Improving on the default Classifieds site

    05-20-2009, 9:31 PM
    • Contributor
      2,578 point Contributor
    • darkknight187
    • Member since 09-14-2006, 4:35 AM
    • Bothell, Washington
    • Posts 1,010

    It already sorts by those numbers.
    As far as flagging the member as silver or whatever, it's to involved to do a walk through.
    Make a backup of your project just in case you screw it up.
    And start playing with anything that has to do with members.
    Besides, you'll learn a lot more that way.

    And I just downloaded the users.zip file again.
    Works fine.

    http://home.mchsi.com/~j.roal/Users.zip

    If it doesn't work for you, send me a private message and I'll email it to you.

     

    Please remember to click “Mark as Answer” on the post that helps you.
    This can be beneficial to other community members reading the thread.
  • Re: Improving on the default Classifieds site

    05-21-2009, 2:27 AM
    • Member
      4 point Member
    • po10cy
    • Member since 05-12-2009, 9:35 AM
    • Posts 17
    ok great that fixes that.

    yeah ok what i think ill do is ill add a string somewhere which tells me what user type each user is. Then on the page i approve ads before it gets posted ill add a option for "gold" "silver" "bronze" underneath "featured" which will give it the level it needs based on the user, as just approving it while "normal" is selected will give it a level of 10.

    thanks for all the help. I am now, happy lol
  • Re: Improving on the default Classifieds site

    05-31-2009, 10:26 AM
    • Contributor
      2,578 point Contributor
    • darkknight187
    • Member since 09-14-2006, 4:35 AM
    • Bothell, Washington
    • Posts 1,010

    So I was making an upgrade to handle another image size and I didn't know you could set it this easily.
    I figured you could just set one parameter, but as you can see,
    it sorts by preview, then by date. Nice.
    But take a look at the storedprocedure GetPhotosByAdId
    At the bottom it tells the app how to order the results.

    ORDER BY IsMainPreview DESC, DateCreated

    You could do the same thing for your Featured Ads.
    By the way the DESC is for descending, use ASC if you want to sort by ascending.

    Please remember to click “Mark as Answer” on the post that helps you.
    This can be beneficial to other community members reading the thread.
  • Re: Improving on the default Classifieds site

    06-01-2009, 2:35 AM
    • Member
      4 point Member
    • po10cy
    • Member since 05-12-2009, 9:35 AM
    • Posts 17
    tnx ill give that a try. for some reason when i make a search with no search term, it still lists by date. another issue i cant get sorted, on my home page it only lists 1 featured ad when it should list 5. any reason why?
  • Re: Improving on the default Classifieds site

    06-01-2009, 10:06 AM
    • Contributor
      2,578 point Contributor
    • darkknight187
    • Member since 09-14-2006, 4:35 AM
    • Bothell, Washington
    • Posts 1,010

    po10cy:
    another issue i cant get sorted, on my home page it only lists 1 featured ad when it should list 5. any reason why

    Probably because your code is wrong.
    But you didn't post any, so not sure what's wrong.

    po10cy:
    for some reason when i make a search with no search term, it still lists by date.


    Take a look at how it gets the ads in App_Code/BLL/Ads

    There's a bit of code if no search term is entered . . .
    Please remember to click “Mark as Answer” on the post that helps you.
    This can be beneficial to other community members reading the thread.
  • Re: Improving on the default Classifieds site

    06-01-2009, 10:21 AM
    • Member
      4 point Member
    • po10cy
    • Member since 05-12-2009, 9:35 AM
    • Posts 17
    cool shot ill look thru it. the featured ad problem my code is all standard code that it came as. in the app_code/bbl/ads feature, i have looked for the store procedure, and changed it to sort by AdLevel instead of the date, still no joy. ill continue scratching until it gets sorted.
  • Re: Improving on the default Classifieds site

    06-01-2009, 11:57 AM
    • Member
      23 point Member
    • lingyun2003
    • Member since 04-29-2006, 2:28 PM
    • Posts 13
    the featured ads including photos can be displayed in the default.aspx , otherwise ,they cant be displayed though marked with the feature
Page 1 of 2 (18 items) 1 2 Next >