PageRenderTime 26ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/includes/templates/template_default/templates/tpl_modules_products_new_listing.php

http://daocart.googlecode.com/
PHP | 215 lines | 183 code | 17 blank | 15 comment | 87 complexity | 1e681ebb9433c6ec7b0ca1a3c2970639 MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0, BSD-3-Clause
  1. <?php
  2. /**
  3. * Module Template
  4. *
  5. * Loaded automatically by index.php?main_page=products_new.<br />
  6. * Displays listing of New Products
  7. *
  8. * @package templateSystem
  9. * @copyright Copyright 2003-2007 Zen Cart Development Team
  10. * @copyright Portions Copyright 2003 osCommerce
  11. * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  12. * @version $Id: tpl_modules_products_new_listing.php 6096 2007-04-01 00:43:21Z ajeh $
  13. */
  14. ?>
  15. <table border="0" width="100%" cellspacing="2" cellpadding="2">
  16. <tr>
  17. <td colspan="3"><hr /></td>
  18. </tr>
  19. <?php
  20. $group_id = zen_get_configuration_key_value('PRODUCT_NEW_LIST_GROUP_ID');
  21. if ($products_new_split->number_of_rows > 0) {
  22. $products_new = $db->Execute($products_new_split->sql_query);
  23. while (!$products_new->EOF) {
  24. if (PRODUCT_NEW_LIST_IMAGE != '0') {
  25. if ($products_new->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) {
  26. $display_products_image = str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_IMAGE, 3, 1));
  27. } else {
  28. $display_products_image = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $products_new->fields['products_image'], $products_new->fields['products_name'], IMAGE_PRODUCT_NEW_LISTING_WIDTH, IMAGE_PRODUCT_NEW_LISTING_HEIGHT) . '</a>' . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_IMAGE, 3, 1));
  29. }
  30. } else {
  31. $display_products_image = '';
  32. }
  33. if (PRODUCT_NEW_LIST_NAME != '0') {
  34. $display_products_name = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '"><strong>' . $products_new->fields['products_name'] . '</strong></a>' . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_NAME, 3, 1));
  35. } else {
  36. $display_products_name = '';
  37. }
  38. if (PRODUCT_NEW_LIST_MODEL != '0' and zen_get_show_product_switch($products_new->fields['products_id'], 'model')) {
  39. $display_products_model = TEXT_PRODUCTS_MODEL . $products_new->fields['products_model'] . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_MODEL, 3, 1));
  40. } else {
  41. $display_products_model = '';
  42. }
  43. if (PRODUCT_NEW_LIST_WEIGHT != '0' and zen_get_show_product_switch($products_new->fields['products_id'], 'weight')) {
  44. $display_products_weight = '<br />' . TEXT_PRODUCTS_WEIGHT . $products_new->fields['products_weight'] . TEXT_SHIPPING_WEIGHT . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_WEIGHT, 3, 1));
  45. } else {
  46. $display_products_weight = '';
  47. }
  48. if (PRODUCT_NEW_LIST_QUANTITY != '0' and zen_get_show_product_switch($products_new->fields['products_id'], 'quantity')) {
  49. if ($products_new->fields['products_quantity'] <= 0) {
  50. $display_products_quantity = TEXT_OUT_OF_STOCK . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_QUANTITY, 3, 1));
  51. } else {
  52. $display_products_quantity = TEXT_PRODUCTS_QUANTITY . $products_new->fields['products_quantity'] . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_QUANTITY, 3, 1));
  53. }
  54. } else {
  55. $display_products_quantity = '';
  56. }
  57. if (PRODUCT_NEW_LIST_DATE_ADDED != '0' and zen_get_show_product_switch($products_new->fields['products_id'], 'date_added')) {
  58. $display_products_date_added = TEXT_DATE_ADDED . ' ' . zen_date_long($products_new->fields['products_date_added']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_DATE_ADDED, 3, 1));
  59. } else {
  60. $display_products_date_added = '';
  61. }
  62. if (PRODUCT_NEW_LIST_MANUFACTURER != '0' and zen_get_show_product_switch($products_new->fields['products_id'], 'manufacturer')) {
  63. $display_products_manufacturers_name = ($products_new->fields['manufacturers_name'] != '' ? TEXT_MANUFACTURER . ' ' . $products_new->fields['manufacturers_name'] . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_MANUFACTURER, 3, 1)) : '');
  64. } else {
  65. $display_products_manufacturers_name = '';
  66. }
  67. if ((PRODUCT_NEW_LIST_PRICE != '0' and zen_get_products_allow_add_to_cart($products_new->fields['products_id']) == 'Y') and zen_check_show_prices() == true) {
  68. $products_price = zen_get_products_display_price($products_new->fields['products_id']);
  69. $display_products_price = TEXT_PRICE . ' ' . $products_price . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_LIST_PRICE, 3, 1)) . (zen_get_show_product_switch($products_new->fields['products_id'], 'ALWAYS_FREE_SHIPPING_IMAGE_SWITCH') ? (zen_get_product_is_always_free_shipping($products_new->fields['products_id']) ? TEXT_PRODUCT_FREE_SHIPPING_ICON . '<br />' : '') : '');
  70. } else {
  71. $display_products_price = '';
  72. }
  73. // more info in place of buy now
  74. if (PRODUCT_NEW_BUY_NOW != '0' and zen_get_products_allow_add_to_cart($products_new->fields['products_id']) == 'Y') {
  75. if (zen_has_product_attributes($products_new->fields['products_id'])) {
  76. $link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
  77. } else {
  78. // $link= '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT) . '</a>';
  79. if (PRODUCT_NEW_LISTING_MULTIPLE_ADD_TO_CART > 0 && $products_new->fields['products_qty_box_status'] != 0) {
  80. // $how_many++;
  81. $link = TEXT_PRODUCT_NEW_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $products_new->fields['products_id'] . "]\" value=\"0\" size=\"4\" />";
  82. } else {
  83. $link = '<a href="' . zen_href_link(FILENAME_PRODUCTS_NEW, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;';
  84. }
  85. }
  86. $the_button = $link;
  87. $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
  88. $display_products_button = zen_get_buy_now_button($products_new->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_new->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_BUY_NOW, 3, 1));
  89. } else {
  90. $link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
  91. $the_button = $link;
  92. $products_link = '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
  93. $display_products_button = zen_get_buy_now_button($products_new->fields['products_id'], $the_button, $products_link) . '<br />' . zen_get_products_quantity_min_units_display($products_new->fields['products_id']) . str_repeat('<br clear="all" />', substr(PRODUCT_NEW_BUY_NOW, 3, 1));
  94. }
  95. if (PRODUCT_NEW_LIST_DESCRIPTION > '0') {
  96. $disp_text = zen_get_products_description($products_new->fields['products_id']);
  97. $disp_text = zen_clean_html($disp_text);
  98. $display_products_description = stripslashes(zen_trunc_string($disp_text, PRODUCT_NEW_LIST_DESCRIPTION, '<a href="' . zen_href_link(zen_get_info_page($products_new->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_new->fields['master_categories_id']) . '&products_id=' . $products_new->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));
  99. } else {
  100. $display_products_description = '';
  101. }
  102. ?>
  103. <tr>
  104. <td width="<?php echo IMAGE_PRODUCT_NEW_LISTING_WIDTH + 10; ?>" valign="top" class="main" align="center">
  105. <?php
  106. $disp_sort_order = $db->Execute("select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_group_id='" . $group_id . "' and (configuration_value >= 1000 and configuration_value <= 1999) order by LPAD(configuration_value,11,0)");
  107. while (!$disp_sort_order->EOF) {
  108. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_IMAGE') {
  109. echo $display_products_image;
  110. }
  111. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_QUANTITY') {
  112. echo $display_products_quantity;
  113. }
  114. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_BUY_NOW') {
  115. echo $display_products_button;
  116. }
  117. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_NAME') {
  118. echo $display_products_name;
  119. }
  120. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_MODEL') {
  121. echo $display_products_model;
  122. }
  123. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_MANUFACTURER') {
  124. echo $display_products_manufacturers_name;
  125. }
  126. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_PRICE') {
  127. echo $display_products_price;
  128. }
  129. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_WEIGHT') {
  130. echo $display_products_weight;
  131. }
  132. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_DATE_ADDED') {
  133. echo $display_products_date_added;
  134. }
  135. $disp_sort_order->MoveNext();
  136. }
  137. ?>
  138. </td>
  139. <td colspan="2" valign="top" class="main">
  140. <?php
  141. $disp_sort_order = $db->Execute("select configuration_key, configuration_value from " . TABLE_CONFIGURATION . " where configuration_group_id='" . $group_id . "' and (configuration_value >= 2000 and configuration_value <= 2999) order by LPAD(configuration_value,11,0)");
  142. while (!$disp_sort_order->EOF) {
  143. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_IMAGE') {
  144. echo $display_products_image;
  145. }
  146. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_QUANTITY') {
  147. echo $display_products_quantity;
  148. }
  149. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_BUY_NOW') {
  150. echo $display_products_button;
  151. }
  152. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_NAME') {
  153. echo $display_products_name;
  154. }
  155. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_MODEL') {
  156. echo $display_products_model;
  157. }
  158. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_MANUFACTURER') {
  159. echo $display_products_manufacturers_name;
  160. }
  161. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_PRICE') {
  162. echo $display_products_price;
  163. }
  164. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_WEIGHT') {
  165. echo $display_products_weight;
  166. }
  167. if ($disp_sort_order->fields['configuration_key'] == 'PRODUCT_NEW_LIST_DATE_ADDED') {
  168. echo $display_products_date_added;
  169. }
  170. $disp_sort_order->MoveNext();
  171. }
  172. ?>
  173. </td>
  174. </tr>
  175. <?php if (PRODUCT_NEW_LIST_DESCRIPTION > '0') { ?>
  176. <tr>
  177. <td colspan="3" valign="top" class="main">
  178. <?php
  179. echo $display_products_description;
  180. ?>
  181. </td>
  182. </tr>
  183. <?php } ?>
  184. <tr>
  185. <td colspan="3"><hr /></td>
  186. </tr>
  187. <?php
  188. $products_new->MoveNext();
  189. }
  190. } else {
  191. ?>
  192. <tr>
  193. <td class="main" colspan="2"><?php echo TEXT_NO_NEW_PRODUCTS; ?></td>
  194. </tr>
  195. <?php
  196. }
  197. ?>
  198. </table>