Bonjour a tous,

Mon problème est assez complexe pour moi et va être un peux difficile a expliqué, je suis par expert.

Je vous mettrai toutes page concernant pour mieux comprendre.

On commence,

J'ai une page shop.html, c'est la ou mes offres seront disponible.

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
<div class="shop" >
             <form action="" enctype="multipart/form-data" method="post" id="shop_form<?php echo $id ?>" class="shop_form" >
            	<input type="hidden" name="block" value="<?php echo $o->get('type') ?>" />
                <input type="hidden" name="idnum" value="<?php echo $id ?>"/> 
            <div class="shop_item_form" >
                Sélectionner votre offre
                <br />
                <select name="select_offre_<?php echo $id ?>" onchange="changeOffre(<?php echo $id ?>, '<?php echo $o->get('type') ?>')">
                <?php listOffres($o->get('type'));?>
                </select>
                </div>
                <div id="shop_options_<?php echo $id ?>" >
 
 
                </div>
                </form>
        	<div class="shop_priceDiv" >
            	<span>Prix total: </span><span class="shop_price" id="shopPrice<?php echo $id ?>" ></span>
            </div>
        	<div class="shop_orderButtonDiv" >
            	<a onclick="formSubmit('shop_form<?php echo $id ?>')" class="pointer"/></a>
            </div>
 
 
        </div>
        <div class="clear" ></div>
La page php :

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
 
<?php
 
function listJeux(){
	$game = new Games();
	$jeux = $game->listGames("", "ORDER BY name ASC");
	foreach($jeux as $g){
		echo '<option value="'.$g['gameid'].'" >'.$g['game'].'&nbsp;</option>';
	}
}
function listOffres($type, $r='out'){
	$O = new Offers();
	$list =$O->getAll("WHERE type='".$type."' AND etat=1 ", "ORDER By name ASC ");
	if(count($list) == 0){ echo '<td id="0" >Aucune&nbsp;</td>';;}
	else{	
	foreach($list as $k=>$v){
			echo'<option value="'.$v['id'].'" >'.stripslashes($v['name']).'&nbsp;</option>';	
		}		
	}	
}
 
function listNames($list){
	$a = array();
	foreach($list as $l)
		$a[]=stripslashes($l['name']);
		return implode('/', $a);
}
 
$act = $tools->getValue('act', NULL);
 
if($act == NULL){$id = $tools->getValue('id', 0);}
	if ($id != 0){
	$o = new Offers($id);
	include(_THEME_DIR_.$themeFolder."pages/shop_.html");
 
}
?>
J'ai modifier le .htacess pour créer la page par ID (Si sa ce dit comme sa):
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
RewriteRule ^location_louer_([0-9A-Za-z-_]+).html$
index.php?&page=shop&id=$1 [L]
Le javascript (Qui change actuellement les offres grace au select :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
function changeOffre(idnum, type){
	var id = jQuery('select[name=select_offre_'+idnum+']').val();
	var url = "<?php echo _HOMEURL_ ?>js/modules/offres.php?task=offresOptions&idnum="+idnum+"&offre="+id;
	jQuery.get(url , function(data){
		document.getElementById('shop_options_'+idnum).innerHTML=data;
		changeGame(idnum);
		calcul(idnum);
	});
}
Et il reste le dernier qui donne les infos des offres grace a l'id "shop_options[id] :

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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
 
<?php
include('../../init.php');
 
$task = $tools->getValue('task', NULL);
$game = new Games();
$jeux = $game->listGames("", "ORDER BY name ASC");
 
$slots = 1;
$cores = 1;
//error_reporting(E_ALL);
function getOption($line, $n=0){
	global $slots, $cores;
	$c = explode(':', $line);
	$c1 = trim($c[0]); 
	$c2= ((isset($c[1]))? $c[1] : '');
	$out ="";
 
	if($c1 == "selectGames"){
		global $jeux;
		//onchange="getMinMaxSlots('.$n.')"
		$out.='Sélectionner le jeu<br /><select name="select_game_'.$n.'"  class="of_'.$n.'" onchange="changeGame('.$n.'); calcul('.$n.')" >';
		foreach($jeux as $g) 
			$out.='<option value="'.$g['gameid'].'" >'.$g['game'].'&nbsp;</option>';
		$out.='</select></div>';
	}
	if($c1=="selectSlot"){
		global $jeux;
		//showLog($jeux, 'p');
		$min = 1; $max=64;
		if(trim($c2) != ""){
			$SLTS=explode(',', $c2);
			$min = $SLTS[0];
			$max = $SLTS[1];
		}
 
		$game = new games($jeux[0]['gameid']);
		//$min = intval($game->get('min_slots'));
		//$max = intval($game->get('slots'));
		if($min == 0) $min =1 ;
		$slots = $min;
		$out.='<div class="shop_item_form"  id="slot_div_'.$n.'" >Sélectionner le nombre de slots<br /> <select
		onchange="calcul('.$n.')"
		name="select_slot_'.$n.'" class="of_'.$n.'"  >';
        for($i = $min; $i < $max + 1; $i++){
			$out.='<option value="'.$i.'" >'.$i.'&nbsp;</option>';
		}
       $out.='</select></div>';
	}
	if($c1=="selectType"){
		$out.='<div class="shop_item_form" >Sélectionner le type<br /><select name="select_type_'.$n.'" class="of_'.$n.'" onchange="calcul('.$n.')" ><option value="Public" >Public&nbsp;</option><option value="Private" >Privé&nbsp;</option></select></div>';	
	}
	if($c1 == "selectDuration"){
		$mois = explode(',' , $c2);
		$o = '';
		foreach($mois as $m){
			if($m != ''){
				$mpx = explode( "(" , $m);
				$px = str_replace(')' , '' , $mpx[1] );
				$month = $mpx[0];
				if($px == 0)
					$o.='<option value="'.$m.'" >'.$month.' mois &nbsp;</option>';
				else
					$o.='<option value="'.$m.'" >'.$month.' mois ('.$px.')&nbsp;</option>';
			}
		}
		$out.='<div class="shop_item_form" class="of_'.$n.'" >Sélectionner la durée<br /><select name="select_duree_'.$n.'" class="of_'.$n.'" onchange="calcul('.$n.')" >'.$o.'</select></div>';
	}
	if($c1=='selectCore'){
		$o ='';
		for($i = 1; $i < 5; $i++){
			$o.='<option value="'.$i.'" >'.$i.'&nbsp;</option>';	
		}
		$cores = 1;
		$out.='<div class="shop_item_form" >Choisissez le nombre de Cores<br /><select name="select_core_'.$n.'" class="of_'.$n.'" onchange="calcul('.$n.')" >'.$o.'</select></div>';	
	}
	if($c1=='selectFps'){
		$o = '';
		$array = array('2000', '5000', '10000', '15000');
		foreach($array as $a){
			$o.='<option value="'.$a.'" >'.$a.'&nbsp;</option>';	
		}
		$out.='<div class="shop_item_form" >Choix des fps<br /><select name="select_fps_'.$n.'" class="of_'.$n.'" onchange="calcul('.$n.')" >'.$o.'</select></div>';	
	}else if($c1=='selectVocal'){
		$V = new Vocal(NULL, 'dispo');
		//$list = $V->listServers('', 'ORDER BY type ASC');
		$list = $V->listDispoVocal('WHERE full=0', 'ORDER BY type ASC');
		if(count($list) >0){
			$o='';
			foreach($list as $l){
				$o.='<option value="'.$l['id'].'" >'.ucfirst($l['type']).'&nbsp;</option>';	
			}
			$out.='<div class="shop_item_form" >Choisissez votre serveur vocal:<br /><select name="select_vocal_'.$n.'" class="of_'.$n.'" onchange="calcul('.$n.')" >'.$o.'</select></div>';
		}
	}else if($c1=='installFrais'){
		$o = '';
		$o.='<div class="shop_item_form" >'."Frais d'installation".' : <input name="install_frais_'.$n.'" class="of_'.$n.'" type="hidden" value="'.$c2.'" />'.$c2.' &euro;</div>';
		//$out.=addslashes($o);
		$out.=$o;
	}else if($c1=='textDomain'){
		$out.='<div class="shop_item_form" >Choisissez un domaine :<br /><input name="text_domaine_'.$n.'" class="of_'.$n.' tdomaine" type="text"  /><input type="button" onclick="verifDomain('.$n.')" class="pointer" value="Vérifier" /><span id="span_domaine_check_'.$n.'" style="color:#6C0" ></span></div>';
	}else if($c1 == 'textSubDomain'){
		$host = str_replace('xxx', '' , $c2);
		$out.='<div class="shop_item_form" >Choisissez un domaine :<br /><input name="text_subdomaine_'.$n.'" class="of_'.$n.' " type="text" style="width:100px"  /> '.$host.' <input type="button" onclick="verifSubDomain('.$n.')" class="pointer" value="Vérifier" /><span id="span_subdomaine_check_'.$n.'" style="color:#6C0" ></span></div>';
	}else if($c1=='textMentions'){
		$out.='<div class="shop_item_form" >Mentions :<br />'.$c2.'</div>';
	}
 
 
 
	return $out;
}
 
 
 
 
if($task == "offresOptions"){
	$n=$tools->getValue('idnum', 0);
	$id = $tools->getValue('offre', 0);
	if($id == 0) die();
	$O = new Offers($id);
	$options = $O->get('options');
	if(trim($options) != ''){
		$options = explode(';' , $options);
		$out='';
		foreach($options as $op){
			$out.=getOption($op, $n);	
		}
	}else{
		$out=''; 
	}
 
	$price = $O->get('price');
	if(intval($O->get('by_slot')) == 1) $price = $price * $slots;
	if(intval($O->get('by_core')) == 1) $price = $price * $cores;
 
	$out.='<input type="hidden" name="act" value="buy" />';
	$out.='<input type="hidden" name="price_'.$n.'" value="'.$O->get('price').'" />';
	/*?>jQuery("#shop_options_<?php echo $n ?>").html('<?php echo $out ?>');
    calcul(<?php echo $n ?>);
	/*jQuery("#shopPrice<?php echo $n ?>").html('<?php  echo number_format($price, 2, '.', '').' &euro;';     ?>');*/
	/*?>
    document.getElementById('shop_options_<?php echo $n ?>').innerHTML='<?php echo $out ?>';*/ 
    echo $out;
 
 
}else if($task == "calcul"){
	$n=$tools->getValue('idnum', 0);
	$id = $tools->getValue('offre', 0);
	if($id == 0) die();
	$O = new Offers($id);
	$options = $O->get('options');
	$durees = array();
	if(trim($options) != ''){
		$options = explode(';' , $options);
		foreach($options as $op){
			$cx = explode(':' , $op);
			if(trim($cx[0]) == 'selectDuration'){
				$durees = explode(',' , $cx[1]);
			}
		}
	}
 
	$px =0;
	//get values
	$price = $O->get('price');
	$type = $tools->getValue('select_type_'.$n, 'Public');
	$slots = $tools->getValue('select_slot_'.$n, 1);
	$cores = $tools->getValue('select_core_'.$n, 1);
	$idgame = $tools->getValue('select_game_'.$n, 0);
	$duration = $tools->getValue('select_duree_'.$n, '1(0)' );
	$installFrais = $tools->getValue('install_frais_'.$n, 0);
	if(intval($O->get('by_slot')) == 1) $price = $price * $slots;
	if(intval($O->get('by_core')) == 1) $price = $price * $cores;
	$old = $price;
	if(count($durees) > 0){
		$d_p = explode('(', $duration );
		$px =str_replace(')', '', $d_p[1]);
		$price = ( $price * $d_p[0] );
		$px= str_replace('€', '' , $px);
		if(stripos($px, '%')){
			$px = str_replace('%', '', $px);
			if($px < 0){
				$px = intval(str_replace('-', '', $px));
				$price = $price / (($px /100) + 1);
			}else{
				$price =  $price * (($px /100) + 1);	
			}
		}else{
			$price = $price + $px;
		}
		if(!in_array($duration, $durees)){
			$px = 0;		
		}
	}
 
	$price = $price + $installFrais;
 
 
 
 
 
	?>jQuery("#shopPrice<?php echo $n ?>").html('<?php  echo number_format($price, 2, '.', '').' &euro;';     ?>');
	<?php
	/*?>document.getElementById("shopPrice<?php echo $n ?>").innerHTML='<?php  echo number_format($price, 2, '.', '').' &euro;';     ?>';<?php*/
 
}
 
?>
Dans tous j'essaye simplement qu'il me lisent les offres pour chaque ID sur la meme page.. En enlevant le
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
<select name="select_offre_<?php echo $id ?>" onchange="changeOffre(<?php echo $id ?>, '<?php echo $o->get('type') ?>')">
                <?php listOffres($o->get('type'));?>
                </select>
Je ne veux pas de liste des offres deroulante, mais chaque offres a sont ID et sa page..

Et qu'il me le fasse automatiquement au charggement de la page.
J'ai expliquer un peux bizarement peut etre, si vous pouvais m'aider.

Merci