Jump to content

Own Module And Pb With Menu


dandrimontp

Recommended Posts

Hello All,
 
I'm a beginner in prestashop modules development. 
I created my own module but I've a problem.
 
As you can see in the pictures, my module is on the left hook (in red) and the Menu "Robe" can down (in green).
 
When I click on my link, a new page appears (in red) but the menu "Robe" don't want down (in green).
 
Does somebody can help me ?
 
 
I've 3 files :
2 for the module (php and TPL) and 1 (php) for display ma page.
 
here the files :
codedefaut.php :
<?php
if (!defined('_PS_VERSION_'))
exit;
class codedefaut extends Module
  {
  public function __construct()
    {
    $this->name = 'codedefaut';
    $this->tab = 'Code defaut clim';
    $this->version = 1.0;
    $this->author = 'patrice dandrimont';
    $this->need_instance = 0;
    parent::__construct();
    $this->displayName = $this->l('CLIM - Code defaut');
    $this->description = $this->l('Module permettant de savoir quelle est l\'anomalie de la clim selon le code défaut affiché.');
    $this->confirmUninstall = $this->l('Etes-vous certain de vouloir supprimer le module "CLIM - Code défaut" ?');
    }
public function install()
  {
  if (parent::install() == false OR !$this->registerHook('leftColumn'))
    return false;
  return true;
  }
public function uninstall()
  {
  if (!parent::uninstall())
    Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'codedefaut`');
  parent::uninstall();
  }
  
public function hookDisplayLeftColumn() 
{
$this->context->smarty->assign(array( 'placement'=>'left', ));
return $this->display(__FILE__, 'codedefaut.tpl'); 
}
/*
  public function hookLeftColumn($params)
  {
  global $smarty;
  return $this->display(__FILE__, 'codedefaut.tpl');
  }
*/
public function hookRightColumn($params)
  {
  return $this->hookLeftColumn($params);
  }
  
}
?>
 
 
codedefaut.tpl
<!-- Block codedefaut -->
<div id="codedefaut_block_left" class="block">
  <h4>Code défaut!</h4>
  <div class="block_content">
    <ul>
    Votre clim est en panne et vous ne savez pas ce qu'il convient de faire ?
      <li><a href="{$base_dir}modules/codedefaut/codedefaut_page.php" title="Cliquez ici">Cliquez ici</a></li>
    </ul>
  </div>
</div>
<!-- /Block codedefaut -->
 
codedefaut_page.php
 
<?php
global $smarty;
/* on affiche la tete du site */
include('../../config/config.inc.php');
include('../../header.php');
$marque_selectionnee = Tools::getValue("zmarque"); 
echo "</BR></BR></BR></BR></BR>";
if (empty($marque_selectionnee))
$sql = "SELECT distinct(Marque) FROM Z_spare";
$result = Db::getInstance()->ExecuteS($sql);
echo "<form name='zform' action='' method='post'>";
echo "<SELECT NAME='zmarque' ONCHANGE='this.form.submit()'>"; /* on renvoie la page */
echo "<option selected disabled>Choisir une marque</option>";
foreach ($result as $f)
echo "<option value=$f[Marque]>$f[Marque]</option>";
echo "</select>";
 
echo" <SELECT NAME='zespace'>";
echo "</select>";
 
echo "</form>";
}
echo "</BR></BR></BR></BR></BR>";
echo "</BR></BR></BR></BR></BR>";
include( '../../footer.php' );
?>
REGARDS.

 

post-1185438-0-73851500-1457211938_thumb.png

post-1185438-0-82375400-1457212019_thumb.png

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