관리-도구
편집 파일: specials_index.php
<?php /** * specials_index module * * @package modules * @copyright Copyright 2003-2007 Zen Cart Development Team * @copyright Portions Copyright 2003 osCommerce * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 * @version $Id: specials_index.php 6424 2007-05-31 05:59:21Z ajeh $ */ if (!defined('IS_ADMIN_FLAG')) { die('Illegal Access'); } // initialize vars $categories_products_id_list = ''; $list_of_products = ''; $specials_index_query = ''; $display_limit = ''; if ( (($manufacturers_id > 0 && $_GET['filter_id'] == 0) || $_GET['music_genre_id'] > 0 || $_GET['record_company_id'] > 0) || (!isset($new_products_category_id) || $new_products_category_id == '0') ) { $specials_index_query = "select p.products_id, p.products_image, pd.products_name, p.master_categories_id, pd.products_description from (" . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id ) where p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1' and s.status = 1 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'"; } else { // get all products and cPaths in this subcat tree $productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit); if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) { // build products-list string to insert into SQL query foreach($productsInCategory as $key => $value) { $list_of_products .= $key . ', '; } $list_of_products = substr($list_of_products, 0, -2); // remove trailing comma $specials_index_query = "select distinct p.products_id, p.products_image, pd.products_name, p.master_categories_id, pd.products_description from (" . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id ) where p.products_id = s.products_id and p.products_id = pd.products_id and p.products_status = '1' and s.status = '1' and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' and p.products_id in (" . $list_of_products . ")"; } } if ($specials_index_query != '') $specials_index = $db->ExecuteRandomMulti($specials_index_query, MAX_DISPLAY_SPECIAL_PRODUCTS_INDEX); $row = 0; $col = 0; $list_box_contents = array(); $title = ''; $row_counter=0; $div_line='<div class="box_line"><div class="inner"></div></div>'; $num_products_count = ($specials_index_query == '') ? 0 : $specials_index->RecordCount(); // show only when 1 or more $expl_diff=0; if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE") == true) $expl_diff=0.2; if ($num_products_count > 0) { if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS == 0 ) { $col_width = floor(100/$num_products_count); } else { $col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS)-$expl_diff; } $list_box_contents = array(); while (!$specials_index->EOF) { if (!isset($productsInCategory[$specials_index->fields['products_id']])) $productsInCategory[$specials_index->fields['products_id']] = zen_get_generated_category_path_rev($specials_index->fields['master_categories_id']); $products_img = (($specials_index->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' . $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' . (int)$specials_index->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $specials_index->fields['products_image'], $specials_index->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a>'); $products_name = '<a class="name" href="' . zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' . $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' . $specials_index->fields['products_id']) . '">' . $specials_index->fields['products_name'] . '</a>'; $products_desc = substr(strip_tags($specials_index->fields['products_description']), 0, 115) . '...'; $products_desc2 = substr(strip_tags($specials_index->fields['products_description']), 0, 414) . '...'; $products_price = '<strong>' . zen_get_products_display_price($specials_index->fields['products_id']) . '</strong>'; $products_butt = '<a href="' . zen_href_link(zen_get_info_page($specials_index->fields['products_id']), 'cPath=' . $productsInCategory[$specials_index->fields['products_id']] . '&products_id=' . (int)$specials_index->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_GOTO_PROD_DETAILS, BUTTON_GOTO_PROD_DETAILS_ALT) . '</a>'; $img_col_w = SMALL_IMAGE_WIDTH + 17; if (SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS > 1 && $num_products_count > 1) { if ($col >= 0 && $col < SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS-1) { $tm_param = '3'; } else { $tm_param = ''; } $param1=36; $param2=41; $param3=13; $buff1=""; $buff2=""; if (COLUMN_RIGHT_STATUS == 1 or (CUSTOMERS_APPROVAL == '1' and $_SESSION['customer_id'] == '')) { $param1=0; $param2=41; $param3=0; $buff1=' <td> <div style="width:20px;"></div> </td> <td style="width:100%;"> </div> '; } $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsSpecials centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 'text' => ' <div style="margin-right:' . $tm_param . 'px;"> <div class="product_box"> <div class="bg_inner1"> <div class="bg_inner2"> <div class="bg_inner3"> <div class="bg_inner4"> <div class="bg_inner5"> <div class="bg_inner6"> <div class="bg_inner7"> <div class="bg_inner8"> <div class="bg_inner911"> <table style="width:100%; height:' . $param1 . 'px;"> <tr> <td> <div class="product_box_name"> <div class="indent">' . $products_name . '<br /> </div> </div> </td> </tr> </table> <table style="width:1px; margin-bottom:' . $param3 . 'px; margin-left:' . $param2 . 'px;"> <tr> <td> <div class="img_box2"> <div class="bg_inner1"> <div class="bg_inner2"> <div class="bg_inner3"> <div class="bg_inner4"> <div class="bg_inner5"> <div class="bg_inner6"> <div class="bg_inner7"> <div class="bg_inner8"> <div class="bg_inner9"> ' . $products_img . '<br /> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </td> </tr> </table> <table class="content_bg4"> <tr> <td class="td1"> <div> ' . $products_price . '<br /> </div> </td> <td class="td2"> <div>' . $products_butt . '<br /></div> </td> </tr> </table> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div>' ); } else { $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsSpecials centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"', 'text' => ' <div class="product_box"> <div class="bg_inner1"> <div class="bg_inner2"> <div class="bg_inner3"> <div class="bg_inner4"> <div class="bg_inner5"> <div class="bg_inner6"> <div class="bg_inner7"> <div class="bg_inner8"> <div class="bg_inner9"> <table style="width:100%; margin-bottom:9px;"> <tr> <td> <table style="width:1px; margin-bottom:' . $param3 . 'px; margin-left:' . $param2 . 'px;"> <tr> <td> <div class="img_box2"> <div class="bg_inner1"> <div class="bg_inner2"> <div class="bg_inner3"> <div class="bg_inner4"> <div class="bg_inner5"> <div class="bg_inner6"> <div class="bg_inner7"> <div class="bg_inner8"> <div class="bg_inner9"> ' . $products_img . '<br /> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> </td> </tr> </table> </td> <td> <div style="width:20px;"></div> </td> <td style="width:100%;"> <table class="price_box"> <tr> <td> <table style="width:100%;"> <tr> <td> <div class="product_box_name"> <div class="indent" style="padding-top:0;padding-left:0;">' . $products_name . '<br /> </div> </div> </td> </tr> </table> <div class="description_box"> ' . $products_desc2 . '<br /> </div> </td> </tr> <tr> <td class="product_box_price"> <div class="indent"> ' . $products_price . '<br /> </div> </td> </tr> <tr> <td> <div style="margin-top:10px;">' . $products_butt . '<br /> </div> </td> </tr> </table> </td> </tr> </table> </div> </div> </div> </div> </div> </div> </div> </div> </div> </div> '); } $row_counter++; if($row_counter < $num_products_count-1) $div_line='<div class="box_line"><div class="inner"></div></div>'; else $div_line=''; $col ++; if ($col > (SHOW_PRODUCT_INFO_COLUMNS_SPECIALS_PRODUCTS - 1)) { $col = 0; $row ++; } $specials_index->MoveNextRandom(); } if ($specials_index->RecordCount() > 0) { $title = ' <div class="title_box"> <div class="row1"> <div class="title_inner1"> <div class="title_inner2"> <div class="title_inner3">' . zen_draw_separator($image = 'pixel_trans.gif', '1', '1') . '</div> </div> </div> </div> <div class="row2"> <div class="title_inner1"> <div class="title_inner2"> <div class="title_inner3"> <div class="title_inner4"> <h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_SPECIALS_INDEX, strftime('%B')) . '</h2> </div> </div> </div> </div> </div> <div class="row3"> <div class="title_inner1"> <div class="title_inner2"> <div class="title_inner3">' . zen_draw_separator($image = 'pixel_trans.gif', '1', '1') . '</div> </div> </div> </div> </div> '; $zc_show_specials = true; } } ?>