Rulian Posted July 17, 2015 Share Posted July 17, 2015 hi, I'd like to split the 'new products' block on my homepage into several smaller blocks, where the products are grouped by categories. Something like: New dresses:Pink dress Yellow dress New pants:Blue pant Brown pant 'dresses' and 'pants' being categories from the BO. The IDs of the categories I want to display are known and can be hardcoded somewhere (for the moment). I already duplicated the blocknewproducts module. In this module I call a newly created function from the Product.php file: getNewProductsByCategory($category,...), based on the getNewProducts(...) function. So far, everything's fine, but I'm stuck at the rendering part: In the hookdisplayHomeTabContent function, I coded a foreach loop, iterating on given categories IDs which: retrieve the products for the current category and assign them to $this->smarty (try to) display blocknewproducts_home.tpl <=== KO, because I don't know how to modify the current code below: return ($this->display(__FILE__, 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home'))); into several calls, 1 by category, ie. 1 by foreach iteration in my hookdisplayHomeTabContent function, Maybe, it's not the good way to do such a thing... Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
Rulian Posted July 17, 2015 Author Share Posted July 17, 2015 OK, actually $this->display(__FILE__, 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')) just return rendered HTML code. So I just added a $full_render variable and I just append the result of $this->display(...) for each iteration, then I return this variable. 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