Add the following code to /category.php line #9 (below $rewrited_url = null;)
Код:
if ($category->id != 1 && is_object($cookie) &&
strpos($_SERVER['HTTP_USER_AGENT'],'bot') === false &&
strpos($_SERVER['HTTP_USER_AGENT'],'baidu') === false &&
strpos($_SERVER['HTTP_USER_AGENT'],'spider') === false &&
strpos($_SERVER['HTTP_USER_AGENT'],'Ask Jeeves') === false &&
strpos($_SERVER['HTTP_USER_AGENT'],'slurp') === false &&
strpos($_SERVER['HTTP_USER_AGENT'],'crawl') === false)
{
$category = new Category(intval(Tools::getValue('id_category')), intval($cookie->id_lang));
$nbProducts = $category->getProducts(NULL, NULL, NULL, $orderBy, $orderWay, true);
if ($nbProducts == 1)
{
$cat_products = $category->getProducts(intval($cookie->id_lang), 1, 1, $orderBy, $orderWay);
foreach ($cat_products AS $product)
{
Header( "Location: ".$product['link']);
exit;
}
}
}