Jump to content

[SOLVED] Get products with reduced price instead of home featured


bloggus

Recommended Posts

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

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

sure!

first, now i have a Featured Product ( homefeature module ), and i want a Onsale Products with the same style on Home page.

onsale.jpg

 

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 :P

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

  • 8 years later...
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.

onsale.jpg

 

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 by Flaviotti (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...