Advertisement
frg004

hotel

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