Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Staaby

Archived
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Staaby

  1. I am not seeing where the db connection is being made in this file. can anyone help? <?php /*************************************************************************** * (admin) index.php * ------------------- * begin : Saturday, Feb 13, 2001 * copyright : (C) 2001 The phpBB Group * email : [email protected] * * $Id: index.php,v 1.40.2.6 2004/07/11 16:46:15 acydburn Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ define('IN_PHPBB', 1); // // Load default header // $no_page_header = TRUE; $phpbb_root_path = "./../includes/modules/phpbb2/"; require($phpbb_root_path . 'extension.inc'); require('./pagestart.' . $phpEx); // --------------- // Begin functions // function inarray($needle, $haystack) { for($i = 0; $i < sizeof($haystack); $i++ ) { if( $haystack[$i] == $needle ) { return true; } } return false; } // // End functions // ------------- // // Generate relevant output // if( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'left' ) { $dir = @opendir("."); $setmodules = 1; while( $file = @readdir($dir) ) { if( preg_match("/^admin_.*?\." . $phpEx . "$/", $file) ) { // include($file); } } @closedir($dir); unset($setmodules); include('./page_header_admin.'.$phpEx); $template->set_filenames(array( "body" => "admin/index_navigate.tpl") ); $template->assign_vars(array( "U_FORUM_INDEX" => append_sid("../index.$phpEx"), // "U_ADMIN_INDEX" => append_sid("index.$phpEx?pane=right"), "U_ADMIN_INDEX" => append_sid("bb_default.$phpEx?pane=right"), "L_FORUM_INDEX" => $lang['Main_index'], "L_ADMIN_INDEX" => $lang['Admin_Index'], "L_PREVIEW_FORUM" => $lang['Preview_forum']) ); ksort($module); while( list($cat, $action_array) = each($module) ) { $cat = ( !empty($lang[$cat]) ) ? $lang[$cat] : preg_replace("/_/", " ", $cat); $template->assign_block_vars("catrow", array( "ADMIN_CATEGORY" => $cat) ); ksort($action_array); $row_count = 0; while( list($action, $file) = each($action_array) ) { $row_color = ( !($row_count%2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($row_count%2) ) ? $theme['td_class1'] : $theme['td_class2']; $action = ( !empty($lang[$action]) ) ? $lang[$action] : preg_replace("/_/", " ", $action); $template->assign_block_vars("catrow.modulerow", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "ADMIN_MODULE" => $action, "U_ADMIN_MODULE" => append_sid($file)) ); $row_count++; } } $template->pparse("body"); include('./page_footer_admin.'.$phpEx); } elseif( isset($HTTP_GET_VARS['pane']) && $HTTP_GET_VARS['pane'] == 'right' ) { include('./page_header_admin.'.$phpEx); $template->set_filenames(array( "body" => "admin/index_body.tpl") ); $template->assign_vars(array( "L_WELCOME" => $lang['Welcome_phpBB'], "L_ADMIN_INTRO" => $lang['Admin_intro'], "L_FORUM_STATS" => $lang['Forum_stats'], "L_WHO_IS_ONLINE" => $lang['Who_is_Online'], "L_USERNAME" => $lang['Username'], "L_LOCATION" => $lang['Location'], "L_LAST_UPDATE" => $lang['Last_updated'], "L_IP_ADDRESS" => $lang['IP_Address'], "L_STATISTIC" => $lang['Statistic'], "L_VALUE" => $lang['Value'], "L_NUMBER_POSTS" => $lang['Number_posts'], "L_POSTS_PER_DAY" => $lang['Posts_per_day'], "L_NUMBER_TOPICS" => $lang['Number_topics'], "L_TOPICS_PER_DAY" => $lang['Topics_per_day'], "L_NUMBER_USERS" => $lang['Number_users'], "L_USERS_PER_DAY" => $lang['Users_per_day'], "L_BOARD_STARTED" => $lang['Board_started'], "L_AVATAR_DIR_SIZE" => $lang['Avatar_dir_size'], "L_DB_SIZE" => $lang['Database_size'], "L_FORUM_LOCATION" => $lang['Forum_Location'], "L_STARTED" => $lang['Login'], "L_GZIP_COMPRESSION" => $lang['Gzip_compression']) ); // // Get forum statistics // $total_posts = get_db_stat('postcount'); $total_users = get_db_stat('usercount'); $total_topics = get_db_stat('topiccount'); $start_date = create_date($board_config['default_dateformat'], $board_config['board_startdate'], $board_config['board_timezone']); $boarddays = ( time() - $board_config['board_startdate'] ) / 86400; $posts_per_day = sprintf("%.2f", $total_posts / $boarddays); $topics_per_day = sprintf("%.2f", $total_topics / $boarddays); $users_per_day = sprintf("%.2f", $total_users / $boarddays); $avatar_dir_size = 0; if ($avatar_dir = @opendir($phpbb_root_path . $board_config['avatar_path'])) { while( $file = @readdir($avatar_dir) ) { if( $file != "." && $file != ".." ) { $avatar_dir_size += @filesize($phpbb_root_path . $board_config['avatar_path'] . "/" . $file); } } @closedir($avatar_dir); // // This bit of code translates the avatar directory size into human readable format // Borrowed the code from the PHP.net annoted manual, origanally written by: // Jesse ([email protected]) // if($avatar_dir_size >= 1048576) { $avatar_dir_size = round($avatar_dir_size / 1048576 * 100) / 100 . " MB"; } else if($avatar_dir_size >= 1024) { $avatar_dir_size = round($avatar_dir_size / 1024 * 100) / 100 . " KB"; } else { $avatar_dir_size = $avatar_dir_size . " Bytes"; } } else { // Couldn't open Avatar dir. $avatar_dir_size = $lang['Not_available']; } if($posts_per_day > $total_posts) { $posts_per_day = $total_posts; } if($topics_per_day > $total_topics) { $topics_per_day = $total_topics; } if($users_per_day > $total_users) { $users_per_day = $total_users; } // // DB size ... MySQL only // // This code is heavily influenced by a similar routine // in phpMyAdmin 2.2.0 // if( preg_match("/^mysql/", SQL_LAYER) ) { $sql = "SELECT VERSION() AS mysql_version"; if($result = $db->sql_query($sql)) { $row = $db->sql_fetchrow($result); $version = $row['mysql_version']; if( preg_match("/^(3\.23|4\.)/", $version) ) { $db_name = ( preg_match("/^(3\.23\.[6-9])|(3\.23\.[1-9][1-9])|(4\.)/", $version) ) ? "`$dbname`" : $dbname; $sql = "SHOW TABLE STATUS FROM " . $db_name; if($result = $db->sql_query($sql)) { $tabledata_ary = $db->sql_fetchrowset($result); $dbsize = 0; for($i = 0; $i < count($tabledata_ary); $i++) { if( $tabledata_ary[$i]['Type'] != "MRG_MyISAM" ) { if( $table_prefix != "" ) { if( strstr($tabledata_ary[$i]['Name'], $table_prefix) ) { $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; } } else { $dbsize += $tabledata_ary[$i]['Data_length'] + $tabledata_ary[$i]['Index_length']; } } } } // Else we couldn't get the table status. } else { $dbsize = $lang['Not_available']; } } else { $dbsize = $lang['Not_available']; } } else if( preg_match("/^mssql/", SQL_LAYER) ) { $sql = "SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize FROM sysfiles"; if( $result = $db->sql_query($sql) ) { $dbsize = ( $row = $db->sql_fetchrow($result) ) ? intval($row['dbsize']) : $lang['Not_available']; } else { $dbsize = $lang['Not_available']; } } else { $dbsize = $lang['Not_available']; } if ( is_integer($dbsize) ) { if( $dbsize >= 1048576 ) { $dbsize = sprintf("%.2f MB", ( $dbsize / 1048576 )); } else if( $dbsize >= 1024 ) { $dbsize = sprintf("%.2f KB", ( $dbsize / 1024 )); } else { $dbsize = sprintf("%.2f Bytes", $dbsize); } } $template->assign_vars(array( "NUMBER_OF_POSTS" => $total_posts, "NUMBER_OF_TOPICS" => $total_topics, "NUMBER_OF_USERS" => $total_users, "START_DATE" => $start_date, "POSTS_PER_DAY" => $posts_per_day, "TOPICS_PER_DAY" => $topics_per_day, "USERS_PER_DAY" => $users_per_day, "AVATAR_DIR_SIZE" => $avatar_dir_size, "DB_SIZE" => $dbsize, "GZIP_COMPRESSION" => ( $board_config['gzip_compress'] ) ? $lang['ON'] : $lang['OFF']) ); // // End forum statistics // // // Get users online information. // $sql = "SELECT u.user_id, u.username, u.user_session_time, u.user_session_page, s.session_logged_in, s.session_ip, s.session_start FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s WHERE s.session_logged_in = " . TRUE . " AND u.user_id = s.session_user_id AND u.user_id <> " . ANONYMOUS . " AND s.session_time >= " . ( time() - 300 ) . " ORDER BY u.user_session_time DESC"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't obtain regd user/online information.", "", __LINE__, __FILE__, $sql); } $onlinerow_reg = $db->sql_fetchrowset($result); $sql = "SELECT session_page, session_logged_in, session_time, session_ip, session_start FROM " . SESSIONS_TABLE . " WHERE session_logged_in = 0 AND session_time >= " . ( time() - 300 ) . " ORDER BY session_time DESC"; if(!$result = $db->sql_query($sql)) { message_die(GENERAL_ERROR, "Couldn't obtain guest user/online information.", "", __LINE__, __FILE__, $sql); } $onlinerow_guest = $db->sql_fetchrowset($result); $sql = "SELECT forum_name, forum_id FROM " . FORUMS_TABLE; if($forums_result = $db->sql_query($sql)) { while($forumsrow = $db->sql_fetchrow($forums_result)) { $forum_data[$forumsrow['forum_id']] = $forumsrow['forum_name']; } } else { message_die(GENERAL_ERROR, "Couldn't obtain user/online forums information.", "", __LINE__, __FILE__, $sql); } $reg_userid_ary = array(); if( count($onlinerow_reg) ) { $registered_users = 0; for($i = 0; $i < count($onlinerow_reg); $i++) { if( !inarray($onlinerow_reg[$i]['user_id'], $reg_userid_ary) ) { $reg_userid_ary[] = $onlinerow_reg[$i]['user_id']; $username = $onlinerow_reg[$i]['username']; if( $onlinerow_reg[$i]['user_allow_viewonline'] || $userdata['user_level'] == ADMIN ) { $registered_users++; $hidden = FALSE; } else { $hidden_users++; $hidden = TRUE; } if( $onlinerow_reg[$i]['user_session_page'] < 1 ) { switch($onlinerow_reg[$i]['user_session_page']) { case PAGE_INDEX: $location = $lang['Forum_index']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_POSTING: $location = $lang['Posting_message']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_LOGIN: $location = $lang['Logging_on']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_SEARCH: $location = $lang['Searching_forums']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_PROFILE: $location = $lang['Viewing_profile']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_VIEWONLINE: $location = $lang['Viewing_online']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_VIEWMEMBERS: $location = $lang['Viewing_member_list']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_PRIVMSGS: $location = $lang['Viewing_priv_msgs']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_FAQ: $location = $lang['Viewing_FAQ']; $location_url = "bb_default.$phpEx?pane=right"; break; default: $location = $lang['Forum_index']; $location_url = "bb_defaultx.$phpEx?pane=right"; } } else { $location_url = append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=" . $onlinerow_reg[$i]['user_session_page']); $location = $forum_data[$onlinerow_reg[$i]['user_session_page']]; } $row_color = ( $registered_users % 2 ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( $registered_users % 2 ) ? $theme['td_class1'] : $theme['td_class2']; $reg_ip = decode_ip($onlinerow_reg[$i]['session_ip']); $template->assign_block_vars("reg_user_row", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "USERNAME" => $username, "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['session_start'], $board_config['board_timezone']), "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_reg[$i]['user_session_time'], $board_config['board_timezone']), "FORUM_LOCATION" => $location, "IP_ADDRESS" => $reg_ip, "U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$reg_ip", "U_USER_PROFILE" => append_sid("admin_users.$phpEx?mode=edit&" . POST_USERS_URL . "=" . $onlinerow_reg[$i]['user_id']), "U_FORUM_LOCATION" => append_sid($location_url)) ); } } } else { $template->assign_vars(array( "L_NO_REGISTERED_USERS_BROWSING" => $lang['No_users_browsing']) ); } // // Guest users // if( count($onlinerow_guest) ) { $guest_users = 0; for($i = 0; $i < count($onlinerow_guest); $i++) { $guest_userip_ary[] = $onlinerow_guest[$i]['session_ip']; $guest_users++; if( $onlinerow_guest[$i]['session_page'] < 1 ) { switch( $onlinerow_guest[$i]['session_page'] ) { case PAGE_INDEX: $location = $lang['Forum_index']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_POSTING: $location = $lang['Posting_message']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_LOGIN: $location = $lang['Logging_on']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_SEARCH: $location = $lang['Searching_forums']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_PROFILE: $location = $lang['Viewing_profile']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_VIEWONLINE: $location = $lang['Viewing_online']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_VIEWMEMBERS: $location = $lang['Viewing_member_list']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_PRIVMSGS: $location = $lang['Viewing_priv_msgs']; $location_url = "bb_default.$phpEx?pane=right"; break; case PAGE_FAQ: $location = $lang['Viewing_FAQ']; $location_url = "bb_default.$phpEx?pane=right"; break; default: $location = $lang['Forum_index']; $location_url = "bb_default.$phpEx?pane=right"; } } else { $location_url = append_sid("admin_forums.$phpEx?mode=editforum&" . POST_FORUM_URL . "=" . $onlinerow_guest[$i]['session_page']); $location = $forum_data[$onlinerow_guest[$i]['session_page']]; } $row_color = ( $guest_users % 2 ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( $guest_users % 2 ) ? $theme['td_class1'] : $theme['td_class2']; $guest_ip = decode_ip($onlinerow_guest[$i]['session_ip']); $template->assign_block_vars("guest_user_row", array( "ROW_COLOR" => "#" . $row_color, "ROW_CLASS" => $row_class, "USERNAME" => $lang['Guest'], "STARTED" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_start'], $board_config['board_timezone']), "LASTUPDATE" => create_date($board_config['default_dateformat'], $onlinerow_guest[$i]['session_time'], $board_config['board_timezone']), "FORUM_LOCATION" => $location, "IP_ADDRESS" => $guest_ip, "U_WHOIS_IP" => "http://network-tools.com/default.asp?host=$guest_ip", "U_FORUM_LOCATION" => append_sid($location_url)) ); } } else { $template->assign_vars(array( "L_NO_GUESTS_BROWSING" => $lang['No_users_browsing']) ); } // Check for new version $current_version = explode('.', '2' . $board_config['version']); $minor_revision = (int) $current_version[2]; $errno = 0; $errstr = $version_info = ''; if ($fsock = @fsockopen('www.phpbb.com', 80, $errno, $errstr)) { @fputs($fsock, "GET /updatecheck/20x.txt HTTP/1.1\r\n"); @fputs($fsock, "HOST: www.phpbb.com\r\n"); @fputs($fsock, "Connection: close\r\n\r\n"); $get_info = false; while (!@feof($fsock)) { if ($get_info) { $version_info .= @fread($fsock, 1024); } else { if (@fgets($fsock, 1024) == "\r\n") { $get_info = true; } } } @fclose($fsock); $version_info = explode("\n", $version_info); $latest_head_revision = (int) $version_info[0]; $latest_minor_revision = (int) $version_info[2]; $latest_version = (int) $version_info[0] . '.' . (int) $version_info[1] . '.' . (int) $version_info[2]; if ($latest_head_revision == 2 && $minor_revision == $latest_minor_revision) { $version_info = '<p style="color:green">' . $lang['Version_up_to_date'] . '</p>'; } else { $version_info = '<p style="color:red">' . $lang['Version_not_up_to_date']; $version_info .= '<br />' . sprintf($lang['Latest_version_info'], $latest_version) . sprintf($lang['Current_version_info'], '2' . $board_config['version']) . '</p>'; } } else { if ($errstr) { $version_info = '<p style="color:red">' . sprintf($lang['Connect_socket_error'], $errstr) . '</p>'; } else { $version_info = '<p>' . $lang['Socket_functions_disabled'] . '</p>'; } } $version_info .= '<p>' . $lang['Mailing_list_subscribe_reminder'] . '</p>'; $template->assign_vars(array( 'VERSION_INFO' => $version_info, 'L_VERSION_INFORMATION' => $lang['Version_information']) ); $template->pparse("body"); include('./page_footer_admin.'.$phpEx); } else { // // Generate frameset // $template->set_filenames(array( "body" => "admin/index_frameset.tpl") ); $template->assign_vars(array( "S_FRAME_NAV" => append_sid("bb_default.$phpEx?pane=left"), "S_FRAME_MAIN" => append_sid("bb_default.$phpEx?pane=right")) ); header ("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT"); header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); $template->pparse("body"); //$db->sql_close(); exit; } ?>
  2. Been dinking around with this and i had read something about reming out the includes(file); line in the bb_default.php this was causing my problems i removed that but the thing that it was remming out that line was supposed to fix, is happening now. im getting this error Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/content/p/b/a/pbadmin/html/catalog/admin/includes/functions/database.php:13) in /home/content/p/b/a/pbadmin/html/catalog/admin/includes/functions/database.php on line 13 That line is function tep_db_connect($server = DB_SERVER, $username = DB_SERVER_USERNAME, $password = DB_SERVER_PASSWORD, $database = DB_DATABASE, $link = 'db_link') { Anyone get this fixed? Staaby
  3. Im getting this error when i go to the bb_default.php page in the left pane Warning: ksort() expects parameter 1 to be array, null given in /home/content/p/b/a/pbadmin/html/catalog/admin/bb_default.php on line 87 Warning: Variable passed to each() is not an array or object in /home/content/p/b/a/pbadmin/html/catalog/admin/bb_default.php on line 89 I think that it has something to do with this step in the install instructions: But im not 100% sure what it is telling me to do here... can someone throw me a bone? I think that this might also be related to not being able to post anything in the forums Thanks! Staaby
  4. Thanks! I am going to give it a shot tonight and let you know how it works. This is an incredible contribution and keep up the great work! staaby
  5. Can you do a package for the paypal ipn contrib? that would be the bee's knees
  6. Warning: main(includes/column_left.php): failed to open stream: No such file or directory in /html/admin/admin_account.php on line 83 Fatal error: main(): Failed opening required 'includes/column_left.php' (include_path='.:/usr/local/lib/php') in /html/admin/admin_account.php on line 83 anyone know why id be getting this error?
  7. All, Im having the image with the sorting of the images. Is there somehwere in the code to say Image 1 = left Image 2 = center Image 3= right? when i am adding 3 images, it randomly is putting them in an order and i cant find a pattern. Thanks, Staaby
  8. Found the fix for the main popup image. in the file catalog/popup_image.php find this line if ($products['products_image_pop']== NULL ) {echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); } else {echo tep_image(DIR_WS_IMAGES .[B] DIR_FS_CATALOG_IMAGES_BIG [/B]. $products['products_image_pop'], $products['products_name'], POPUP_IMAGE_WIDTH, POPUP_IMAGE_HEIGHT);}; Remove the DIR_FS_CATALOG_IMAGES_BIG . and the popup should work. Staaby
  9. Sounds like you dont have the SQL tables set up. You should have a .sql file in the package that will need to be put into your database. You can use a tool like phpmyadmin to do this.
  10. Act like the Tell A Friend infobox but would be a suggestion box. Any recommendations? Thanks! Staaby
  11. This should be what you are looking for. Under the admin>catalog>item, you should now see a "STOCK" button on the right hand side (over by add/move/edit/etc). Under here, you can add quantities to each attribute. Let me know if you are still having issues. Staaby
  12. AWESOME JOB RAPLH! If there is anything i can do to help ralph, let me know! I am all about nailing this thing down. Staaby
  13. The only thing that ive noticed that would be a "bug" is that you only get the -Out of Stock- in the selection if there are none for all options (ie the stock equals zero for small shirt in both white and black). Not that this is a big deal (believe me i can live with it), but some people might be anal about it. Thank you so much for helping me out with this ralph!
  14. Oh you just made my day... looks like it is working. Gonna bang away at it and see if i can break it.
  15. Ralph, can you post your product_info.php that worked? I am getting some really funky stuff happening when i make the changes that you posted. (check out www.nobuenogear.com/catalog if you want to see what is going on) Thanks! staaby
  16. getting this now: Parse error: parse error, unexpected $ in /home/content/N/B/G/NBGAdmin/html/catalog/product_info.php on line 264 here is my product_info.php file <?php /* $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $ (v 1.98 by Tom Wojcik aka TomThumb 2004/07/03 based on work by Michael Coffman aka coffman) osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Amended for Attributes Inventory - FREEZEHELL - 08/11/2003 [email protected] Copyright (c) 2003 IBWO Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le ft=150') } //--></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <?php if ($product_check['total'] < 1) { ?> <tr> <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } else { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading" valign="top"><?php echo $products_name; ?></td> <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"> <?php if (tep_not_null($product_info['products_image'])) { ?> <table border="0" cellspacing="0" cellpadding="2" align="right"> <tr> <td align="center" class="smallText"> <script language="javascript"><!-- document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> </td> </tr> </table> <?php } ?> <p><?php echo stripslashes($product_info['products_description']); ?></p> <?php $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { ?> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.options_id, pa.options_values_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { //START get attribute stock values // $attribute_stock_query = tep_db_query("SELECT products_stock_quantity FROM " . TABLE_PRODUCTS_STOCK . " WHERE products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' AND products_stock_attributes LIKE '%" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "%'"); $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' AND products_stock_attributes REGEXP '(^|,)" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "(,|$)' AND products_stock_quantity > 0"); if (tep_db_num_rows($attribute_stock_query)==0) { $attributes_stock = tep_db_fetch_array($attribute_stock_query); $option_stock = $attributes_stock['products_stock_quantity']; //END get attribute stock values // START Show out of Stock if ($option_stock == 0) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => 'Out of Stock - ' . $products_options['products_options_values_name']); } else { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); } // END Show out of Stock if ($products_options['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <tr> <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <?php } ?> </table> <?php } ?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if (tep_not_null($product_info['products_url'])) { ?> <tr> <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> <?php } else { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td> <?php if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } ?> </td> </tr> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  17. I appreciate the help. One thing i noticed was that it should actaully start with $products_attributes_query This is in the product_info.php file correct? Thanks again Staaby
  18. Ya i tried your query and it doesnt work... i unfortunately am not very good at php... will keep digging.. thanks bro!
  19. did a little more screwing around and found that the second attribute takes into account the ENTIRE stock and not just the one that it is supposed to be pulling from. I made Black the primary for the color attribute and added S, M, L, XL and then did the same for white. The blacks followed the rules of stock but the whites thought that all of them belonged to the one attribute eg. B-S 2 B-M 5 B-L 3 B-XL 4 W-S 2 W-M 5 W-L 3 W-XL 4 any of the whites though that it had 28 in each attribute. Any ideas?
  20. New issue... With the second attribute, it doesnt subtract stock or check stock... any ideas?
  21. DOH got an error... when there are 2 colors... Get the following error 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 insert into products_stock values (0,28,'1-6,2-2',)
  22. Well all, I couldnt wait any longer so I dug through what has gone on the last week and i have it working with multiple attributes. First things first, USE 2.3 NOT 3.0 Then, in the product_info.php find this line: /START get attribute stock values $attribute_stock_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and products_stock_attributes = '" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "'"); and replace it with the line that Tim Ross found /START get attribute stock values $attribute_stock_query = tep_db_query("SELECT products_stock_quantity FROM " . TABLE_PRODUCTS_STOCK . " WHERE products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' AND products_stock_attributes LIKE '%" . (int)$products_options['options_id'] . "-" . (int)$products_options['options_values_id'] . "%'"); This removes stock and everything. And it removes the 'Out Of Stock' for all items. Hope this helps some people. staaby
×
×
  • Create New...