saracoratello Posted December 29, 2011 Share Posted December 29, 2011 Hi there, I want change prestashop new products module hook function to show products from only one category. Does anyone have idea how can i do this ? I know how to do this by tpl and {$newproduct.category} var, but i find this method as "volatile". Here are default hook function from blocknewproducts.php : public function hookHome($params) { global $smarty; $newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR'))); if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) return; $smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium'))); return $this->display(__FILE__, 'blocknewproducts.tpl'); } Thanks! Link to comment Share on other sites More sharing options...
bellini13 Posted December 29, 2011 Share Posted December 29, 2011 the class Product is what is performing the query to retrieve the new products, inside Product is a function called getNewProducts, so you have 2 options. 1) You can override the Product class, and revise the getNewProducts to only return products from a specific category. 2) You can modify the blocknewproducts.php hookHome function so that after you retrieve the products and store them in $newProducts array, you could iterate through that array and remove the products that are not in the target category. Link to comment Share on other sites More sharing options...
saracoratello Posted December 29, 2011 Author Share Posted December 29, 2011 Yes! Im about 2nd method. But unfortunatelly i have no idea how could i do this - im not so into .php - i was trying do this on my own - but all i get is one big error. Link to comment Share on other sites More sharing options...
bellini13 Posted December 29, 2011 Share Posted December 29, 2011 if you would like me to do it for you, I can, but I do charge for my services. if you would like, send me a PM with the category id you want to filter out and I will make the changes using option 2. just go to this URL, select the "Prestashop Module Installation" option. once paid i will perform the update. http://www.bellini-services.com/shop/software-solutions/19-prestashop-upgrade.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now