Jump to content

Besoin de renseignement sur le helperForm type catagories


Recommended Posts

Bonjour,
 
Je suis en train d'ajouter un lien entre manufacturer et category dans mon presta (1.5.6.2) mais je ne parviens pas à utiliser correctement le helperForm de type categories pour afficher l'arbre des catégorie. Et impossible de trouver des infos en ligne ou dans la doc...
Voici ce que j'ai pour le moment :

<?php
$this->fields_form['input'][] = array(
	'type' => 'categories',
	'label' => $this->l('Category:'),
	'name' => 'checkBoxCatAsso',
	'values' => array(
		array(
			'id'=>4
		)
	)
);

Basique pour le moment.

Et les erreurs affichées :

Notice: Undefined index: trads in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 856Notice: Undefined index: trads in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 858Notice: Undefined index: use_radio in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 860 Notice: Undefined index: trads in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 861Notice: Undefined index: trads in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 863Notice: Undefined index: use_search in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 866

Notice: Undefined index: selected_cat in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 878

  • Notice: Undefined index: top_category in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 904 Notice: Trying to get property of non-object in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 904 Notice: Undefined index: trads in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 904  
    •  

Notice: Undefined index: use_radio in /home/www/site/cache/smarty/compile/5f/8a/f0/5f8af008fc0cb7e1972a24878e9cd8a5cafa0d8f.file.form.tpl.php on line 923

 

Quelqu'un aurai de al doc ou des exemple pour l'utilisation de ce helper?

 

Romain.

Edited by Lorem Ipsum (see edit history)
Link to comment
Share on other sites

Pour le moment je modifie directement le controller AdminManufacturers le temps de trouver la solution, ensuite je reporterai ça proprement dans un override.

En "rétrocodant" depuis le template du helper j'ai un peu avancé et voici ce que j'ai maintenant :

$this->fields_form['input'][] = array(
	'type' => 'categories',
	'label' => $this->l('Category:'),
	'name' => 'checkBoxCatAsso',
	'values' => array(
		'use_radio'=> false,
		'use_search'=> false,
                'top_category'=> 4,

'selected_cat'=> array( 'id_category'=>4 ), ) );

Mais j'ai toujours les erreurs pour les "trad", j'imagine bien que ce sont pour les traduction mais la structure est plus complexe qu'une simple variable. Ci dessous le tpl du helper, si ça peut vous aidez à m'aider.

<div class="category-filter">
		<span><a href="#" id="collapse_all">{$categories.trads['Collapse All']}</a>| </span>
	 	<span><a href="#" id="expand_all">{$categories.trads['Expand All']}</a>| </span>		 
		{if !$categories.use_radio}
		<span><a href="#" id="check_all">{$categories.trads['Check All']}</a>| </span>
		<span><a href="#" id="uncheck_all">{$categories.trads['Uncheck All']}</a>| </span>
		{/if}
		{if $categories.use_search}
			<span style="margin-left:20px">
				{$categories.trads.search}: 
				<form method="post" id="filternameForm">
					<input type="text" name="search_cat" id="search_cat"/>
				</form>
			</span>
		{/if}
	</div>
	{assign var=home_is_selected value=false}
	{foreach $categories.selected_cat AS $cat}
		{if is_array($cat)}
			{if $cat.id_category != $categories.trads.Root.id_category}
				<input {if in_array($cat.id_category, $categories.disabled_categories)}disabled="disabled"{/if} type="hidden" name="{$categories.input_name}" value="{$cat.id_category}"/>
			{else}
				{assign var=home_is_selected value=true}
			{/if}
		{else}
			{if $cat != $categories.trads.Root.id_category}
				<input {if in_array($cat, $categories.disabled_categories)}disabled="disabled"{/if} type="hidden" name="{$categories.input_name}" value="{$cat}"/>
			{else}
				{assign var=home_is_selected value=true}
			{/if}
		{/if}
	{/foreach}
	<ul id="categories-treeview" class="filetree">
		<li id="{$categories.trads.Root.id_category}" class="hasChildren">
			<span class="folder">
				{if $categories.top_category->id != $categories.trads.Root.id_category}
					<input type="{if !$categories.use_radio}checkbox{else}radio{/if}"
							name="{$categories.input_name}"
							value="{$categories.trads.Root.id_category}"
							{if $home_is_selected}checked="checked"{/if}
							onclick="clickOnCategoryBox($(this));"/>
						<span class="category_label">{$categories.trads.Root.name}</span>
				{else}
					 
				{/if}
			</span>
			<ul>
				<li><span class="placeholder"> </span></li>
		  	</ul>
		</li>
	</ul>
	{if $categories.use_radio}
	<script type="text/javascript">
		searchCategory();
	</script>
	{/if}

Romain.

Link to comment
Share on other sites

En fait que veux tu faire précisément ?

Depuis l'onglet fournisseurs tu souhaites choisir un fournisseur, afficher l'arbre des catégories au dessus ou en dessous des produits et pouvoir assigner lui assigner une catégorie. C'est ça ?

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