bloggus Posted November 22, 2011 Share Posted November 22, 2011 Would like to change the home featured to show only products with reduced price OR products on sale. Is that possible to alter the fuction call of $category->getProducts ....... in any way? 1 Link to comment Share on other sites More sharing options...
Loc Nguyen Posted November 22, 2011 Share Posted November 22, 2011 yeah, i have the same problem. now i would like to add 1 more block like Featured Products, but get on sale products, i think that i should make new module ( copy from feature product home page module) then change the code that load the list from on sale product instead of featured products? or did we have any module like that? sorry for my bad english. thanks Link to comment Share on other sites More sharing options...
bloggus Posted November 22, 2011 Author Share Posted November 22, 2011 Ok, to answer myself on one of these .... ... for reduced price products I can use Product::getPricesDrop((int)($params['cookie']->id_lang)); Yes, Loc, I to made a copy of homefeatured with some changes to get a block with reduced price items. Link to comment Share on other sites More sharing options...
Loc Nguyen Posted November 23, 2011 Share Posted November 23, 2011 thanks, i mean that i just want to get the ON SALE products. have u ever get ON SALE products like FEATURED PRODUCTS on HOme page. thanks, Link to comment Share on other sites More sharing options...
Loc Nguyen Posted November 23, 2011 Share Posted November 23, 2011 ok, now i got it, with some change of code and querry. thanks Link to comment Share on other sites More sharing options...
bloggus Posted November 23, 2011 Author Share Posted November 23, 2011 No I don't list SALEs products, it is enough with the one that have price reduction. So you had to change whole query? There was no function you could use? Want to share it with us? Link to comment Share on other sites More sharing options...
Loc Nguyen Posted November 24, 2011 Share Posted November 24, 2011 sure! first, now i have a Featured Product ( homefeature module ), and i want a Onsale Products with the same style on Home page. and this is some stupid steps that i had done ^^ : 1/ i make a new function in Product.php . static public function getNewProducts1 {} (copied from function getNewProducts ) . change the query in new function getnewproducts1 WHERE `active` = 1 AND p.`on_sale` = true => and now you have a function to get all of Onsave product 2/ i duplicate the module homefeature -> homeonsale change name for install module : homeonsale 3/ change the function hook Home on homesale.php function hookHome($params) { global $smarty; $nbProducts = intval(Product::getNewProducts1(intval($cookie->id_lang), isset($p) ? intval($p) - 1 : NULL, isset($n) ? intval($n) : NULL, true)); $smarty->assign(array( 'products' => Product::getNewProducts1(intval($params['cookie']->id_lang), 0, 10, false, $orderBy, $orderWay), 'nbProducts' => intval($nbProducts))); return $this->display(__FILE__, 'homeonsale.tpl'); } please take a look and give me your opinion. thanks Link to comment Share on other sites More sharing options...
bloggus Posted November 25, 2011 Author Share Posted November 25, 2011 Thanks. WIll keep in in mind, although I'm trying to make modules without changing the core files. But good job otherwise! Link to comment Share on other sites More sharing options...
Flaviotti Posted January 4, 2020 Share Posted January 4, 2020 (edited) On 11/24/2011 at 5:17 AM, Loc Nguyen said: sure! first, now i have a Featured Product ( homefeature module ), and i want a Onsale Products with the same style on Home page. and this is some stupid steps that i had done ^^ : 1/ i make a new function in Product.php I would like to try the same. Which product.php file are you referring to? In my installation there are a few, placed in different folders. In class/product.php, the function getNewProducts contains several lines of code. If that is the right file, is not clear to me where to make the changes in the query you have written. Edited January 4, 2020 by Flaviotti (see edit history) 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