Chetanilead Posted May 31, 2014 Share Posted May 31, 2014 Hello All, Can anyone help me out to create a basic module in which we can get values from admin section and display it on footer section? Thanks in advance. I am a beginner in prestashop. Please help me Link to comment Share on other sites More sharing options...
vekia Posted May 31, 2014 Share Posted May 31, 2014 check this: http://doc.prestashop.com/display/PS15/Creating+a+PrestaShop+module Link to comment Share on other sites More sharing options...
Chetanilead Posted June 2, 2014 Author Share Posted June 2, 2014 Thanks alot vekia. i will start creating module with the process mentioned in this link. Link to comment Share on other sites More sharing options...
Chetanilead Posted June 2, 2014 Author Share Posted June 2, 2014 Hi vekia, i have worked on the code which is mentioned in the URLhttp://doc.prestasho...estaShop module But in my case " Embedding a template in a theme " is not working. ii.e it doesn't call display.php? I have done this code so far and it is not displaying the content of display.php or not even the controller class DisplayProduct extends Module { public function __construct() { $this->name = 'displayproduct'; $this->tab = 'front_office_features'; $this->version = '1.0'; $this->author = 'Ilead Synapse'; $this->need_instance = 0; $this->ps_versions_compliancy = array('min' => '1.4', 'max' => '2.6'); parent::__construct(); $this->displayName = $this->l('Display Product'); $this->description = $this->l('Used to display product on front end.'); $this->confirmUninstall = $this->l('Are you sure you want to uninstall?'); if (!Configuration::get('MYMODULE_NAME')) $this->warning = $this->l('No name provided'); } /* Function when this module is installed in prestashop*/ public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); return parent::install() && $this->registerHook('leftColumn') && $this->registerHook('header') && Configuration::updateValue('MYMODULE_NAME', 'displayproduct'); } /* Function when this module is uninstalled in prestashop*/ public function uninstall() { return parent::uninstall() && Configuration::deleteByName('MYMODULE_NAME'); } public function hookDisplayLeftColumn($params) { $this->context->smarty->assign( array( 'my_module_name' => Configuration::get('MYMODULE_NAME'), 'my_module_link' => $this->context->link->getModuleLink('displayproduct', 'display') ) ); return $this->display(__FILE__, 'displayproduct.tpl'); } public function hookDisplayHeader() { $this->context->controller->addCSS($this->_path.'css/displayproduct.css', 'all'); } } Link to comment Share on other sites More sharing options...
vekia Posted June 2, 2014 Share Posted June 2, 2014 But in my case " Embedding a template in a theme " is not working. ii.e it doesn't call display.php? your tpl file is displayproduct.tpl Link to comment Share on other sites More sharing options...
Chetanilead Posted June 2, 2014 Author Share Posted June 2, 2014 Thanks Now I understand a bit of it. Thank you so much. I also have one more query that How can I add the module which I had created above as a CMS page content. and Is there any code by which we can also create that CMS page programatically. I am a newbie in prestashop that's why I have various sort of doubts. Hope you understand my problems. Thanks in advance. Link to comment Share on other sites More sharing options...
vekia Posted June 2, 2014 Share Posted June 2, 2014 i don't understand you want to display module contents on selected cms page, or what? Link to comment Share on other sites More sharing options...
Chetanilead Posted June 3, 2014 Author Share Posted June 3, 2014 (edited) Sorry for my mistake. Yes, I want to display module contents on a selected CMS Page. Is it possible for me to create a CMS page programmatically and show my module content in that page? One more thing I have mentioned my code in above posts and it is also not adding the CSS file on page : public function hookDisplayHeader() { $this->context->controller->addCSS($this->_path.'css/displayproduct.css', 'all'); } Edited June 3, 2014 by Chetanilead (see edit history) Link to comment Share on other sites More sharing options...
Chetanilead Posted June 3, 2014 Author Share Posted June 3, 2014 Sorry for my mistake. Yes, I want to display module contents on a selected CMS Page. Is it possible for me to create a CMS page programmatically and show my module content in that page? One more thing I have mentioned my code in above posts and it is also not adding the CSS file on page : public function hookDisplayHeader() { $this->context->controller->addCSS($this->_path.'css/displayproduct.css', 'all'); } 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