Witam, mam problem ze sklepem by ghost...
Chcę aby po wejściu w listę usług nie wyświetlało domyślnie listy usług 1 serwera z listy, tylko żeby pojawiła się lista usług jakiegoś serwera trzeba wybrać serwer. Jeśli niejasno napisałem mogę wytłumaczyć dokładniej wystarczy napisać smile.gif

Link do strony : http://ustrzel.eu/shop/service/
dane testowe:
Nick: Your-Design
Hasło: test123

Kod pliku w którym jest zawarta chyba cała potrzebna formuła
  1. <?php Core::get('View')->execute('global/head') ?>
  2.  
  3. <div id="board">
  4. <div class="breadcrumb">
  5. <a href="<?php echo Core::$site ?>">Sklep Automatyczny</a> → <a href="<?php echo Core::$site ?>service">Lista usług</a>
  6. </div>
  7. <div class="page_title">Lista usług</div>
  8.  
  9. <?php
  10.  
  11. // Ustawmy ilość znalezionych grup na 0
  12. $find = 0;
  13.  
  14. // Jeśli są jakieś usługi
  15. if(count($services))
  16. {
  17. ?>
  18.  
  19.  
  20. <script>
  21. function buy(se_id){
  22. new SimpleBox({
  23. url: core.getConfig('base_url') + 'service/buy/index',
  24. data: {id: se_id},
  25. submitValue: false
  26. }).show();
  27. }
  28.  
  29. function setServer(server_hash, li){
  30. $('.vertical_menu ul li').removeClass('active');
  31. $(li).addClass('active');
  32.  
  33.  
  34. $('.service').animate({
  35. opacity: 0.0
  36. }, 600, function(){
  37. $('.service').hide();
  38. $('.service_' + server_hash).show();
  39. $('.service_' + server_hash).animate({
  40. opacity: 1.0
  41. }, 600);
  42. });
  43. }
  44. </script>
  45.  
  46. <?php
  47.  
  48. $show = array();
  49. foreach((array)$services as $_level => $data)
  50. {
  51. if(!isset($data['id']))
  52. {
  53. continue;
  54. }
  55.  
  56. $clear = '';
  57. if($_level % 2)
  58. {
  59. $clear = '<div style="clear: both"></div>';
  60. }
  61.  
  62. // Chyba można wyświetlić usługę do wyświetlenia
  63.  
  64. $key = md5($data['server']['hostname']);
  65.  
  66. if(!isset($show[$key]))
  67. {
  68. $show[$key] = array();
  69. }
  70.  
  71. $show[$key][] = $data;
  72.  
  73. // Dodajmy znaleziono grupe, aby później nie wyświetliło komunikatu
  74. // że nie ma żadnych usług
  75. $find++;
  76. }
  77.  
  78. echo '<div style="clear: both"></div>';
  79. }
  80.  
  81. if($find > 0)
  82. {
  83. $menu_li = '';
  84. $display = '';
  85. $first = '';
  86.  
  87. foreach($show as $hash => $service)
  88. {
  89.  
  90. $first = $first == '' ? $hash : $first;
  91.  
  92. $c = count($service);
  93. $menu_li .= "<li class='{$hash}' onclick='setServer(\"{$hash}\", this)'><div><span style='float: left; max-width: 90%'>{$service[0]['server']['hostname']}</span><span class='stats' style='float: right'>{$c}</span></div><div style='clear: both; height: 1px'></div></li>";
  94.  
  95. $display .= "<div style='display: none' class='service service_{$hash}'>";
  96. foreach($service as $data)
  97. {
  98. $display .= <<< SERVICE
  99. <div class="img_bar">{$data['name']} <span style="float: right" onclick="buy({$data['id']})">Zamów</span></div>
  100. <div class="blue_box" style="margin-bottom: 15px">
  101. <div class="content" style="padding: 3px">
  102. <table class="table">
  103. <tr class="header">
  104. <td>Serwer</td>
  105. <td>Okres na jaki można zamówić</td>
  106. <td>Cena</td>
  107. </tr>
  108. <tr>
  109. <td>{$data['server']['hostname']}</td>
  110. <td>{$data['min_day']} do {$data['max_day']} Dni</td>
  111. <td>{$data['cost_per_day']} PLN / Dzień</td>
  112. </tr>
  113. </table>
  114.  
  115. <div style="margin: 5px">
  116. {$data['desc']}
  117. </div>
  118.  
  119. <div style="clear: both"></div>
  120. </div>
  121. </div>
  122. SERVICE;
  123. }
  124. $display .= "</div>";
  125. }
  126.  
  127. echo "<script>$(document).ready(function(){ setServer('{$first}', $('.{$first}')); });</script>";
  128.  
  129. echo <<< CONTENT
  130. <div class="blue_box">
  131. <div class="vertical_menu" style="width: 305px">
  132. <h3>Wybierz serwer</h3>
  133. <ul>
  134. {$menu_li}
  135. </ul>
  136. </div>
  137. <div class="admin_content" style="min-height: 300px; width: 830px; padding: 10px">
  138. {$display}
  139. </div>
  140.  
  141. </div>
  142. CONTENT;
  143. }
  144. else
  145. {
  146. echo '<div class="warning">Aktualnie nie ma żadnych usług do kupienia</div>';
  147. }
  148. ?>
  149. </div>
  150. <?php Core::get('View')->execute('global/footer') ?>


Refresh

Pomoże ktoś ?

F5