Bonjour ,
j'ai un souci avec ce fichier qui n'affiche pas le résultat de la fonction :_constructTreeNode

merci en avance voir 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
148
149
150
151
152
153
<?php
 
$id = Tools::getValue('id');
$action = Tools::getValue('action');
 
// suppression du block
if(!empty($id) && $action=='del'){
    Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'discount
                                WHERE `id_discount`="'.$id.'"');
    Form::msgConfirm($this->l('Block supprimé'),array('module'=>'codepromoauto','form'=>'default'));
}
 
function _constructTreeNode($node)
	{	
	    $ret = '	<tr>
						<td><input type="checkbox" name="categoryBox[]" class="noborder" value="'.$node['id'].'"/> &nbsp;</td>
						<td>'.$node['id'].'</td>
						<td><label for="groupBox_'.$node['id'].'" class="t">'.$node['name'].'</label></td>';
	    if(!empty($node['children']))
	    {
	    	$ret .= '	<tr>';	    	
	        foreach ($node['children'] AS $child)
	            $ret .= constructTreeNode($child);
	        $ret .= '	</tr>';
	    }
	    $ret .= '	</tr>';
	    return $ret;
	}
 
$this->_html.= Html::linkBo($this->l('Accédez Ã* la configuration'),array('module'=>'codepromoauto','form'=>'configuration'),array('img'=>'config.png')).'<br/><br/>';
$this->_html.= Html::linkBo($this->l('Nouveau bloc'),array('module'=>'codepromoauto','form'=>'codepromoauto'),array('img'=>'add.png')).'<br/><br/>';
 
$blocks = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'discount_type_lang WHERE `id_lang`="'.$cookie->id_lang.'"');
$this->_html.=
'<fieldset>
			<legend>'.$this->l('Options imported voucher').'</legend>	

			<label>'.$this->l('Type:').' &nbsp;</label>
			<div class="margin-form">
			<select name="id_discount_type" id="id_discount_type" onchange="free_shipping()">
				<option value="0">'.$this->l('-- Choose --').'</option>';
				$discountTypes = Discount::getDiscountTypes(intval($cookie->id_lang));
				foreach ($discountTypes AS $discountType)
				$this->_html .= '<option value="'.intval($discountType['id_discount_type']).'">'.$discountType['name'].'</option>';
 
			$this->_html .= '</select> <sup>*</sup>
			</div>
			
			<div id="value-div" style="display:none">
				<label>'.$this->l('Value:&nbsp;').'</label>
				<div class="margin-form">
					<input style="float:left;width:80px" type="text" name="value" id="discount_value" onKeyUp="javascript:this.value = this.value.replace(/,/g, \'.\');" />
					<select id="id_currency" name="id_currency" style="float:left;margin-left:10px;width:50px;display:none">
						<option value="0">--</option>';
						foreach (Currency::getCurrencies() as $row)
							$this->_html .='<option value="'.(int)$row['id_currency'].'">'.$row['sign'].'</option>';
					$this->_html .= '</select>
					<span id="percent-span" style="margin-left:10px;display:none;float:left;font-size:12px;font-weight:bold;color:black"> %</span>
					<sup style="float:left;margin-left:5px">*</sup>
					<p class="clear">'.$this->l('Either the monetary amount or the %, depending on Type selected above').'</p>
				</div>	
				<div class="clear">&nbsp;</div>			
			</div>
			
			
			
			<label>'.$this->l('Description:').' &nbsp;</label>
				';
					foreach ($this->_languages as $language)
						$this->_html .= '<div id="description_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
											<input size="33" type="text" name="description_'.$language['id_lang'].'" /><sup> *</sup>
											<span class="hint" name="help_box">'.$this->l('Invalid characters:').' <>;=#{}<span class="hint-pointer">&nbsp;</span></span>
											
										</div>';							
		$this->_html .= $this->displayFlags($this->_languages, $this->_defaultFormLanguage, 'description', 'description', true);
		$this->_html .= '<br/><div class="clear" / >
			<br/>
			
			<label>'.$this->l('Categories:').' &nbsp;</label>';
				$ulTree = '<table cellspacing="0" cellpadding="0" class="table" style="width: 29.5em;">
								<tr>
									<th>'.$this->l('Choose').'</th>
									<th>'.$this->l('ID').'</th>
									<th>'.$this->l('Categories').'</th>
								</tr>';
								foreach ($categTree['children'] AS $child)
								    $ulTree .= $this->_constructTreeNode($child);				    
				$ulTree .= '</table>'."\n";
 
				$this->_html .= $ulTree;
				$this->_html .= '<div class="clear" / >
			
			<br/>
			<p>
			<label>'.$this->l('Total quantity:').' </label>
				<div class="margin-form">
					<input type="text" size="15" name="quantity" /> <sup>*</sup>
					<p class="clear">'.$this->l('Total quantity available (mainly for vouchers open to everyone)').'</p>
				</div>
				<label>'.$this->l('Qty per each user:').' </label>
				<div class="margin-form">
					<input type="text" size="15" name="quantity_per_user" /> <sup>*</sup>
					<p class="clear">'.$this->l('Number of times a single customer can use this voucher').'</p>
				</div>
				<label>'.$this->l('Minimum amount').'</label>
				<div class="margin-form">
					<input type="text" size="15" name="minimal" onkeyup="javascript:this.value = this.value.replace(/,/g, \'.\'); " /> <sup>*</sup>
					<p class="clear">'.$this->l('Leave blank or 0 if not applicable').'</p>
				</div>
				<div class="margin-form">
					<p>
						<input type="checkbox" name="cumulable" id="cumulable_on" value="1" />
						<label class="t" for="cumulable_on"> '.$this->l('Cumulative with other vouchers').'</label>
					</p>
				</div>
				<div class="margin-form">
					<p>
						<input type="checkbox" name="cumulable_reduction" id="cumulable_reduction_on" value="1" />
						<label class="t" for="cumulable_reduction_on"> '.$this->l('Cumulative with price reductions').'</label>
					</p>
				</div>';
				includeDatepicker(array('date_from', 'date_to'), true);
				$this->_html .= '<label>'.$this->l('From:').' </label>
				<div class="margin-form">
					<input type="text" size="20" id="date_from" name="date_from" /> <sup>*</sup>
					<p class="clear">'.$this->l('Start date/time from which voucher can be used').'<br />'.$this->l('Format: YYYY-MM-DD HH:MM:SS').'</p>
				</div>
				<label>'.$this->l('To:').' </label>
				<div class="margin-form">
					<input type="text" size="20" id="date_to" name="date_to" /> <sup>*</sup>
					<p class="clear">'.$this->l('End date/time at which voucher is no longer valid').'<br />'.$this->l('Format: YYYY-MM-DD HH:MM:SS').'</p>
				</div>
				<label>'.$this->l('Status:').' </label>
				<div class="margin-form">
					<input type="radio" name="active" id="active_on" value="1"/>
					<label class="t" for="active_on"> <img src="../img/admin/enabled.gif" alt="'.$this->l('Enabled').'" title="'.$this->l('Enabled').'" /></label>
					<input type="radio" name="active" id="active_off" />
					<label class="t" for="active_off"> <img src="../img/admin/disabled.gif" alt="'.$this->l('Disabled').'" title="'.$this->l('Disabled').'" /></label>
					<p>'.$this->l('Enable or disable voucher').'</p>
				</div>
						
			<br/><br/>
				
				<label>'.$this->l('File add &nbsp;').'&nbsp; </label>
				<input type="file" name="fileCSV" />
				<br/><br/>
				<div class="margin-form clear">
					<input class="button" type="submit" name="submitCsv" class="button" value="'.$this->l('Update').'">
				</div>			
			</fieldset>';
 
 
?>