Dear Vekia I see you often help people here and I need your help becuse no one reponded to me in the forum. I need to hide certen category to show in new product block, is this possible? PS I am also you customer i mypresta website. thank you so much
Hide products from defined categories in "new products"
#2
Posted 01 December 2017 - 12:24 AM
Hello
By default it is not possible, it requires modification of prestashop core - Product.php class.
there is a function:
/**
* Get new products
*
* @param int $id_lang Language id
* @param int $pageNumber Start from (optional)
* @param int $nbProducts Number of products to return (optional)
* @return array New products
*/
public static function getNewProducts($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, Context $context = null)
{
inside of this function you can find a code:
if (Group::isFeatureActive()) {
$groups = FrontController::getCurrentCustomerGroups();
$sql->where('EXISTS(SELECT 1 FROM `'._DB_PREFIX_.'category_product` cp
JOIN `'._DB_PREFIX_.'category_group` cg ON (cp.id_category = cg.id_category AND cg.`id_group` '.(count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1').')
WHERE cp.`id_product` = p.`id_product`)');
}
right after this code please paste this one line:
$sql->where('p.id_category_default NOT in (2,3,4)');
Where the 2,3,4 is a categories ID numbers that you want to exclude from "new products".
This code will not show products with default category ID: 2,3,4 (just replace ID with own category id you want to hide)
free tutorials, free templates, free addons, prestashop modules
#5
Posted 30 May 2025 - 05:30 AM
Tailor-made themes crafted to reflect your brand’s identity and deliver a unique user experience. Custom designs ensure alignment with Shopify Plus’s advanced functionalities and your specific business needs.
#6
Posted 14 June 2025 - 06:35 AM
With years of experience building on-demand grocery delivery apps, we’re committed to delivering feature-packed solutions tailored to your needs. As a leading on demand grocery delivery app development company, we offer the perfect blend of essential and advanced features to help you succeed in a market.










