You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.
If an old product link is hit and the product is no longer in the database, this message is displayed invaliditem telling the customer the item is invalid, make a selection from the menu.
#1 is I would alter the displayed message to read "This item is sold out or no longer available. Please make another selection from our site menu."
#2 is I would like that page to return a 404 header "not found". That way products you remove from your site are no longered spidered and indexed in the search engines. Currently, that page returns a 200 "ok" header. So 100 deleted products all point to the same page with a 200 header and nothing is telling the search engines that item is gone.
How can I apply a 404 header when invaliditem is called?
Offline
Noone has a clue how to accomplish this?
Offline
theblade24 wrote:
#1 is I would alter the displayed message to read "This item is sold out or no longer available. Please make another selection from our site menu."
You'll have to manually update the ccp0.invaliditem ID in the khxc_messages table to alter the message about an item being invalid. The message displayed by default is "The item you selected cannot be viewed. Please make a selection from the menu to continue.".
theblade24 wrote:
#2 is I would like that page to return a 404 header "not found". How can I apply a 404 header when invaliditem is called?
You'd have to do that with entries in .htaccess.
Offline
The 404 would have to be generated by CCP as it would have already passed through htaccess and made it to the point that the item is not in the db and in turn displays invaliditem.
Currently a link residing in the search engine (but is no longer in the site db) goes to the invalid item page and returns a header of 200 ok. So if you delete 100 products, those 100 products will continue to be spidered and indexed by all the search engines because they will get a 200 ok header when they visit each url..... and duplicate content penalty will be applied because eventually youll have 100 pages all with the same exact content "The item you selected cannot be viewed. Please make a selection from the menu to continue."
If an item is no longer offered, that url should return a 404 header. ATS modded CCP5.1 to do this for me inside of CCP.
How can this be done inside of CCP6?
Last edited by theblade24 (02-14-2009 14:34:32)
Offline
It can't be done in CCP. You should know which products have been removed and if you add their URLs to .htaccess they'll get caught before they get to CCP.
Offline
You can't add hundreds, thousands, of lines to htaccess. The server would crawl.
CCP isn't marketed for small stores with onesie twosie changing products. If you add or drop a vendor you could have ten, a hundred, a thousand products no longer available. So all those products continue to return a 200 ok header to search engines even though they no longer exist.
That is flawed logic.
If it could be done in CCP5.1 it can be done in CCP6.
Offline
theblade24 wrote:
You can't add hundreds, thousands, of lines to htaccess. The server would crawl.
Not true at all. Apache is extremely good at what it does and a large .htaccess file should cause no perceptible difference in response time.
theblade24 wrote:
If it could be done in CCP5.1 it can be done in CCP6.
Comparing the 2 versions is like comparing a VM Beetle to a Lamborghini.
Offline
In the area where the error message logic is...
What if an if statement was entered there so if "error message = invaliditem" then die
and it would blow me out of ccp with an error just like the page didnt exist on the server?
I could then build a custom 404 error page to redirect after 5 seconds to the home page.
Can that be done? If invaliditem is called it blows you out? Not 500 internal server error, it just errors you out of ccp entirely?
Offline
Dave, can you point me please to the location in the CCP6 code where http headers are output?
Offline
In the core file names KHXC_Display but you need to be VERY careful if you're going to try to change it. I do not recommend attempting it (I know I sure wouldn't).
Offline
If a product, category, or page is not found in the db at all......
is there an app or namespace or something called besides the invaliditem message? something that could work in an if statement?
or could the if statement include whatever triggers the invaliditem message be used?
I'm assuming you're talking about this area
} else { $expdate = @gmdate('D, d M Y H:i:s', @time() - 3600); $nowdate = @gmdate('D, d M Y H:i:s', @time()); $contlength = strlen($this->buffered_output); header('Pragma: no-cache'); header('Cache-Control: must-revalidate'); header('Expires: ' . $expdate . ' GMT'); header('Content-Length: ' . $contlength); header('Last-Modified: ' . $nowdate . ' GMT'); header('X-Powered-By: KHXC/' . $this->version); } // End of if statement.
Offline
theblade24 wrote:
is there an app or namespace or something called besides the invaliditem message? something that could work in an if statement?
Not really. CCP buffers all of its output and calls the skin as the very last thing before the output buffer is sent to the browser.
theblade24 wrote:
or could the if statement include whatever triggers the invaliditem message be used?
I suppose you could brute force things and find all of the places where that message is used and blow away the buffered output and do something completely different outside of CCP. You'd have to modify several pieces of core code to accomplish that though.
theblade24 wrote:
I'm assuming you're talking about this area
Code:
} else { $expdate = @gmdate('D, d M Y H:i:s', @time() - 3600); $nowdate = @gmdate('D, d M Y H:i:s', @time()); $contlength = strlen($this->buffered_output); header('Pragma: no-cache'); header('Cache-Control: must-revalidate'); header('Expires: ' . $expdate . ' GMT'); header('Content-Length: ' . $contlength); header('Last-Modified: ' . $nowdate . ' GMT'); header('X-Powered-By: KHXC/' . $this->version); } // End of if statement.
That's where the headers are started yes.
Offline