stnadmin Posted May 7, 2013 Share Posted May 7, 2013 My first post here guys so take it easy on me I'm trying to figure out how to add content to the homepage. I was thinking there would/should be a module for this that would pull in a CMS article but I'm not seeing one. Thanks, Don Link to comment Share on other sites More sharing options...
vekia Posted May 7, 2013 Share Posted May 7, 2013 hello you can modify one of the modules attached to the homepage, for example homefeatured module. I can show you how you can easily do this but i must know what prestashop version you use Link to comment Share on other sites More sharing options...
stnadmin Posted May 8, 2013 Author Share Posted May 8, 2013 I'm using PrestaShop™ 1.5.4.1 THANKS! Link to comment Share on other sites More sharing options...
vekia Posted May 8, 2013 Share Posted May 8, 2013 I'm using PrestaShop™ 1.5.4.1 THANKS! thanx, so here is a code: this is modified hookDisplayHome function in the homefeatured.php file located in modules / homefatured / directory public function hookDisplayHome($params) { $this->cms = new CMS(3, $this->context->language->id); $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)); $this->smarty->assign(array( 'cms' => $this->cms, 'products' => $products, 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), )); return $this->display(__FILE__, 'homefeatured.tpl'); } i added there: $this->cms = new CMS(3, $this->context->language->id); where "3" is a ID of cms page you want to show; also I added to the array() this variable: 'cms' => $this->cms, now go to the homefatured.tpl file and use the: {$cms->content} the effect: Link to comment Share on other sites More sharing options...
stnadmin Posted May 8, 2013 Author Share Posted May 8, 2013 Thanks vekia! I'm going to actually attempt to create a module that does this and uses the hookDisplayHome. It seems like it would be best to do that rather than hook into an existing module. Because if I'm right, won't my work get lost when I update my install of Prestashop and that module is part of the update? Link to comment Share on other sites More sharing options...
vekia Posted May 8, 2013 Share Posted May 8, 2013 Thanks vekia! I'm going to actually attempt to create a module that does this and uses the hookDisplayHome. It seems like it would be best to do that rather than hook into an existing module. Because if I'm right, won't my work get lost when I update my install of Prestashop and that module is part of the update? You've got right, its better to create separate module. It will works always, even after updates :-) Link to comment Share on other sites More sharing options...
stnadmin Posted May 9, 2013 Author Share Posted May 9, 2013 (edited) WooHoo! I did it! Thanks Vekia for showing me the way. So how do I share this new module? Edited May 9, 2013 by stnadmin (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2013 Share Posted May 9, 2013 WooHoo! I did it! Thanks Vekia for showing me the way. So how do I share this new module? create new thread in correct forum subsection (free modules), thats all :-) I marked this thread as solved regards 1 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