Advertisement
frg004

hotel V2

Aug 13th, 2013
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. if(get_post_type($post) == 'sejour-gastronomique'){
  3. //Page est de type "sejour-gastronomique"
  4. echo '<h1>';
  5. the_title();
  6. echo '<hr></h1>';
  7. the_content('');
  8.  
  9. //Tableaux des séjours gastronomiques
  10. if (ICL_LANGUAGE_CODE == 'fr') { echo "<h4>Tarifs</h4>";} if (ICL_LANGUAGE_CODE == 'nl') { echo "<h4>Prijzen</h4>";} if (ICL_LANGUAGE_CODE == 'en') { echo "<h4>Price</h4>";}
  11. echo '<table>';
  12. echo '<tr><td>';
  13. if (ICL_LANGUAGE_CODE == 'fr') { echo "Type de chambre ";}
  14. if (ICL_LANGUAGE_CODE == 'nl') { echo "Kamers ";}
  15. if (ICL_LANGUAGE_CODE == 'en') { echo "Type of room";}
  16. echo'</td><td>';
  17. if (ICL_LANGUAGE_CODE == 'fr') { echo "1 personne ";}
  18. if (ICL_LANGUAGE_CODE == 'nl') { echo "1 personne";}
  19. if (ICL_LANGUAGE_CODE == 'en') { echo "1 personne";}
  20. echo'</td><td>';
  21. if (ICL_LANGUAGE_CODE == 'fr') { echo "2 personnes ";}
  22. if (ICL_LANGUAGE_CODE == 'nl') { echo "2 personnes ";}
  23. if (ICL_LANGUAGE_CODE == 'en') { echo "2 personnes";}
  24. echo'</td></tr>';
  25.  
  26. //Cible de l'action des formulaires
  27. if (ICL_LANGUAGE_CODE == 'fr') {
  28. $action = '/votre-reservation';
  29. }
  30. if (ICL_LANGUAGE_CODE == 'nl') {
  31. $action = get_bloginfo('url').'uw-boeking';
  32. }
  33. if (ICL_LANGUAGE_CODE == 'en') {
  34. $action = get_bloginfo('url').'your-booking';
  35. }
  36.  
  37.  
  38. //New Solution
  39. $post_en_cours = get_the_ID();
  40. $sejourgastro = get_the_title();
  41. $idproduitsejour = get_field("idproduit");
  42. $nuitspayantes = get_field("nuitspayantes");
  43. //Initialisation d'un compteur
  44. $nombreinitial = 1;
  45.  
  46. /* echo $post_en_cours ."<br>";
  47. echo $sejourgastro ."<br>";
  48. echo $idproduitsejour ."<br>";
  49. echo $nuitspayantes ."<br>"; */
  50.  
  51. var_dump( get_field('relation_sejour_chambre') );
  52.  
  53. $posts = get_field('relation_sejour_chambre');
  54.  
  55. if( $posts ): ?>
  56.  
  57. <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
  58. <?php setup_postdata($post); ?>
  59. <tr>
  60. <td><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></td>
  61.  
  62.  
  63. <?php
  64.  
  65. //Si séjour gastro demi-pension
  66. if ($post_en_cours == '246' or $post_en_cours == '620' or $post_en_cours == '437' ){
  67.  
  68. //Mis en place du compteur dans la boucle
  69. //echo "Le nombreinitial est".$nombreinitial;
  70. $nombre = $nombreinitial++;
  71. //echo $nombre;
  72.  
  73.  
  74. echo '<td>'.get_field("sejour_demi_single").' &euro; <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
  75. echo '<td>'.get_field("sejour_demi_double").' &euro; <a onclick="submitsejour2p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver() .'</a></td>';
  76.  
  77.  
  78. //Formsejour1personne
  79. echo '<form method="POST" action="'.$action.'" name="formsejour1persN'.$nombre.'">
  80. <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
  81. <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
  82. <input type="hidden" value="'.get_field("sejour_demi_single").'" name="prixsingle">
  83. <input type="hidden" value="'.get_field("chambre_prix_single_seule").'" name="pc1n">
  84. <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
  85. <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
  86. <input type="hidden" value="'.get_langue().'" name="langue">
  87. <input type="hidden" value="1" name="quantite">
  88. </form>';
  89.  
  90. //Formsejour2personnes
  91. echo '<form method="POST" action="'.$action.'" name="formsejour2persN'.$nombre.'">
  92. <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
  93. <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
  94. <input type="hidden" value="'.get_field("sejour_demi_double").'" name="prixdouble">
  95. <input type="hidden" value="'.get_field("chambre_prix_double_seule").'" name="pc1n">
  96. <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
  97. <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
  98. <input type="hidden" value="'.get_langue().'" name="langue">
  99. <input type="hidden" value="1" name="quantite">
  100. </form>';
  101. }
  102. //Si séjour gastro 1 nuitée
  103. if($post_en_cours=='245' or $post_en_cours == '621' or $post_en_cours=='622'){
  104. $nombre = $nombreinitial++;
  105. echo '<td>'.get_field("sejour_unenuit_single").' &euro; <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
  106. echo '<td>'.get_field("sejour_unenuit_double").' &euro; <a onclick="submitsejour2p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
  107.  
  108. //Formsejour1personne
  109. echo '<form method="POST" action="'.$action.'" name="formsejour1persN'.$nombre.'">
  110. <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
  111. <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
  112. <input type="hidden" value="'.get_field("sejour_unenuit_single").'" name="prixsingle">
  113. <input type="hidden" value="'.get_field("chambre_prix_single_seule").'" name="pc1n">
  114. <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
  115. <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
  116. <input type="hidden" value="'.get_langue().'" name="langue">
  117. <input type="hidden" value="1" name="quantite">
  118. </form>';
  119.  
  120. //Formsejour2personnes
  121. echo '<form method="POST" action="'.$action.'" name="formsejour2persN'.$nombre.'">
  122. <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
  123. <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
  124. <input type="hidden" value="'.get_field("sejour_unenuit_double").'" name="prixdouble">
  125. <input type="hidden" value="'.get_field("chambre_prix_double_seule").'" name="pc1n">
  126. <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
  127. <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
  128. <input type="hidden" value="'.get_langue().'" name="langue">
  129. <input type="hidden" value="1" name="quantite">
  130. </form>';
  131.  
  132.  
  133. }
  134. //Si séjour gastro 2 nuitées
  135. if($post_en_cours=='244' or $post_en_cours=='623' or $post_en_cours=='624' ){
  136. $nombre = $nombreinitial++;
  137. echo '<td>'.get_field("sejour_deuxnuits_single").' &euro; <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
  138. echo '<td>'.get_field("sejour_deuxnuits_double").' &euro; <a onclick="submitsejour2p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
  139.  
  140. //Formsejour1personne
  141. echo '<form method="POST" action="'.$action.'" name="formsejour1persN'.$nombre.'">
  142. <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
  143. <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
  144. <input type="hidden" value="'.get_field("sejour_deuxnuits_single").'" name="prixsingle">
  145. <input type="hidden" value="'.get_field("chambre_prix_single_seule").'" name="pc1n">
  146. <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
  147. <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
  148. <input type="hidden" value="'.get_langue().'" name="langue">
  149. <input type="hidden" value="1" name="quantite">
  150. </form>';
  151.  
  152. //Formsejour2personnes
  153. echo '<form method="POST" action="'.$action.'" name="formsejour2persN'.$nombre.'">
  154. <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
  155. <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
  156. <input type="hidden" value="'.get_field("sejour_deuxnuits_double").'" name="prixdouble">
  157. <input type="hidden" value="'.get_field("chambre_prix_double_seule").'" name="pc1n">
  158. <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
  159. <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
  160. <input type="hidden" value="'.get_langue().'" name="langue">
  161. <input type="hidden" value="1" name="quantite">
  162. </form>';
  163.  
  164. }
  165. //Si séjour gastro mi-semaine
  166. if($post_en_cours=='274' or $post_en_cours=='617' or $post_en_cours=='618' ){
  167. $nombre = $nombreinitial++;
  168. echo '<td>'.get_field("sejour_misemaine_single").' &euro; <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
  169. echo '<td>'.get_field("sejour_misemaine_double").' &euro; <a onclick="submitsejour1p'.$nombre.'()" style="margin-left:40px;" class="button-small rounded-grey" href="#"><span></span>'.langue_reserver().'</a></td>';
  170.  
  171. //Formsejour1personne
  172. echo '<form method="POST" action="'.$action.'" name="formsejour1persN'.$nombre.'">
  173. <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
  174. <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
  175. <input type="hidden" value="'.get_field("sejour_misemaine_single").'" name="prixsingle">
  176. <input type="hidden" value="'.get_field("chambre_prix_single_seule").'" name="pc1n">
  177. <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
  178. <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
  179. <input type="hidden" value="'.get_langue().'" name="langue">
  180. <input type="hidden" value="1" name="quantite">
  181. </form>';
  182.  
  183. //Formsejour2personnes
  184. echo '<form method="POST" action="'.$action.'" name="formsejour2persN'.$nombre.'">
  185. <input type="hidden" value="'.$idproduitsejour.'" name="idproduit">
  186. <input type="hidden" value="'.get_field("idproduit").'" name="idchambre">
  187. <input type="hidden" value="'.get_field("sejour_misemaine_double").'" name="prixdouble">
  188. <input type="hidden" value="'.get_field("chambre_prix_double_seule").'" name="pc1n">
  189. <input type="hidden" value="'.$nuitspayantes.'" name="nuitspayantes">
  190. <input type="hidden" value="'.$sejourgastro.' '.get_the_title().'" name="typechambre">
  191. <input type="hidden" value="'.get_langue().'" name="langue">
  192. <input type="hidden" value="1" name="quantite">
  193. </form>';
  194. }
  195.  
  196. ?>
  197. </tr>
  198.  
  199. <?php endforeach; ?>
  200.  
  201. <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
  202. <?php endif;
  203.  
  204.  
  205. echo '</table>';
  206.  
  207.  
  208.  
  209.  
  210. }
  211.  
  212. if(get_post_type($post) == 'formule-avantageuse'){
  213. //Page est de type "formule-avantageuse"
  214. echo '<h1>';
  215. the_title();
  216. echo '<hr></h1>';
  217. the_content('');
  218. }
  219.  
  220.  
  221. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement