Hi all, I touched on this quite some time ago but can't seem to find the thread.
I want to change the behaviour of my site when products are disabled. Instead of displaying the product not found page and issuing a 404 message, I want the product to display as normal.
So essentially, all I want disabling a product to do is for it to not be listed in the front facing catalogue and thus ensuring that the original link tot the item (whilst the id exists) still works. meaning that if someone shared a link somewhere to an old product, I still want that link to work and display the product.
so as a start, in the following file:
includes/modules/pages/product_info/header_php.php
this code:
PHP Code:
// if specified product_id is disabled or doesn't exist, ensure that metatags and breadcrumbs don't share inappropriate information
$sql = "select count(*) as total
from " . TABLE_PRODUCTS . " p, " .
TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_status = '1'
and p.products_id = '" . (int)$_GET['products_id'] . "'
and pd.products_id = p.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
$res = $db->Execute($sql);
if ( $res->fields['total'] < 1 ) {
unset($_GET['products_id']);
unset($breadcrumb->_trail[sizeof($breadcrumb->_trail)-1]['title']);
$robotsNoIndex = true;
header('HTTP/1.1 404 Not Found');
}
I assume I just remove the p.products_status = '1' WHERE clause and that will remove the 404 bit?
Thats just the start, can someone point me to ALL the other places I need to make a similar change so that the page displays correctly even when the product is disabled?
Many Thanks
Phil
Bookmarks