vanillafrog Posted September 23, 2012 Share Posted September 23, 2012 // Posted this in the general section, but then realized it was better suited here! Oops D: HELLO! I want to change the homefeatured module so that it doesn't show products from just "home" category, but "Accessories" category. I've looked around the forums and found out so far that we have to change this line in homefeatured.php, 1 bring the ID of the category: $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); to $products = $category->getProducts((int)Context::getContext()->language->id, 37, ($nb ? $nb : 10)); It's not working for me though. When I change it to 37, it states "no featured products", when I already have 2 products in Accessories. Am I missing something in 1.5? Thank you in advance!! 1 Link to comment Share on other sites More sharing options...
silberstern Posted November 12, 2012 Share Posted November 12, 2012 (edited) Try this: change $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); to $category = new Category(37, (int)Context::getContext()->language->id); Do not change this line: $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); Edited November 12, 2012 by silberstern (see edit history) 5 Link to comment Share on other sites More sharing options...
melriks Posted January 20, 2013 Share Posted January 20, 2013 Thanks for posting the answer. Works like a charm. Link to comment Share on other sites More sharing options...
miriama Posted July 3, 2013 Share Posted July 3, 2013 Hi, thanks for you solution, it works very good. But I have a problem: my shop is in italian and in english language, as I choose the italian language everything works good, as I select the english language there is no product in the homefeatured module, it is written "No featured products". Can somebody help me? Thanks. Regards Miriam Link to comment Share on other sites More sharing options...
vekia Posted July 3, 2013 Share Posted July 3, 2013 hello Miriam, i've noticed that you still have this issue Maybe try to reinstall this module? I mean, upload new module package to your store. Maybe this will help you Link to comment Share on other sites More sharing options...
miriama Posted July 3, 2013 Share Posted July 3, 2013 Hi Vekia, thanks a lot for your prompt replay. But if I reinstall the module, the file that I have edited will be overwritten from the original one. Infact I tried your suggestion and it work, but then as I edit the file again in order to see in the homefeatured module the products of another category I have the same problem. Any other ideas? Thank u again. Regards Miriam Link to comment Share on other sites More sharing options...
vekia Posted July 3, 2013 Share Posted July 3, 2013 Hello what you modified exactly? Maybe the issue is strictly related to the modification that you use? Link to comment Share on other sites More sharing options...
miriama Posted July 3, 2013 Share Posted July 3, 2013 Hi, yes I am sure that my issue is due to the modification I used. I have done the following modification in the file homefeatured.php: from $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); I change to $category = new Category(37, (int)Context::getContext()->language->id); Where 37 is the id of my categorie, it works, but not if I change language. 1 Link to comment Share on other sites More sharing options...
miriama Posted July 3, 2013 Share Posted July 3, 2013 Dear Vekia, I solved the problem, thanks. For other person who need to know how to change the homefeatured module so that it doesn't show products from just "home" category but from another category and they have a website multilanguage I explain the correct procedure: in the file homefeatured.php in modules/homefeatured chage the line $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)(Configuration::get('HOME_FEATURED_NBR')); $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); in $category = new Category(6, (int)Context::getContext()->shop->getCategory(), (int)Context::getContext()->id_lang); $nb = (int)(Configuration::get('HOME_FEATURED_NBR')); $products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 10)); where 6 is the id number of the category you choose. Hope this can be helpful for somebody else and thank you for your support. Regards Miriam Link to comment Share on other sites More sharing options...
vekia Posted July 3, 2013 Share Posted July 3, 2013 thanks for information and your solution! im really glad that it works for you exactly as you expect regards Link to comment Share on other sites More sharing options...
Allyt Posted July 31, 2013 Share Posted July 31, 2013 Hi there - This didn't seem to work for me - no big deal but I maybe have a 'variation on theme' I created a category "Featured Products" and when associating a product i tick 3 boxes. home, the real category & the featured products. My home screen shows the standard plugin home screen as usual but now I can offer a menu item in the category listing that is just showing the featured, so in other words a listing of what the home screen shows in it's own page. Hope that helps another head scratcher out there. Link to comment Share on other sites More sharing options...
vekia Posted July 31, 2013 Share Posted July 31, 2013 hello you said that the method mentioned above didn't work for you, just wondering why, can you say something more about that? you've got error? blank page? Link to comment Share on other sites More sharing options...
Smijn1 Posted November 10, 2013 Share Posted November 10, 2013 works like a charm! Thanks! Link to comment Share on other sites More sharing options...
pette Posted December 16, 2014 Share Posted December 16, 2014 Hi, I try in this but it doesn't work $category = new Category(Context::getContext()->shop->getCategory(), (int) Context::getContext()->language->id); $nb = (int) Configuration::get($this->name . '_qty_products'); $products = Product::getNewProducts((int) Context::getContext()->language->id, 0, ($nb ? $nb : 5)); 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