IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

EDI, CMS, Outils, Scripts et API PHP Discussion :

[PRESTASHOP 1.5] Création module


Sujet :

EDI, CMS, Outils, Scripts et API PHP

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    Avril 2015
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Aube (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2015
    Messages : 4
    Par défaut [PRESTASHOP 1.5] Création module
    Bonjour a tous, je début sur prestashop

    Alors j'ai créer un module et j'ai réussi a l'installer.

    J'ai une page de configuration dans le module , où je souhaite avoir un bouton radio qui me permettras d'activer ou non l'affichage des commandes ( dans la page des commandes) et un autre qui permettras d'afficher ou non deux colonnes du tableau commandes.

    J'ai réussi a afficher un bouton radio mais je ne vois pas comment faire pour activer ou non l'affichage

    Je vous remercie d'avance pour votre aide.


    Pour le moment voici mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    <?php
    if (!defined('_PS_VERSION_'))
        exit;
     
    class MyModule extends Module
    {
        public function __construct()
        {
            $this->name = 'mymodule';
            $this->tab = 'administration';
            $this->version = '1.0.0';
            $this->author = 'rob ';
            $this->need_instance = 0;
            $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_);
            $this->bootstrap = true;
     
            parent::__construct();
     
            $this->displayName = $this->l('My module');
            $this->description = $this->l('Gestion de commande');
     
            $this->confirmUninstall = $this->l('Are you sure you want to uninstall?');
     
            if (!Configuration::get('MYMODULE_NAME'))
                $this->warning = $this->l('No name provided');
        }
        public function install()
        {
            if (Shop::isFeatureActive())
                Shop::setContext(Shop::CONTEXT_ALL);
     
            if (!parent::install() ||
                !$this->registerHook('leftColumn') ||
                !$this->registerHook('header') ||
                !Configuration::updateValue('MYMODULE_NAME', 'my friend')
            )
                return false;
     
            return true;
        }
     
        public function uninstall()
        {
            if (!parent::uninstall())
                return false;
            return true;
        }
     
        public function getContent()
        {
            $output = null;
     
            if (Tools::isSubmit('submit'.$this->name))
            {
                $my_module_name = strval(Tools::getValue('MYMODULE_NAME'));
                if (!$my_module_name
                    || empty($my_module_name)
                    || !Validate::isGenericName($my_module_name))
                    $output .= $this->displayError($this->l('Invalid Configuration value'));
                else
                {
                    Configuration::updateValue('MYMODULE_NAME', $my_module_name);
                    $output .= $this->displayConfirmation($this->l('Settings updated'));
                }
            }
            return $output.$this->displayForm();
        }
     
     
        public function displayForm()
        {
            // Get default Language
            $default_lang = (int)Configuration::get('PS_LANG_DEFAULT');
     
            // Init Fields form array
            $fields_form[0]['form'] = array(
                'legend' => array(
                    'title' => $this->l('Settings'),
                ),
                'input' => array(
                    array(
      'type'      => 'radio',                               // This is an <input type="checkbox"> tag.
      'label'     => $this->l('Activer affichage'),         // A help text, displayed right next to the <input> tag.
      'name'      => 'active',                              // The content of the 'id' attribute of the <input> tag.
      'required'  => true,                                  // If set to true, this option must be set.
      'class'     => 't',                                   // The content of the 'class' attribute of the <label> tag for the <input> tag.
      'is_bool'   => true,                                  // If set to true, this means you want to display a yes/no or true/false option.
                                                            // The CSS styling will therefore use green mark for the option value '1', and a red mark for value '2'.
                                                            // If set to false, this means there can be more than two radio buttons,
                                                            // and the option label text will be displayed instead of marks.
      'values'    => array(                                 // $values contains the data itself.
        array(
          'id'    => 'active_on',                           // The content of the 'id' attribute of the <input> tag, and of the 'for' attribute for the <label> tag.
          'value' => 1,                                     // The content of the 'value' attribute of the <input> tag.  
          'label' => $this->l('Enabled')                    // The <label> for this radio button.
        ),
        array(
          'id'    => 'active_off',
          'value' => 0,
          'label' => $this->l('Disabled')
        )
      ),
    ),
                ),
                'submit' => array(
                    'title' => $this->l('Save'),
                    'class' => 'button'
                )
            );
     
            $helper = new HelperForm();
     
            // Module, token and currentIndex
            $helper->module = $this;
            $helper->name_controller = $this->name;
            $helper->token = Tools::getAdminTokenLite('AdminModules');
            $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name;
     
            // Language
            $helper->default_form_language = $default_lang;
            $helper->allow_employee_form_lang = $default_lang;
     
            // Title and toolbar
            $helper->title = $this->displayName;
            $helper->show_toolbar = true;        // false -> remove toolbar
            $helper->toolbar_scroll = true;      // yes - > Toolbar is always visible on the top of the screen.
            $helper->submit_action = 'submit'.$this->name;
            $helper->toolbar_btn = array(
                'save' =>
                    array(
                        'desc' => $this->l('Save'),
                        'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name.
                            '&token='.Tools::getAdminTokenLite('AdminModules'),
                    ),
                'back' => array(
                    'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'),
                    'desc' => $this->l('Back to list')
                )
            );
     
            // Load current value
            $helper->fields_value['MYMODULE_NAME'] = Configuration::get('MYMODULE_NAME');
     
            return $helper->generateForm($fields_form);
        }
     
    }

  2. #2
    Nouveau membre du Club
    Homme Profil pro
    Développeur Web
    Inscrit en
    Avril 2015
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Aube (Champagne Ardenne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Avril 2015
    Messages : 4
    Par défaut
    up svp

  3. #3
    Membre actif
    Homme Profil pro
    Développeur Web
    Inscrit en
    Avril 2012
    Messages
    133
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2012
    Messages : 133
    Par défaut
    Salut,

    Tu as une page d'aide très bien faites sur la doc de prestashop qui va t'accompagner sur cette question (en plus c'est en français) :

    http://doc.prestashop.com/pages/view...econfiguration

    ++

Discussions similaires

  1. [PrestaShop] Création module
    Par bygleader dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 0
    Dernier message: 10/01/2019, 14h07
  2. [PrestaShop] création module prestashop
    Par issadev dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 0
    Dernier message: 15/08/2012, 03h13
  3. [Forum] Création module d'importation
    Par chnimois dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 1
    Dernier message: 21/05/2008, 09h59
  4. pb création module de classes
    Par lbailler dans le forum Access
    Réponses: 2
    Dernier message: 17/08/2006, 14h07
  5. [Oracle9i]Problème création module d'écoute
    Par Gidrah dans le forum Oracle
    Réponses: 2
    Dernier message: 25/04/2006, 19h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo