Disclaimer : I don't understand why do you need this ? But I will give you some hint to sort out the issue.
For catalog product view page, product visibility checking is actually takes place in a helper class. Most specifically it happens in Mage_Catalog_Helper_Product
. Take look on the initProduct
method there. You can see that it checks for product's visibility as like this.
if (!$this->canShow($product)) {
return false;
}
If you further investigate, we can conclude that we will get a no found page for two conditions.
If the status
of your product is disable
.
Product is not assign with current website/store that is viewing.
In order to change this default behaviour, my recommendation is to create a new attribute with name visibility_in_product_view
for every product and then make it a select option with value 1
for yes
and 2
for no
. Now set this value to yes, for every product that you need this exception.
Now rewrite the helper class method Mage_Catalog_Helper_Product::canShow()
as like this.
<?php
class Namespace_Modulename_Helper_Product extends Mage_Catalog_Helper_Product
{
//use to check product view visibility status
const VISIBILITY_IN_PRODUCT_VIEW_PAGE = 1;
public function canShow($product, $where = 'catalog')
{
if (is_int($product)) {
$product = Mage::getModel('catalog/product')->load($product);
}
/* @var $product Mage_Catalog_Model_Product */
if (!$product->getId()) {
return false;
}
if ($product->isVisibleInCatalog()) {
if ($product->isVisibleInSiteVisibility()) {
return true;
} else {
$frontname = Mage::app()->getFrontController()->getRequest()->getModuleName();
$controller = Mage::app()->getFrontController()->getRequest()->getControllerName();
$action = Mage::app()->getFrontController()->getRequest()->getActionName();
if ($frontname.$controller.$action == 'catalogproductview' && Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE == $product->getVisibility()) {
if ($product->getVisibilityInProductView() == self::VISIBILITY_IN_PRODUCT_VIEW_PAGE) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
else {
return false;
}
}
}
This is the part that do the trick here
if ($product->isVisibleInCatalog()) {
if ($product->isVisibleInSiteVisibility()) {
return true;
} else {
$frontname = Mage::app()->getFrontController()->getRequest()->getModuleName();
$controller = Mage::app()->getFrontController()->getRequest()->getControllerName();
$action = Mage::app()->getFrontController()->getRequest()->getActionName();
if ($frontname.$controller.$action == 'catalogproductview' && Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE == $product->getVisibility()) {
if ($product->getVisibilityInProductView() == self::VISIBILITY_IN_PRODUCT_VIEW_PAGE) {
return true;
} else {
return false;
}
} else {
return false;
}
}
}
else {
return false;
}
Here first it check whether product is enabled or not. If enabled, it will check whether product is visible or not. If product is not visible, then it will check whether not visible individually
is the real cause the previous condition. If that is yes, then we will check whether exception is provided for view page by inspecting the status of our custom attribute. If exception enabled, then it will show in product view page.
Hence problem solved