Jump to content

Problème mise à jour module de version 1.3 vers 1.6.*


Recommended Posts

Bonjour,

 

Je suis un novice dans le développement de module Prestashop. Stagiaire du pôle formation de la CCI de Colmar dans une entreprise de vente de produits cosmétiques et pièces pour le monde de la compétition Moto, je suis confronté à plusieurs petits soucis.

 

1, la mise à jour vers Bootstrap avec la réécriture du _displayForm() vers _renderForm().

 

En 2. un souci avec les clés de sécurités.

 

En 3. le module semble s'intaller correctement, le hic lors de la configuration, Prestashop me retourne une erreur Module introuvable.

 

Aurriez-vous une idée ?

 

En vous remerciant.

 

Le code 

//le _displayForm() à transformer en _renderform()
	private function _displayForm(){
		
		global $cookie;
		
		/* Languages preliminaries */
		$defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
		$languages = Language::getLanguages();
		$iso = Language::getIsoById($defaultLanguage);

		/* xml loading */
		$this->_html .= '<br />
		<form method="post" action="'.$_SERVER['REQUEST_URI'].'" enctype="multipart/form-data">
			<fieldset style="width: 900px;">
				<legend><img src="'.$this->_path.'logo.gif" alt="" title="" /> '.$this->displayName.'</legend>
				<label>'.$this->l('Fichier CSV').' </label>
				<div class="margin-form">
					<input type="file" name="csv_file" />
					<p style="clear: both">'.$this->l('Colonnes : Référence_fabricant | Quantité | Prix HT | Publier sur le site').'</p>
				</div>
				<div class="clear pspace"></div>
				<div class="margin-form clear"><input type="submit" name="submitUpdate" value="'.$this->l('Envoyer le fichier').'" class="button" /></div>
			</fieldset>
		</form>';
	}
	
	public function renderForm()
	{
		$fields_form = array(
			'form' => array(
				'legend' => array(
					'title' => $this->l('Settings'),
					'icon' => 'icon-cogs'
				),
				'input' => array(
					array(
						'type' => 'switch',
						'label' => $this->l('Display products\' supplier_reference'),
						'desc' => $this->l('Show the update supplier_reference of the products displayed in the block.'),
						'name' => 'PRODUCTSCATEGORY_DISPLAY_SUPPLIER_REFERENCE',
						'values' => array(
							array(
								'id' => 'active_on',
								'value' => 1,
								'label' => $this->l('Enabled')
							),
							array(
								'id' => 'active_off',
								'value' => 0,
								'label' => $this->l('Disabled')
							)
						),
					),
				),
				'submit' => array(
					'title' => $this->l('Save'),
				)
			),
		);

		$helper = new HelperForm();
		$helper->show_toolbar = false;
		$helper->table = $this->table;
		$lang = new Language((int)Configuration::get('PS_LANG_DEFAULT'));
		$helper->default_form_language = $lang->id;
		$helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get(
			'PS_BO_ALLOW_EMPLOYEE_FORM_LANG'
		) : 0;
		$helper->identifier = $this->identifier;
		$helper->submit_action = 'submitCross';
		$helper->currentIndex = $this->context->link->getAdminLink(
				'AdminModules',
				false
			).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;
		$helper->token = Tools::getAdminTokenLite('AdminModules');
		$helper->tpl_vars = array(
			'fields_value' => $this->getConfigFieldsValues(),
			'languages' => $this->context->controller->getLanguages(),
			'id_language' => $this->context->language->id
		);

		return $helper->generateForm(array($fields_form));
	}
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...