2017-08-19 2 views
0

Ich habe Prestashop 1.7.2.1 installiert und ich versuche, ein Modul für sie zu schreiben.mit Bootstrap-4 mit PrestaShop 1.7.2.1 Modul

Im Allgemeinen möchte ich Bootstrap nur testen (4?) Unterstützung.

habe ich einen Haken in meinem Modul für displayTop und Er lädt die folgende Smarty Template:

<div class="alert alert-primary" role="alert"> 
    This is a primary alert—check it out! 
</div> 

aber leider ist dies die richtige Bootstrap-CSS-Stil mein Modul hinzufügen.

dies ist der Konstruktor meines Modul:

class TuxInModCarType extends Module 
{ 
    function __construct() 
    { 
     $this->csvUtil = new CsvUtil(buildCsvArray()); 
     $this->ret = new RetObj(); 
     $this->name = 'tuxinmodcartype'; 
     $this->tab = 'quick_bulk_update'; 
     $this->version = '0.1'; 
     $this->author = 'Kfir Ozer'; 
     $this->bootstrap = true; 
     $this->need_instance = 0; 
     $this->ps_versions_compliancy = array('min' => '1.7', 'max' => _PS_VERSION_); 
     parent::__construct(); 

     $this->displayName = 'Tux-In Car Type'; 
     $this->description = 'With this module, you will be able to specify car types for products'; 
     $this->confirmUninstall = $this->l('Are you sure you want to uninstall'); 
     if (!Configuration::get('MYMODULE_NAME')) 
      $this->warning = $this->l('No name provided'); 
    } 

Ich googeln, die ich brauche $this->bootstrap=true; zu verwenden, aber eigentlich ModuleCore keine Bootstrap-Eigenschaft enthalten.

ich installieren mein Modul mit der folgenden Funktion:

öffentliche Funktion installieren() {

return (parent::install() && $this->loadSqlFile(__DIR__.DIRECTORY_SEPARATOR.'sql'. 
DIRECTORY_SEPARATOR.'install.sql') && 
     $this->registerHook('displayBackOfficeHeader') && 
$this->registerHook('displayAdminProductsExtra') && 
$this->registerHook('displayTop')); 

}

und die hookDisplayTop wie dem folgenden Code:

public function hookDisplayTop() { 
     $this->context->controller->addJquery(); 
     $this->context->controller->bootstrap=true; 
     $this->context->controller->addCSS($this->_path.'/css/displaytop.css'); 
     $this->context->controller->addJS($this->_path.'/js/displaytop.js'); 
     return $this->display(__FILE__,'/displayTop.tpl'); 
    } 

hier in $this->context->controller fand ich eine bootsrap Variable aber ändert auch nichts.

irgendwelche Ideen?

Antwort

1

Bootstrap 4 hat keine alert-primary Klasse mindestens aus dem Blick auf die documentation. Ich habe dein HTML-Snippet in die Prestashop-Demo-Seite eingefügt und bekomme kein Styling. Die Verwendung aller anderen alert-success, alert-info usw. zeigt jedoch alle das richtige Styling.