Jump to content

Problem creating prestashop module tutorial


Recommended Posts

Hello everyone, I'm new with prestashop and I'm trying to create a new module following the developers tutorial http://doc.prestashop.com/display/PS17/Creating+a+PrestaShop+1.7+Module practically the same as the prestashop 1.6 tutorial.

All is fine until this section  http://doc.prestashop.com/display/PS17/Displaying+content+on+the+front+office#Displayingcontentonthefrontoffice-Embeddingatemplateinthetheme where I can't make the "click me" link work.

I know there are more topics with similar questions but still doesn't works. Front office view and css works rigth but the link doesn't.

- This is my file structure

tree.jpg.5d5124ecb1487670426c6410e3bf7999.jpg

 

- Function hookDisplayLeftColumn in the main php file mimodulo.php

 

public function hookDisplayLeftColumn($params)
  {
    $this->context->smarty->assign(
        array(
            'my_module_name' => Configuration::get('MYMODULE_NAME'),
            'my_module_link' => $this->context->link->getModuleLink('mimodulo', 'display')
        )
    );
    return $this->display(__FILE__, 'mimodulo.tpl');
  }

 

- display.php

<?php
class mymoduledisplayModuleFrontController extends ModuleFrontController
{
  public function initContent()
  {
    parent::initContent();
    $this->setTemplate('module:mimodulo/views/templates/front/display.tpl');
  }
}

- mimodulo.tpl

<div id="mymodule_block_home" class="block">
  <h4>Welcome!</h4>
  <div class="block_content">
    <p>Hello,
       {if isset($my_module_name) && $my_module_name}
           {$my_module_name}
       {else}
           World
       {/if}
       !
    </p>
    <ul>
      <li><a href="{$my_module_link}" title="Click this link">Click me!</a></li>
    </ul>
  </div>
</div>

 

- display.tpl only contains a h4 tag

 

somebody could help me to see what I'm doing wrong? Thanks 

Link to comment
Share on other sites

Thanks for your reply tdsoft!

I forgot to say that I tested in prestashop versions 1.6 and 1.7

something else that does not seem to work is this line in the constructor method:

$this->tab = 'front_office_features';

the module appears in the "others modules" tab.

Here is the module zip file

mimodulo.zip

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