PageRenderTime 50ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/sites/all/themes/md_oldal/template/page--node--6.tpl.php

https://bitbucket.org/jaayyy/country-lane-farms
PHP | 266 lines | 209 code | 31 blank | 26 comment | 40 complexity | 0f2576853a9aba7712ee159761f122a9 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  1. <div class="main-wrap">
  2. <?php
  3. include 'header.php';
  4. drupal_add_js($base_url."/".drupal_get_path('theme', 'md_oldal')."/js/jquery.order-list.js");
  5. /*$OrderID = intval($_SESSION["OrderID"]);
  6. if ($OrderID == 0) {
  7. drupal_goto("/order-day");
  8. }*/
  9. $Categories = om_get_product_categories();
  10. if ($Categories["StatusCode"] == 1) {
  11. $Categories = $Categories["Data"];
  12. } else {
  13. $Categories = false;
  14. }
  15. #$OrderDetails = om_get_order($OrderID);
  16. $OrderDetails = om_order_session_get("info");
  17. /*
  18. if ($OrderDetails["StatusCode"] == 1) {
  19. $OrderDetails = $OrderDetails["Data"];
  20. } else {
  21. $OrderDetails = false;
  22. }
  23. */
  24. $DetailsID = intval($OrderDetails->deliveryitemid);
  25. $DeliveryID = om_get_deliveryid($DetailsID);
  26. if ($DeliveryID["StatusCode"] == 1) {
  27. $DeliveryID = intval($DeliveryID["Data"]);
  28. }
  29. #$OrderItems = om_order_items($OrderID);
  30. $OrderItems = om_order_session_get("items");
  31. $Items = array();
  32. if ($OrderItems) {
  33. #$OrderItems = $OrderItems["Data"];
  34. foreach ($OrderItems as $i) {
  35. $Items[$i->productid] = array("quantity"=>$i->quantity, "total"=>$i->total);
  36. }
  37. } else {
  38. $OrderItems = false;
  39. }
  40. /*
  41. $Alerts = om_get_availability_alerts();
  42. if ($Alerts["StatusCode"] == 1) {
  43. $Alerts = $Alerts["Data"];
  44. } else {
  45. $Alerts = false;
  46. }
  47. */
  48. global $user;
  49. //$Favourites = om_get_favourite_products($user->uid, $DeliveryID);
  50. $Favourites["StatusCode"] == 0;
  51. $HideProducts = array();
  52. if ($Favourites["StatusCode"] == 1) {
  53. $Favourites = $Favourites["Data"];
  54. $FavouritesCategory = new stdClass();
  55. $FavouritesCategory->name = "Your Favourites";
  56. $FavouritesCategory->id = -1;
  57. array_unshift($Categories, $FavouritesCategory);
  58. }
  59. ?>
  60. <form action="/process-complete-order" method="post" onkeypress="return event.keyCode != 13;" id="complete-order-form">
  61. <input type="hidden" name="o" value="<?php echo $OrderID; ?>" />
  62. <div class="option-info section row sticky-order" style="">
  63. <div class="right-col col-md-10 col-md-offset-1">
  64. <h1>Estimated order total: $<span class="order-total"><?php echo number_format($OrderDetails->total, 2, ".", ","); ?></span></h1>
  65. <input type="submit" class="button" value="Place Order"/>
  66. </div>
  67. </div>
  68. <div class="content col-md-10 col-md-offset-1" style="margin-top: 120px;margin-bottom:20px;">
  69. <div class="option-info section row" style="margin-bottom:20px;">
  70. <div class="left-col col-md-12">
  71. <h1>Select your products</h1>
  72. <p>
  73. PLEASE NOTE: All of the costs are estimates only. Each item will be weighed when you pick up your order and
  74. you will be charged based on the exact amount based on the price per lb cost.
  75. </p>
  76. </div>
  77. <!--<div class="right-col col-md-7">
  78. <h1>Estimated order total: $<span class="order-total"><?php echo number_format($OrderDetails->total, 2, ".", ","); ?></span></h1>
  79. <input type="submit" class="button" value="Place Order"/>
  80. </div>-->
  81. </div>
  82. <div class="order-products-list section row" style="margin-top:20px;">
  83. <?php
  84. foreach($Categories as $c) {
  85. if ($c->id > 0) {
  86. $Products = om_get_products_by_category($c->id, $DeliveryID);
  87. } else {
  88. $Products = array(
  89. "StatusCode" => 1,
  90. "Data" => $Favourites
  91. );
  92. }
  93. if ($Products["StatusCode"] == 1) {
  94. $Products = $Products["Data"];
  95. ?>
  96. <h1><?php echo $c->name; ?></h1>
  97. <?php
  98. if (strlen($c->alert) > 0) {
  99. ?>
  100. <div class="row">
  101. <div class="red-message full-width product-alert">
  102. <?php echo $c->alert; ?>
  103. </div>
  104. </div>
  105. <?php
  106. }
  107. ?>
  108. <?php
  109. foreach($Products as $p) {
  110. if ($HideProducts[$p->pid] != true && $p->visible == 1) {
  111. //if ($c->id > 0 && $HideProducts[$p->pid] != true || $c->id == -1 && $p->visible == 1) {
  112. $ProductAvailable = array();
  113. if ($p->productavailable == 0 ) {
  114. $ProductAvailable["Available"] = false;
  115. $ProductAvailable["CSS"] = " product-unavailable";
  116. $ProductAvailable["Disable"] = "disabled='disabled'";
  117. } else {
  118. $ProductAvailable["Available"] = true;
  119. $ProductAvailable["CSS"] = "";
  120. $ProductAvailable["Disable"] = "";
  121. }
  122. if ($ProductAvailable["Available"] == false) {
  123. if ($p->available == 0 && strlen($p->alert) > 0) {
  124. $ProductAvailable["Message"] = $p->alert;
  125. } elseif($p->productavailable == 0 && strlen($p->alert) > 0) {
  126. $ProductAvailable["Message"] = $p->alert;
  127. } else {
  128. $ProductAvailable["Message"] = "";
  129. }
  130. } else {
  131. $ProductAvailable["Message"] = "";
  132. }
  133. ?>
  134. <div class="row<?php echo $ProductAvailable["CSS"] ?>">
  135. <div class="pic col-md-2">
  136. <img src="/sites/default/files/products/small/<?php echo $p->thumbnail; ?>" alt="">
  137. </div>
  138. <div class="product-title col-md-4">
  139. <h2><?php echo $p->name; ?></h2>
  140. <p>
  141. <?php echo $p->summary; ?>
  142. </p>
  143. <?php
  144. if ($p->bulkminquantity > 1) {
  145. ?>
  146. <p class="red-text">Minimum Bulk Quantity: <?php echo $p->bulkminquantity; ?>+</p>
  147. <?php
  148. }
  149. ?>
  150. </div>
  151. <div class="price col-md-2">
  152. <?php
  153. if ($p->pricelb > 0) {
  154. ?>
  155. <p>Price per lb. $<?php echo number_format($p->pricelb, 2, ".", ","); ?></p>
  156. <?php
  157. }
  158. ?>
  159. <?php
  160. if ($p->estimatedpriceperitem > 0) {
  161. ?>
  162. <p>Estimated Cost Per Item $<?php echo number_format($p->estimatedpriceperitem, 2, ".", ","); ?></p>
  163. <?php
  164. }
  165. ?>
  166. <?php
  167. if ($p->bulkpricelb > 0) {
  168. ?>
  169. <p class="red-text">Bulk Price per lb. $<?php echo number_format($p->bulkpricelb, 2, ".", ","); ?></p>
  170. <?php
  171. }
  172. ?>
  173. <?php
  174. if ($p->estimatedbulkpriceperitem > 0) {
  175. ?>
  176. <p class="red-text">Estimated Bulk Cost Per Item $<?php echo number_format($p->estimatedbulkpriceperitem, 2, ".", ","); ?></p>
  177. <?php
  178. }
  179. ?>
  180. </div>
  181. <div class="quantity col-md-2 col-xs-6">
  182. <h2>Quantity</h2>
  183. <?php
  184. $Quantity = intval($Items[$p->pid]["quantity"]);
  185. ?>
  186. <input type="text" value="<?php echo $Quantity; ?>" name="quantity[<?php echo $p->pid; ?>]" bulk-min="<?php echo $p->bulkminquantity; ?>" price-lb="<?php echo $p->pricelb; ?>" price-lb-bulk="<?php echo $p->bulkpricelb; ?>" unit-cost-bulk="<?php echo $p->estimatedbulkpriceperitem; ?>" unit-cost="<?php echo number_format($p->estimatedpriceperitem, 2, ".", ","); ?>" pid="<?php echo $p->pid; ?>" class="quantity-input" <?php echo $ProductAvailable["Disable"]; ?>/>
  187. <input type="hidden" value="<?php echo $p->estimatedpriceperitem; ?>" name="cost[<?php echo $p->pid; ?>]" id="cost-<?php echo $p->pid; ?>" />
  188. <input type="hidden" value="<?php echo $p->pricelb; ?>" name="lb[<?php echo $p->pid; ?>]" id="lb-<?php echo $p->pid; ?>" />
  189. <input type="hidden" value="regular" name="pricemodel[<?php echo $p->pid; ?>]" id="pricemodel-<?php echo $p->pid; ?>" />
  190. <input type="hidden" value="0" id="total-holder-<?php echo $p->pid; ?>" class="item-total" />
  191. </div>
  192. <div class="total col-md-2 col-xs-6">
  193. <h2>Est. Total</h2>
  194. <?php
  195. $Total = number_format($Items[$p->pid]["total"], 2, ".", ",");
  196. ?>
  197. <span class="black-text" id="total-<?php echo $p->pid; ?>">$<?php echo $Total; ?></span>
  198. </div>
  199. </div>
  200. <?php
  201. if (strlen($ProductAvailable["Message"])>0) {
  202. ?>
  203. <div class="row">
  204. <div class="red-message full-width product-alert">
  205. <?php echo $ProductAvailable["Message"]; ?>
  206. </div>
  207. </div>
  208. <?php
  209. }
  210. }
  211. }
  212. if ($c->id == -1) {
  213. foreach($Favourites as $f) {
  214. $HideProducts[$f->pid] = true;
  215. }
  216. }
  217. }
  218. ?>
  219. <?php
  220. }
  221. ?>
  222. <input type="hidden" id="order-total-bucket" value="0.00" />
  223. </div>
  224. <div class="option-info section">
  225. <div class="right-col">
  226. <h1>Estimated order total: $<span class="order-total"><?php echo number_format($OrderDetails->total, 2, ".", ","); ?></span></h1>
  227. <input type="submit" class="button" value="Place Order"/>
  228. </div>
  229. </div>
  230. </div>
  231. </form>
  232. </div>
  233. <?php include 'footer.php'; ?>