Results 1 to 5 of 5

Thread: How to change empty categories page to 404 response page vs. default message (200 ok)

  1. #1
    Join Date
    Oct 2011
    Posts
    6

    Default How to change empty categories page to 404 response page vs. default message (200 ok)

    I'm wondering if there's a way to change the header response to 404 so google doesn't give us a soft 404 error and guide customers to a blank category page with the default message...."This category is currently empty. Please check back soon for new Products..."

    We have a lot of categories that have changed ID's so it would take awhile to manually delete those with no products....unless there's an sql query of some sort that could manage to do that?

    What we are trying to do would be similar to this thread but with categories
    http://forums.aspdotnetstorefront.co...light=soft+404

    We are using Multi-Store v9.3

    Attachment 1547emptyCategory.jpg

  2. #2
    Join Date
    Dec 2008
    Location
    Phoenix, AZ
    Posts
    367

    Default

    SQL: use at own risk (sorry can't test right now but should give you the idea - once oked, run via the Configuration -> Advanced -> Run SQL page in admin):

    Sets the categories with no products to un-published...be careful if you have hierarchy of categories where parent have no products...might need tweaking based on your site.

    UPDATE Category SET Published=0 WHERE CategoryID NOT IN (SELECT CategoryID FROM ProductCategory)
    Jan Simacek - Compunix, LLC
    AspDotNetStorefront Platinum Devnet Partner since 2005

    AspDotNetStorefront Mods and Add-Ons at http://www.ecommercecartmods.com/
    - Searching, Filtering and Sorting (like cSearch, Dealer Locator, Price Ranges, Blog)
    - Reports (like Cart Abandonment and Net Sales)
    - Customer Experience (like Question/Answers)
    - Site and Data Management (like Entity Product Mapper, Bulk Updaters, Make/Model/Year filters)

  3. #3
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    432

    Default

    Yes, I think what you need is possible but it would require some coding.

    Page to change: ShowEntityPage.cs

    At the lines where it would normally redirect the customer back to the default.aspx page (at least in v9.x). Before it does this, you would have to try and retrieve the category ID and if it was non-zero, render a new page output asking the customer to try another category.

    This could be done simply by using a string resource, or slightly more complex by using a custom XMLPackage.

    I'd estimate 1hr's dev to do something like this.
    Adam

  4. #4
    Join Date
    Feb 2012
    Location
    Dallas, TX
    Posts
    10

    Default

    Hi! Did you ever find a solution for this? I am having a similar issue.

    Thanks!
    Andrew

  5. #5
    Join Date
    Oct 2011
    Posts
    6

    Default Similar Post

    I was able to produce a 404 error page on the custom error pages that cause soft 404 but it was for the product not found pages...this might set you on the right track though

    http://forums.aspdotnetstorefront.co...e-ranking-Drop

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •