Jump to content

How to create module to manage footer in prestashop 1.6?


Recommended Posts

Hi vekia,
 
i have worked on the code which is mentioned in the URL
http://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

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

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

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

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...