Anyone can throw me a bone here as to what mod I need to make to what script so that if the product category only has one product, instead of showing the one thumbnail just skip to the one product's, product detail page.
Anyone can throw me a bone here as to what mod I need to make to what script so that if the product category only has one product, instead of showing the one thumbnail just skip to the one product's, product detail page.
Hi, please add:
#file
app/addons/my_changes/controllers/frontend/categories.post.php
/*
*/
use Tygh\Registry;
if (!defined(‘BOOTSTRAP’)) { die(‘Access denied’); }
if($mode == ‘view’){
$page = (!empty($_REQUEST['page']))?(int)$_REQUEST['page']:1;
if(empty($_REQUEST['features_hash']) && $page==1){
//CS-Cart 4.x
//$products = Registry::get('view')->getTemplateVars('products');
//CS-Cart 4.3.x
$products = Tygh::$app['view']->getTemplateVars('products');
if(count($products)==1){
reset($products);
$key = key($products);
return array(CONTROLLER_STATUS_REDIRECT, 'products.view?product_id=' . $products[$key]['product_id']);
}
}
}
Works for us.. Thanks for that share....