cb2004 Posted June 8, 2016 Share Posted June 8, 2016 I have creating a website that reads an XML file to pull in products (pages). When a product is out of stock in the XML file, this page becomes unpublished. I want to display a different 404 message to what is usually seen if a product is unpublished and was just wondering the best way to go about this? Or would the best thing be to set it to hidden, and then check if the page is hidden on the template level and do the logic there? Cheers. Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted June 9, 2016 Share Posted June 9, 2016 Have not tried it so no gurantees. 404 page is just a page (though with it's id or name or both hard coded somewhere in the core). It is accessible in the page tree. So try to change the template of that page and write some code in template file to handle your case. Something has to be availiable there, like the url initially requested. But honestly I do not think that throwing a 404 for a product out of stock is a good idea in the first place. Maybe show some message (but with the 200 code) and handle the case in the product template file. 6 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now