spooks Posted December 5, 2009 Author Share Posted December 5, 2009 UPDATE^^^^^^^^^^^ qty box appears if I change the Product Listing Style in admin settings to thumbnails in grid, still no product extra fields though. No for me though I need manufacturer view. Did you read this bit: For the option to work you must enable it in the file & enable the quantity box as well as setting a 'buy now' option for the 'buy now' button. 2. If a product has attributes but you have not enabled the attributes option, no quantity box will appear for that product, only a details button, as the shopper must go to the product page to set them. Your buy now column must have a numeric value 'yes' is not valid!! (it sets position for qty box) What description mod do you have? Did you have extra_fields working on your lising b4? which version did u use, I noted b4 its code is somewhat flaky, had use some work arounds. If you had it on listing, your code would help, Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 5, 2009 Share Posted December 5, 2009 Did you read this bit: For the option to work you must enable it in the file & enable the quantity box as well as setting a 'buy now' option for the 'buy now' button. 2. If a product has attributes but you have not enabled the attributes option, no quantity box will appear for that product, only a details button, as the shopper must go to the product page to set them. Your buy now column must have a numeric value 'yes' is not valid!! (it sets position for qty box) What description mod do you have? Did you have extra_fields working on your lising b4? which version did u use, I noted b4 its code is somewhat flaky, had use some work arounds. If you had it on listing, your code would help, Ok changed the buy now column to numeric value and the qty box is displaying (not where I need it but we'll deal with that later). No idea what product description mod I have (I installed it ages ago and can;t remember) to be honest I'm not too worried becuase if I can get the product extra fields to show they will be replacing the product description anyway. I never got the extra fields to show on product listing, this was the reason I decided to update to this verison of Product Listing Enhancements, Thumbnails & Manufacturer Headings. Quote Link to comment Share on other sites More sharing options...
spooks Posted December 5, 2009 Author Share Posted December 5, 2009 Uploaded new version 2.4.5 Added option to set the size of the last column in block mode, ie u can have as many fields in the right hand column as you wish, see settings for use. There is currently on-going development of this contribution, so some controls that currently require changes within the code will ultimately be ported to admin controls. Changed files: product_listing.php. UPGRADING Upload the changed files. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
spooks Posted December 5, 2009 Author Share Posted December 5, 2009 Ok changed the buy now column to numeric value and the qty box is displaying (not where I need it but we'll deal with that later). No idea what product description mod I have (I installed it ages ago and can;t remember) to be honest I'm not too worried becuase if I can get the product extra fields to show they will be replacing the product description anyway. I never got the extra fields to show on product listing, this was the reason I decided to update to this verison of Product Listing Enhancements, Thumbnails & Manufacturer Headings. You should be able to get the layout you want with the new version, using a block mode. You perhaps need to make some tests to find the block with extra fields. Find the code: function extra_fields($products_id) { global $languages_id, $show_extra_fields; $extra_fields_text = ''; if (defined(TABLE_PRODUCTS_EXTRA_FIELDS) && $show_extra_fields) { $extra_fields_query = tep_db_query("SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef, ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf WHERE ptf.products_extra_fields_id=pef.products_extra_fields_id and ptf.products_id=". (int) $products_id ." and (pef.languages_id = '0' or pef.languages_id = '".(int)$languages_id."') and ptf.products_extra_fields_value <> '' and pef.products_extra_fields_status ORDER BY pef.products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { $extra_fields_text .= '<tr><td class="smallText"><span class="xtra-field-name">' . $extra_fields['name'] . ': </span><span class="xtra-field-value">' . $extra_fields['value'] . '</span></td></tr>'; } } return $extra_fields_text; } Add before: while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { this $to = tep_db_num_rows($extra_fields_query) . ' ef rows read'; print "<script>alert('$to');</script>"; you should get one alert for every product listed Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
spooks Posted December 5, 2009 Author Share Posted December 5, 2009 Can someone give me a tip as to where I can fine tune the size of the grid or product individual column width and heights. I would like to tighten the space all around the image and in between each line such as title, pricing, buttons area, etc. Thanks, Some sizes are set in admin, but you can check on the css etc on any element download firefox and its web developer & firebug plugins, then use that to inspect anything on a page. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 5, 2009 Share Posted December 5, 2009 You should be able to get the layout you want with the new version, using a block mode. You perhaps need to make some tests to find the block with extra fields. Find the code: function extra_fields($products_id) { global $languages_id, $show_extra_fields; $extra_fields_text = ''; if (defined(TABLE_PRODUCTS_EXTRA_FIELDS) && $show_extra_fields) { $extra_fields_query = tep_db_query("SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef, ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf WHERE ptf.products_extra_fields_id=pef.products_extra_fields_id and ptf.products_id=". (int) $products_id ." and (pef.languages_id = '0' or pef.languages_id = '".(int)$languages_id."') and ptf.products_extra_fields_value <> '' and pef.products_extra_fields_status ORDER BY pef.products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { $extra_fields_text .= '<tr><td class="smallText"><span class="xtra-field-name">' . $extra_fields['name'] . ': </span><span class="xtra-field-value">' . $extra_fields['value'] . '</span></td></tr>'; } } return $extra_fields_text; } Add before: while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { this $to = tep_db_num_rows($extra_fields_query) . ' ef rows read'; print "<script>alert('$to');</script>"; you should get one alert for every product listed Code added and I get no alerts. What does that mean? Quote Link to comment Share on other sites More sharing options...
spooks Posted December 5, 2009 Author Share Posted December 5, 2009 Code added and I get no alerts. What does that mean? It means iether TABLE_PRODUCTS_EXTRA_FIELDS is not defined in dbase tables, or you did'nt set $show_extra_fields to true, no other possibilities. PS the TABLE_PRODUCTS_EXTRA_FIELDS define addition is part of the extra fields install!! Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 5, 2009 Share Posted December 5, 2009 It means iether TABLE_PRODUCTS_EXTRA_FIELDS is not defined in dbase tables, or you did'nt set $show_extra_fields to true, no other possibilities. PS the TABLE_PRODUCTS_EXTRA_FIELDS define addition is part of the extra fields install!! Surely thats not possible as the extra fields are showing up in product_info, but I will check..... no definatley there in catalog/includes/database_tables.php: // START: Product Extra Fields define('TABLE_PRODUCTS_EXTRA_FIELDS', 'products_extra_fields'); define('TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS', 'products_to_products_extra_fields'); // END: Product Extra Fields and I definitely have product extra views et to true in product listing: $show_extra_fields = true; // set to true if you have products_extra_fields installed & you want to display the fields in the listing Quote Link to comment Share on other sites More sharing options...
spooks Posted December 5, 2009 Author Share Posted December 5, 2009 Surely thats not possible as the extra fields are showing up in product_info, but I will check..... no definatley there in catalog/includes/database_tables.php: // START: Product Extra Fields define('TABLE_PRODUCTS_EXTRA_FIELDS', 'products_extra_fields'); define('TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS', 'products_to_products_extra_fields'); // END: Product Extra Fields and I definitely have product extra views et to true in product listing: $show_extra_fields = true; // set to true if you have products_extra_fields installed & you want to display the fields in the listing then there's smthg you've done elsewhere, you did add the line b4 the 'while' ? you did upload the changed file? add after: $extra_fields_text = ''; $to = TABLE_PRODUCTS_EXTRA_FIELDS . ' go=' . ($show_extra_fields ? 'yes' : 'no') ; print "<script>alert('$to');</script>"; Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 5, 2009 Share Posted December 5, 2009 then there's smthg you've done elsewhere, you did add the line b4 the 'while' ? you did upload the changed file? add after: $extra_fields_text = ''; $to = TABLE_PRODUCTS_EXTRA_FIELDS . ' go=' . ($show_extra_fields ? 'yes' : 'no') ; print "<script>alert('$to');</script>"; Yes I added the first bit of code before the "while" and uploaded the changed file. Just added that last bit of code after $extra_fields_text = '' and got a pop up message saying "products_extra_fields go=yes" 8 of the them in fact. Is that good? Quote Link to comment Share on other sites More sharing options...
spooks Posted December 5, 2009 Author Share Posted December 5, 2009 Yes I added the first bit of code before the "while" and uploaded the changed file. Just added that last bit of code after $extra_fields_text = '' and got a pop up message saying "products_extra_fields go=yes" 8 of the them in fact. Is that good? It means for some reason your server gives an invalid result for 'defined' what version of php do you have? replace if (defined(TABLE_PRODUCTS_EXTRA_FIELDS) && $show_extra_fields) { with [color="#000088"]if[/color] [color="#666600"]([/color]$show_extra_fields[color="#666600"])[/color] [color="#666600"]{[/color] Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 5, 2009 Share Posted December 5, 2009 It means for some reason your server gives an invalid result for 'defined' what version of php do you have? replace if (defined(TABLE_PRODUCTS_EXTRA_FIELDS) && $show_extra_fields) { with [color="#000088"]if[/color] [color="#666600"]([/color]$show_extra_fields[color="#666600"])[/color] [color="#666600"]{[/color] BINGO!! (if ($show_extra_fields) { worked. I'm running php 5.2.3 (Zend: 2.2.0) btw. Ok, on to my next problem(s) now. :lol: My multi add to cart buttons don't seem to be working. I change qtys to 1 on some items and click add qtys to cart button and the page reloads but the items don't get added to the shopping basket. Any ideas? (see here) I also need to move the qty box into the same column as the price, underneath it. Is this possible with this version manufactuer view? hard code it I mean, I don't need to change the postion of it via admin or anything. Quote Link to comment Share on other sites More sharing options...
spooks Posted December 6, 2009 Author Share Posted December 6, 2009 (edited) My multi add to cart buttons don't seem to be working. I change qtys to 1 on some items and click add qtys to cart button and the page reloads but the items don't get added to the shopping basket. Any ideas? You have failed to make changes detailed to application top. I also need to move the qty box into the same column as the price, underneath it. Is this possible with this version manufactuer view? hard code it I mean, I don't need to change the postion of it via admin or anything. I already answered this b4, see my ealier replies to you!!! (2.4.5) Edited December 6, 2009 by spooks Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2009 Share Posted December 6, 2009 My multi add to cart buttons don't seem to be working. I change qtys to 1 on some items and click add qtys to cart button and the page reloads but the items don't get added to the shopping basket. Any ideas? You have failed to make changes detailed to application top. I also need to move the qty box into the same column as the price, underneath it. Is this possible with this version manufactuer view? hard code it I mean, I don't need to change the postion of it via admin or anything. I already answered this b4, see my ealier replies to you!!! (2.4.5) If you mean this then yes I've done that: ******************************************* Open includes/application_top.php Find: (374) // customer adds a product from the products page case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; Replace with: // customer adds a product from the products page case 'add_product' : if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) { if (tep_has_product_attributes($_POST['products_id']) && PRODUCT_LIST_OPTIONS != 'true' && basename($PHP_SELF) != FILENAME_PRODUCT_INFO) tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_POST['products_id'])); $add_quantity = (isset($_POST['cart_quantity']) ? (int)$_POST['cart_quantity'] : 1); $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+$add_quantity, $_POST['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'multi buy now' button in product listings page case 'add_multi': for ($i=0; $i<=sizeof($_POST['products_id']);$i++) { if($_POST['cart_quantity'][$i]) { $px_id = $_POST['products_id'][$i]; $cart->add_cart($px_id, $cart->get_quantity(tep_get_uprid($px_id, $_POST['id'][$px_id]))+($_POST['cart_quantity'][$i]), $_POST['id'][$px_id]); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; ******************************************* However, I do have some code left over from the previous add multi items contribution i had installed that maybe causing a problem, I tried to delete it but it just kills the whole thing. Could that be cuasing the problem, or is it something else? Here my application_top file: <?php /* $Id: application_top.php,v 1.280 2003/07/12 09:38:07 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // start the timer for the page parse time log define('PAGE_PARSE_START_TIME', microtime()); // set the level of error reporting error_reporting(E_ALL & ~E_NOTICE); // check if register_globals is enabled. // since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized. if (function_exists('ini_get')) { ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!'); } // Set the local configuration parameters - mainly for developers if (file_exists('includes/local/configure.php')) include('includes/local/configure.php'); // include server parameters require('includes/configure.php'); if (strlen(DB_SERVER) < 1) { if (is_dir('install')) { header('Location: install/index.php'); } } // define the project version define('PROJECT_VERSION', 'osCommerce 2.2-MS2'); // set the type of request (secure or not) $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL'; // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; if ($request_type == 'NONSSL') { define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG); } else { define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG); } // include the list of project filenames require(DIR_WS_INCLUDES . 'filenames.php'); // include the list of project database tables require(DIR_WS_INCLUDES . 'database_tables.php'); // customization for the design layout define('BOX_WIDTH', 150); // how wide the boxes should be in pixels (default: 125) define('BOX_WIDTH_RIGHT', 125); // how wide the boxes should be in pixels (default: 125) // include the database functions require(DIR_WS_FUNCTIONS . 'database.php'); // make a connection to the database... now tep_db_connect() or die('Unable to connect to database server!'); // set the application parameters $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION); while ($configuration = tep_db_fetch_array($configuration_query)) { define($configuration['cfgKey'], $configuration['cfgValue']); } // if gzip_compression is enabled, start to buffer the output if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) { if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) { if (PHP_VERSION >= '4.0.4') { ob_start('ob_gzhandler'); } else { include(DIR_WS_FUNCTIONS . 'gzip_compression.php'); ob_start(); ob_implicit_flush(); } } else { ini_set('zlib.output_compression_level', GZIP_LEVEL); } } // set the HTTP GET parameters manually if search_engine_friendly_urls is enabled if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') { if (strlen(getenv('PATH_INFO')) > 1) { $GET_array = array(); $PHP_SELF = str_replace(getenv('PATH_INFO'), '', $PHP_SELF); $vars = explode('/', substr(getenv('PATH_INFO'), 1)); for ($i=0, $n=sizeof($vars); $i<$n; $i++) { if (strpos($vars[$i], '[]')) { $GET_array[substr($vars[$i], 0, -2)][] = $vars[$i+1]; } else { $HTTP_GET_VARS[$vars[$i]] = $vars[$i+1]; } $i++; } if (sizeof($GET_array) > 0) { while (list($key, $value) = each($GET_array)) { $HTTP_GET_VARS[$key] = $value; } } } } // define general functions used application-wide require(DIR_WS_FUNCTIONS . 'general.php'); require(DIR_WS_FUNCTIONS . 'html_output.php'); // set the cookie domain $cookie_domain = (($request_type == 'NONSSL') ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN); $cookie_path = (($request_type == 'NONSSL') ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH); // include cache functions if enabled if (USE_CACHE == 'true') include(DIR_WS_FUNCTIONS . 'cache.php'); // include shopping cart class require(DIR_WS_CLASSES . 'shopping_cart.php'); // include navigation history class require(DIR_WS_CLASSES . 'navigation_history.php'); // some code to solve compatibility issues require(DIR_WS_FUNCTIONS . 'compatibility.php'); // check if sessions are supported, otherwise use the php3 compatible session class if (!function_exists('session_start')) { define('PHP_SESSION_NAME', 'oscsid'); define('PHP_SESSION_PATH', $cookie_path); define('PHP_SESSION_DOMAIN', $cookie_domain); define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY); include(DIR_WS_CLASSES . 'sessions.php'); } // define how the session functions will be used require(DIR_WS_FUNCTIONS . 'sessions.php'); // set the session name and save path tep_session_name('oscsid'); tep_session_save_path(SESSION_WRITE_DIRECTORY); // set the session cookie parameters if (function_exists('session_set_cookie_params')) { session_set_cookie_params(0, $cookie_path, $cookie_domain); } elseif (function_exists('ini_set')) { ini_set('session.cookie_lifetime', '0'); ini_set('session.cookie_path', $cookie_path); ini_set('session.cookie_domain', $cookie_domain); } // set the session ID if it exists if (isset($HTTP_POST_VARS[tep_session_name()])) { tep_session_id($HTTP_POST_VARS[tep_session_name()]); } elseif ( ($request_type == 'SSL') && isset($HTTP_GET_VARS[tep_session_name()]) ) { tep_session_id($HTTP_GET_VARS[tep_session_name()]); } // start the session $session_started = false; if (SESSION_FORCE_COOKIE_USE == 'True') { tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain); if (isset($HTTP_COOKIE_VARS['cookie_test'])) { tep_session_start(); $session_started = true; } } elseif (SESSION_BLOCK_SPIDERS == 'True') { $user_agent = strtolower(getenv('HTTP_USER_AGENT')); $spider_flag = false; if (tep_not_null($user_agent)) { $spiders = file(DIR_WS_INCLUDES . 'spiders.txt'); for ($i=0, $n=sizeof($spiders); $i<$n; $i++) { if (tep_not_null($spiders[$i])) { if (is_integer(strpos($user_agent, trim($spiders[$i])))) { $spider_flag = true; break; } } } } if ($spider_flag == false) { tep_session_start(); $session_started = true; } } else { tep_session_start(); $session_started = true; } // set SID once, even if empty $SID = (defined('SID') ? SID : ''); include(DIR_WS_INCLUDES . 'magic_seo_url.php'); // verify the ssl_session_id if the feature is enabled if ( ($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true) ) { $ssl_session_id = getenv('SSL_SESSION_ID'); if (!tep_session_is_registered('SSL_SESSION_ID')) { $SESSION_SSL_ID = $ssl_session_id; tep_session_register('SESSION_SSL_ID'); } if ($SESSION_SSL_ID != $ssl_session_id) { tep_session_destroy(); tep_redirect(tep_href_link(FILENAME_SSL_CHECK)); } } // verify the browser user agent if the feature is enabled if (SESSION_CHECK_USER_AGENT == 'True') { $http_user_agent = getenv('HTTP_USER_AGENT'); if (!tep_session_is_registered('SESSION_USER_AGENT')) { $SESSION_USER_AGENT = $http_user_agent; tep_session_register('SESSION_USER_AGENT'); } if ($SESSION_USER_AGENT != $http_user_agent) { tep_session_destroy(); tep_redirect(tep_href_link(FILENAME_LOGIN)); } } // verify the IP address if the feature is enabled if (SESSION_CHECK_IP_ADDRESS == 'True') { $ip_address = tep_get_ip_address(); if (!tep_session_is_registered('SESSION_IP_ADDRESS')) { $SESSION_IP_ADDRESS = $ip_address; tep_session_register('SESSION_IP_ADDRESS'); } if ($SESSION_IP_ADDRESS != $ip_address) { tep_session_destroy(); tep_redirect(tep_href_link(FILENAME_LOGIN)); } } // create the shopping cart & fix the cart if necesary if (tep_session_is_registered('cart') && is_object($cart)) { if (PHP_VERSION < 4) { $broken_cart = $cart; $cart = new shoppingCart; $cart->unserialize($broken_cart); } } else { tep_session_register('cart'); $cart = new shoppingCart; } // include currencies class and create an instance require(DIR_WS_CLASSES . 'currencies.php'); $currencies = new currencies(); // include the mail classes require(DIR_WS_CLASSES . 'mime.php'); require(DIR_WS_CLASSES . 'email.php'); // set the language if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) { if (!tep_session_is_registered('language')) { tep_session_register('language'); tep_session_register('languages_id'); } include(DIR_WS_CLASSES . 'language.php'); $lng = new language(); if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) { $lng->set_language($HTTP_GET_VARS['language']); } else { $lng->get_browser_language(); } $language = $lng->language['directory']; $languages_id = $lng->language['id']; } // include the language translations require(DIR_WS_LANGUAGES . $language . '.php'); // currency if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) { if (!tep_session_is_registered('currency')) tep_session_register('currency'); if (isset($HTTP_GET_VARS['currency'])) { if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } else { $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY; } } // navigation history if (tep_session_is_registered('navigation')) { if (PHP_VERSION < 4) { $broken_navigation = $navigation; $navigation = new navigationHistory; $navigation->unserialize($broken_navigation); } } else { tep_session_register('navigation'); $navigation = new navigationHistory; } $navigation->add_current_page(); // BOF: Down for Maintenance except for admin ip if (EXCLUDE_ADMIN_IP_FOR_MAINTENANCE != getenv('REMOTE_ADDR')){ if (DOWN_FOR_MAINTENANCE=='true' and !strstr($PHP_SELF,DOWN_FOR_MAINTENANCE_FILENAME)) { tep_redirect(tep_href_link(DOWN_FOR_MAINTENANCE_FILENAME)); } } // do not let people get to down for maintenance page if not turned on if (DOWN_FOR_MAINTENANCE=='false' and strstr($PHP_SELF,DOWN_FOR_MAINTENANCE_FILENAME)) { tep_redirect(tep_href_link(FILENAME_DEFAULT)); } // EOF: WebMakers.com Added: Down for Maintenance // Shopping cart actions if (isset($HTTP_GET_VARS['action'])) { // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled if ($session_started == false) { tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE)); } if (DISPLAY_CART == 'true') { $goto = FILENAME_SHOPPING_CART; $parameters = array('action', 'cPath', 'products_id', 'pid'); } else { $goto = basename($PHP_SELF); if ($HTTP_GET_VARS['action'] == 'buy_now') { $parameters = array('action', 'pid', 'products_id'); } else { $parameters = array('action', 'pid'); } } ///////////////////////////////////////// Products Multi ////////////////////// if ($HTTP_GET_VARS['action'] == 'add_multi') { $parameters = array('action', 'pid', 'products_id'); }# ///////////////////////////////////////// Products Multi ////////////////////// switch ($HTTP_GET_VARS['action']) { ///////////////////////////////////////// Products Multi ////////////////////// // multi_product_add case 'add_multi': for ($i=0; $i<=sizeof($HTTP_POST_VARS['products_id']);$i++) { if($_POST['add_id'][$i] >= 1) $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['id'][$i]))+($HTTP_POST_VARS['add_id'][$i]), $HTTP_POST_VARS['id'][$i]); } tep_redirect(tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params($parameters), 'NONSSL')); break; ///////////////////////////////////////// Products Multi ////////////////////// // customer wants to update the product quantity in their shopping cart case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) { if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) { $cart->remove($HTTP_POST_VARS['products_id'][$i]); } else { if (PHP_VERSION < 4) { // if PHP3, make correction for lack of multidimensional array. reset($HTTP_POST_VARS); while (list($key, $value) = each($HTTP_POST_VARS)) { if (is_array($value)) { while (list($key2, $value2) = each($value)) { if (ereg ("(.*)\]\[(.*)", $key2, $var)) { $id2[$var[1]][$var[2]] = $value2; } } } } $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : ''; } else { $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : ''; } $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // customer adds a product from the products page case 'add_product' : if (isset($_POST['products_id']) && is_numeric($_POST['products_id'])) { if (tep_has_product_attributes($_POST['products_id']) && PRODUCT_LIST_OPTIONS != 'true' && basename($PHP_SELF) != FILENAME_PRODUCT_INFO) tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $_POST['products_id'])); $add_quantity = (isset($_POST['cart_quantity']) ? (int)$_POST['cart_quantity'] : 1); $cart->add_cart($_POST['products_id'], $cart->get_quantity(tep_get_uprid($_POST['products_id'], $_POST['id']))+$add_quantity, $_POST['id']); } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'multi buy now' button in product listings page case 'add_multi': for ($i=0; $i<=sizeof($_POST['products_id']);$i++) { if($_POST['cart_quantity'][$i]) { $px_id = $_POST['products_id'][$i]; $cart->add_cart($px_id, $cart->get_quantity(tep_get_uprid($px_id, $_POST['id'][$px_id]))+($_POST['cart_quantity'][$i]), $_POST['id'][$px_id]); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) { if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); } else { $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; case 'notify' : if (tep_session_is_registered('customer_id')) { if (isset($HTTP_GET_VARS['products_id'])) { $notify = $HTTP_GET_VARS['products_id']; } elseif (isset($HTTP_GET_VARS['notify'])) { $notify = $HTTP_GET_VARS['notify']; } elseif (isset($HTTP_POST_VARS['notify'])) { $notify = $HTTP_POST_VARS['notify']; } else { tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify')))); } if (!is_array($notify)) $notify = array($notify); for ($i=0, $n=sizeof($notify); $i<$n; $i++) { $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'"); $check = tep_db_fetch_array($check_query); if ($check['count'] < 1) { tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())"); } } tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify')))); } else { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } break; case 'notify_remove' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) { $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'"); $check = tep_db_fetch_array($check_query); if ($check['count'] > 0) { tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'"); } tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')))); } else { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } break; case 'cust_order' : if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) { if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid'])); } else { $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; } } // include the who's online functions // require(DIR_WS_FUNCTIONS . 'whos_online.php'); // tep_update_whos_online(); // include the who's online functions //require(DIR_WS_FUNCTIONS . 'whos_online.php'); // tep_update_whos_online(); // include the password crypto functions require(DIR_WS_FUNCTIONS . 'password_funcs.php'); // include validation functions (right now only email address) require(DIR_WS_FUNCTIONS . 'validations.php'); // split-page-results require(DIR_WS_CLASSES . 'split_page_results.php'); // Graphical Boxes require(DIR_WS_INCLUDES . 'mws_functions.php'); // infobox require(DIR_WS_CLASSES . 'boxes.php'); // auto activate and expire banners require(DIR_WS_FUNCTIONS . 'banner.php'); tep_activate_banners(); tep_expire_banners(); // auto expire special products require(DIR_WS_FUNCTIONS . 'specials.php'); tep_expire_specials(); // calculate category path if (isset($HTTP_GET_VARS['cPath'])) { $cPath = $HTTP_GET_VARS['cPath']; } elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) { $cPath = tep_get_product_path($HTTP_GET_VARS['products_id']); } else { $cPath = ''; } if (tep_not_null($cPath)) { $cPath_array = tep_parse_category_path($cPath); $cPath = implode('_', $cPath_array); $current_category_id = $cPath_array[(sizeof($cPath_array)-1)]; } else { $current_category_id = 0; } // include the breadcrumb class and start the breadcrumb trail require(DIR_WS_CLASSES . 'breadcrumb.php'); if ( ($HTTP_GET_VARS['currency']) ) { tep_session_register('kill_sid'); $kill_sid=false; } if (basename($_SERVER['HTTP_REFERER']) == 'allprods.php' ) $kill_sid = true; if ( ( !tep_session_is_registered('customer_id') ) && ( $cart->count_contents()==0 ) && (!tep_session_is_registered('kill_sid') ) ) $kill_sid = true; if ((basename($PHP_SELF) == FILENAME_LOGIN) && ($HTTP_GET_VARS['action'] == 'process') ) $kill_sid = false; if (basename($PHP_SELF) == FILENAME_CREATE_ACCOUNT_PROCESS) $kill_sid = false; // Uncomment line bellow to disable SID Killer // $kill_sid = false; $breadcrumb = new breadcrumb; $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER); // add category names or the manufacturer name to the breadcrumb trail if (isset($cPath_array)) { for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) { $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'"); if (tep_db_num_rows($categories_query) > 0) { $categories = tep_db_fetch_array($categories_query); $breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1))))); } else { break; } } } elseif (isset($HTTP_GET_VARS['manufacturers_id'])) { $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); if (tep_db_num_rows($manufacturers_query)) { $manufacturers = tep_db_fetch_array($manufacturers_query); $breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'])); } } // add the products model to the breadcrumb trail if (isset($HTTP_GET_VARS['products_id'])) { $model_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); if (tep_db_num_rows($model_query)) { $model = tep_db_fetch_array($model_query); $breadcrumb->add($model['products_name'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id'])); } } // include the articles functions require(DIR_WS_FUNCTIONS . 'articles.php'); require(DIR_WS_FUNCTIONS . 'article_header_tags.php'); // calculate topic path if (isset($HTTP_GET_VARS['tPath'])) { $tPath = $HTTP_GET_VARS['tPath']; } elseif (isset($HTTP_GET_VARS['articles_id']) && !isset($HTTP_GET_VARS['authors_id'])) { $tPath = tep_get_article_path($HTTP_GET_VARS['articles_id']); } else { $tPath = ''; } if (tep_not_null($tPath)) { $tPath_array = tep_parse_topic_path($tPath); $tPath = implode('_', $tPath_array); $current_topic_id = $tPath_array[(sizeof($tPath_array)-1)]; } else { $current_topic_id = 0; } // add topic names or the author name to the breadcrumb trail if (isset($tPath_array)) { for ($i=0, $n=sizeof($tPath_array); $i<$n; $i++) { $topics_query = tep_db_query("select topics_name from " . TABLE_TOPICS_DESCRIPTION . " where topics_id = '" . (int)$tPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'"); if (tep_db_num_rows($topics_query) > 0) { $topics = tep_db_fetch_array($topics_query); $breadcrumb->add(NAVBAR_TITLE_DEFAULT, tep_href_link(FILENAME_ARTICLES)); $breadcrumb->add($topics['topics_name'], tep_href_link(FILENAME_ARTICLES, 'tPath=' . implode('_', array_slice($tPath_array, 0, ($i+1))))); } else { break; } } } elseif (isset($HTTP_GET_VARS['authors_id'])) { $authors_query = tep_db_query("select authors_name from " . TABLE_AUTHORS . " where authors_id = '" . (int)$HTTP_GET_VARS['authors_id'] . "'"); if (tep_db_num_rows($authors_query)) { $authors = tep_db_fetch_array($authors_query); $breadcrumb->add('Articles by ' . $authors['authors_name'], tep_href_link(FILENAME_ARTICLES, 'authors_id=' . $HTTP_GET_VARS['authors_id'])); $breadcrumb->add(NAVBAR_TITLE_DEFAULT, tep_href_link(FILENAME_ARTICLES)); } } // add the articles name to the breadcrumb trail if (isset($HTTP_GET_VARS['articles_id'])) { $article_query = tep_db_query("select articles_name from " . TABLE_ARTICLES_DESCRIPTION . " where articles_id = '" . (int)$HTTP_GET_VARS['articles_id'] . "'"); if (tep_db_num_rows($article_query)) { $article = tep_db_fetch_array($article_query); if (isset($HTTP_GET_VARS['authors_id'])) { $breadcrumb->add($article['articles_name'], tep_href_link(FILENAME_ARTICLE_INFO, 'authors_id=' . $HTTP_GET_VARS['authors_id'] . '&articles_id=' . $HTTP_GET_VARS['articles_id'])); } else { $breadcrumb->add($article['articles_name'], tep_href_link(FILENAME_ARTICLE_INFO, 'tPath=' . $tPath . '&articles_id=' . $HTTP_GET_VARS['articles_id'])); } } } // initialize the message stack for output messages require(DIR_WS_CLASSES . 'message_stack.php'); $messageStack = new messageStack; // set which precautions should be checked define('WARN_INSTALL_EXISTENCE', 'true'); define('WARN_CONFIG_WRITEABLE', 'true'); define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true'); define('WARN_SESSION_AUTO_START', 'true'); define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true'); // BOF: WebMakers.com Added: Header Tags Controller v2.5.7 require(DIR_WS_FUNCTIONS . 'header_tags.php'); // Clean out HTML comments from ALT tags etc. require(DIR_WS_FUNCTIONS . 'clean_html_comments.php'); // EOF: WebMakers.com Added: Header Tags Controller v2.5.7 // faqsdesk define('DIR_WS_RSS', DIR_WS_INCLUDES . 'modules/faqdesk/rss/'); //BEGIN allcategories modification define('FILENAME_CATEGORIES', 'allcategories.php'); define('FILENAME_CATEGORIES_INFO','default.php'); //END allcategories modification // if the customer is not logged on, set the page to return to upon login if ( (basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) != FILENAME_LOGOFF) && (!strstr($PHP_SELF,'create')) && (!strstr($PHP_SELF,'popup'))) { $navigation->set_snapshot(); } # JSIB --------------------------------------# if (JS_INFOBOX=='true') { include('includes/classes/jsib.class.php'); $jsinfobox = new jsib; } #--------------------------------------------# ?> Quote Link to comment Share on other sites More sharing options...
spooks Posted December 6, 2009 Author Share Posted December 6, 2009 You must remove ///////////////////////////////////////// Products Multi ////////////////////// // multi_product_add case 'add_multi': for ($i=0; $i<=sizeof($HTTP_POST_VARS['products_id']);$i++) { if($_POST['add_id'][$i] >= 1) $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['id'][$i]))+($HTTP_POST_VARS['add_id'][$i]), $HTTP_POST_VARS['id'][$i]); } tep_redirect(tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params($parameters), 'NONSSL')); break; ///////////////////////////////////////// Products Multi ////////////////////// as thats whats failing. I was also saying use latest (2.4.5) for layout!! Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2009 Share Posted December 6, 2009 You must remove ///////////////////////////////////////// Products Multi ////////////////////// // multi_product_add case 'add_multi': for ($i=0; $i<=sizeof($HTTP_POST_VARS['products_id']);$i++) { if($_POST['add_id'][$i] >= 1) $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['id'][$i]))+($HTTP_POST_VARS['add_id'][$i]), $HTTP_POST_VARS['id'][$i]); } tep_redirect(tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params($parameters), 'NONSSL')); break; ///////////////////////////////////////// Products Multi ////////////////////// as thats whats failing. I was also saying use latest (2.4.5) for layout!! Thats great, thanks for that. "I was also saying use latest (2.4.5) for layout!!" I don't what you mean? Are you refering to moving the qty box? Quote Link to comment Share on other sites More sharing options...
spooks Posted December 6, 2009 Author Share Posted December 6, 2009 Are you refering to moving the qty box? YES Also check out the $head_title option. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2009 Share Posted December 6, 2009 I see what you mean now. Very cool! B) Thanks for all your help Sam. I'm off to bed now need sleep, laters. YES Also check out the $head_title option. Quote Link to comment Share on other sites More sharing options...
fan4chevy Posted December 6, 2009 Share Posted December 6, 2009 Hey Spooks, Have you thought of customizing the product info page such where the images are on the left, product info such as price, title, sale, etc on the left and a details tab below similar to here? http://homelightingtoday.com/product_info.php?cPath=21_112&products_id=16004 I believe it is using the contrib from here: http://addons.oscommerce.com/info/6505/v,22 I am trying to find a way to use your product listing contrib (which I like better) with the fancybox contrib you created with the info page like the ones I mentioned. I think it would be a great contribution. :blush: Thanks, Charles Quote Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2009 Share Posted December 6, 2009 I'm back again. I added some custom features to the product listing which all show up in manufacturer view but all disappear when I change to manufacturer block view. The custom features are: - price ex VAT appearing underneath the price - free delivery icon appearing underneath the qty box when the item has free delivery - high capacity/multipack icons appearing underneath the product extra fields if the product is a high capacity or a multipack or both. (see them on the site) I've obviously put the code for these features in the wrong place, I did try and find out where to put the "high capacity/multipack" code by pasting in under every instance of case 'PRODUCT_LIST_NAME': but that didn’t work. Here is my product listing with the code in places that make the features show in manufacturer view but not manufacturer block view: <?php /* $Id: product_listing.php, v 2.2 2009/11/25 22:49:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ $graphic_bord = 'no'; // set to 'yes' if you have older 'graphic borders' and not 'easy graphic borders'. $cat_path = false; // set to true to include category paths in urls $no_drop = true; // set to true to remove resuls/page & sort order drop downs $set_width = true; // set to false to allow columns to find their own widths in list mode $ttip = false; // set to true to display tool tip pics on hover $ttip_width = 200; // width of tooltip image on hover $show_extra_fields = true; // set to true if you have products_extra_fields installed & you want to display the fields in the listing $head_title = true; // Set to true so each listing entry will have its own product TITLE header (list modes only) $multi_add = true; // Set to true to enable adding mutiple items to the cart at once $global_add = 'both'; // If $multi_add = true, set position of buy button, top, bottom or both (ie the ends of the listing) $qty_drop = false;// Set to true to have a drop down for quantity box instead of a input box $last_size = 2;// set the size of the last column in block mode if (tep_not_null($HTTP_GET_VARS['sort'])) $_GET['sort'] = $HTTP_GET_VARS['sort']; $max_results = (tep_not_null($_GET['max']) ? $_GET['max'] : MAX_DISPLAY_SEARCH_RESULTS); if (PRODUCTS_PER_ROW == 'PRODUCTS_PER_ROW' || PRODUCTS_PER_ROW == 0 || LISTING_SWITCH == 'LISTING_SWITCH') { $to = 'Setup Error!\nPlease ensure you have run the\nProduct Listing Setup File.' ; print "<script>alert('$to');</script>"; } // sort order array if ($_GET['sort'] == '0d') $sort_array[] = array('id' => 0 . 'd', 'text' => DATE_ORDER); for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_MODEL . APHA_ORDER); break; case 'PRODUCT_LIST_NAME': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_PRODUCTS . APHA_ORDER); break; case 'PRODUCT_LIST_MANUFACTURER': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_MANUFACTURER . APHA_ORDER); break; case 'PRODUCT_LIST_QUANTITY': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_QUANTITY . NUM_ORDER); break; case 'PRODUCT_LIST_WEIGHT': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_WEIGHT . NUM_ORDER); break; case 'PRODUCT_LIST_PRICE': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_PRICE . NUM_ORDER); break; } } for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_MODEL . REVERSE_ALPHA_ORDER); break; case 'PRODUCT_LIST_NAME': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_PRODUCTS . REVERSE_ALPHA_ORDER); break; case 'PRODUCT_LIST_MANUFACTURER': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_MANUFACTURER . REVERSE_ALPHA_ORDER); break; case 'PRODUCT_LIST_QUANTITY': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_QUANTITY . REVERSE_NUM_ORDER); break; case 'PRODUCT_LIST_WEIGHT': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_WEIGHT . REVERSE_NUM_ORDER); break; case 'PRODUCT_LIST_PRICE': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_PRICE . REVERSE_NUM_ORDER); break; } } // Max Results Array for ($i=1; $i<10; $i++) { $max_display[] = array('id' => MAX_DISPLAY_SEARCH_RESULTS * $i, 'text' => MAX_DISPLAY_SEARCH_RESULTS * $i); } $max_display[] = array('id' => 1000000, 'text' => 'Show All'); // store GET vars $get_vars = ''; reset($_GET); while (list($key, $value) = each($_GET)) { if ( ($key != 'sort') && ($key != 'max') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) { $get_vars .= tep_draw_hidden_field($key, $value); } } $top_nav = ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3')); $base_nav = ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')); $listing_split = new splitPageResults($listing_sql, $max_results, 'p.products_id'); $data_ok = ($listing_split->number_of_rows > 0); $gbutton = ($data_ok ? tep_image_submit('button_multi_in_cart.gif', MULTI_ADD_ALT) : '') . '</div>'; $page_nav = '<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td class="smallText">' . $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS) . '</td><td class="smallText" align="right">' . TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))) . '</td></tr></table>'; $drop = $no_drop ? '' : '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="drop"><tr><td class="smallText">Results/Page: '. tep_draw_form('maxdisplay', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get') . $get_vars . (isset($_GET['sort']) ? tep_draw_hidden_field('sort', $_GET['sort']) : '') . tep_draw_pull_down_menu('max', $max_display, $_GET['max'], 'onChange="this.form.submit();"') . tep_hide_session_id().'</form></td><td class="smallText" align="right">Sort Order: ' . tep_draw_form('sorting', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get') . $get_vars . (isset($_GET['max']) ? tep_draw_hidden_field('max', $_GET['max']) : '') . tep_draw_pull_down_menu('sort', $sort_array, $_GET['sort'], 'onChange="this.form.submit();"') . tep_hide_session_id().'</form></td></tr></table>'; if ( ($listing_split->number_of_rows > (int)$max_results) && $top_nav ) echo $page_nav; if ($top_nav && $data_ok) echo '<div id="drop1">' . $drop . '</div>'; if ($multi_add) { echo tep_draw_form('cart_quantity', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_multi')); if ($global_add != 'bottom') echo '<div class="multi_buy_now" id="gbutton1">' . $gbutton; } function tep_get_category_name($category_id, $language_id) { $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "' and language_id = '" . (int)$language_id . "'"); $category = tep_db_fetch_array($category_query); return $category['categories_name']; } function tep_get_manufacturer_name($manufacturer_id) { $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturer_id . "'"); $manufacturer = tep_db_fetch_array($manufacturers_query); return $manufacturer['manufacturers_name']; } function extra_fields($products_id) { global $languages_id, $show_extra_fields; $extra_fields_text = ''; if ($show_extra_fields) { $extra_fields_query = tep_db_query("SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef, ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf WHERE ptf.products_extra_fields_id=pef.products_extra_fields_id and ptf.products_id=". (int) $products_id ." and (pef.languages_id = '0' or pef.languages_id = '".(int)$languages_id."') and ptf.products_extra_fields_value <> '' and pef.products_extra_fields_status ORDER BY pef.products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { $extra_fields_text .= '<tr><td class="smallText"><span class="xtra-field-name">' . $extra_fields['name'] . ': </span><span class="xtra-field-value">' . $extra_fields['value'] . '</span></td></tr>'; } } return $extra_fields_text; } function list_row ($listing, $column_list) { global $rows, $gborders, $list_box_contents, $cPath, $cat_path, $head_title; $list_box_contents[][] = array('text' => '<br />'); if (!$rows && $gborders) $list_box_contents = array(); $rows++; $man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : ''); $link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : '')) ) . '"' . ($man_id || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>'; if ($head_title) { $list_box_contents[][] = array('align' => 'left', 'params' => 'colspan="'.sizeof($column_list).'" class="productListing-title"', 'text' => $link . '<b>' . $listing['products_name'] . '</b></a>');} $list_box_contents[] = list_box_data($listing, $column_list, $link); $list_box_contents[][] = array('align' => 'center', 'params' => 'class="separator" colspan="'.sizeof($column_list).'"', 'text' => '<br />'); return true; } ?> <script type="text/javascript" language="javascript"> <!-- function changeValue(inObject,delta) { var myVal = parseInt(inObject.value); isNaN(myVal) ? myVal = delta : myVal = myVal + delta; inObject.value = Math.max(myVal,0); return; } // --> </script> <?php function quantity ($products_id) { global $multi_add, $qty_drop, $thumbnail_view; if (PRODUCT_LIST_QUANTITY_BOX == 'true' && strstr(LISTING_BUTTON, 'buy now')) { if (tep_has_product_attributes($products_id) && PRODUCT_LIST_OPTIONS != 'true') return false; if (!$qty_drop) return '<table cellspacing="0" cellpadding="2"><tr><td class="quantity" >' . QUANTITY . tep_draw_input_field('cart_quantity' . ($multi_add ? '[]' : '') , ($multi_add ? '0' : '1') , 'maxlength="5" size="2" id="qid'.$products_id.'"') . ($multi_add ? tep_draw_hidden_field('products_id[]', $products_id) : '') . '</td><td><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),1);">' . tep_image_button('btn_up.gif',MORE) . '</a><br><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),-1);">' . tep_image_button('btn_down.gif',LESS) . '</a></td></tr></table>'; else $qty_array = array(); $pstock = min(tep_get_products_stock($products_id),MAX_QTY_IN_CART); for ($i=0; $i<=$pstock; $i++) { $qty_array[]=array('id' => $i, 'text' => $i); } return ($pstock ? '<div class="quantity" align="' . (strstr($thumbnail_view, 'thumbnails') ? 'center' : 'right' ) .'">' . QUANTITY . tep_draw_pull_down_menu('cart_quantity'.($multi_add ? '[]' : ''),$qty_array,($multi_add ? 0 : 1)) . '<br />' . ($multi_add ? tep_draw_hidden_field('products_id[]', $products_id) : '') . '</div>' : false); } else { return false; } } function list_box_head($column_list) { global $set_width; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = 'center'; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = 'center'; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_PRICE_EX': $lc_text = TABLE_HEADING_PRICE_EX; $lc_align = 'center'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = (PRODUCT_LIST_OPTIONS == 'true' ? 'Product Options</td><td align="center" class="productListing-heading">' : '') . (strstr(LISTING_BUTTON, 'buy now')? TABLE_HEADING_BUY_NOW : TABLE_HEADING_DETAIL); $lc_align = 'center'; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($_GET['sort'], $col+1, $lc_text); } $list_box_contents[] = array('align' => $lc_align,'params' => 'class="productListing-heading" ' . ($set_width ? 'width="'.(int)(100/sizeof($column_list)) . '%"' : ''),'text' => ' ' . $lc_text . ' '); } return ($list_box_contents); } // function list_head end function list_box_data($listing, $column_list, $link) { global $PHP_SELF, $ttip, $ttip_width, $head_title, $rows, $set_width, $multi_add, $last_size; $currencies = new currencies(); $alt_text = $listing['products_name']; $image = (file_exists(DIR_WS_IMAGES . $listing['products_image']) ? $listing['products_image'] : 'no-image.jpg'); $image = '<span class="ttip">' . $link . tep_image(DIR_WS_IMAGES . $image, $alt_text, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT) . ($ttip ? tep_image(DIR_WS_IMAGES . $image, $alt_text, $ttip_width, '', 'class="large"') : '' ) . '</a></span>'; $name = (!$head_title ? $link.'<b>' . $listing['products_name'] . '</b></a>' : ' '); if (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW) { $buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif'); $quantity_box = quantity ($listing['products_id']); $form = ($multi_add ? '' : tep_draw_form('cart_quantity_' . $rows, tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_product'))); $buytable = '<table class="buytable" border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td valign="bottom" class="productListing-data">'; $buytableend = '</td></tr></table>'. ($multi_add ? '' : '</form>'); $detail = $link . tep_image_button((strstr(LISTING_BUTTON, '&') || (strstr(LISTING_BUTTON, 'small')) ? 'button_details_small.gif' : 'button_details.gif'), IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a> '; $add_cart = ($multi_add ? ($quantity_box && PRODUCT_LIST_QUANTITY_BOX == 'true' ? '' : $detail) : tep_draw_hidden_field('products_id', $listing['products_id']) . tep_image_submit($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"')); $button = (LISTING_BUTTON == 'buy now & details' ? ($add_cart == $detail ? $add_cart : $add_cart . ' <span class="buy_now">|</span> ' . $detail ) : (strstr(LISTING_BUTTON, 'buy now') ? $add_cart : $detail )); if ($listing['products_price'] == 0 || (isset($listing['products_quantity']) && !$listing['products_quantity'])) { $button = $detail; $quantity_box = '';}//'<span class="buy_now"> </span>'. } $list_box_temp = array('params' => 'class="list-block"'); if (!strstr(PRODUCT_THUMBNAIL_VIEW, 'block')) { for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; $params = 'class="productListing-data" ' . ($set_width ? 'width="'.(int)(100/sizeof($column_list)) . '%"' : '') . ' valign="top" '; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = 'center'; $lc_text = ' ' . $listing['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': $lc_align = ''; $lc_text = $name . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br /><span class="short">' . $listing['short_desc'] . '</span>' : ''); $extra_fields_text = extra_fields($listing['products_id']); if ($extra_fields_text) $lc_text .= '<br /><table>' . $extra_fields_text . '</table>'; if ($listing['products_high_capacity'] == true) { $lc_text .= '<span class="productPriceEX">' . HIGH_CAPACITY_PRODUCT . '</span>'; } else { } if ($listing['products_multi_pack'] == true) { $lc_text .= '<span class="productPriceEX">' . MULTI_PACK_PRODUCT . '</span>'; } else { } break; case 'PRODUCT_LIST_MANUFACTURER': $lc_align = 'center'; $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> '; break; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; $lc_text = '<span class="productListing-list-price">'; $price = (function_exists(display_short_price)) ? $currencies->display_short_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])); if (tep_not_null($listing['specials_new_products_price'])) { $lc_text .= '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><BR><span class="productSpecialPriceEX">(' . $currencies->display_price_ex($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>'; } else { $lc_text .= ($listing['products_price'] > 0 ? '' . $price . ' ' : ' ' . TEXT_POA). ' <br><span class="productPriceEX">(' . $currencies->display_price_ex($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>'; if (function_exists(tep_get_att_price)) $lc_text .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ; } if ($listing['products_free_shipping'] == true) { $lc_text .= '<BR>' . FREE_SHIPPING_FOR_THIS_PRODUCT2 . ''; } else { $lc_text .= '<BR>' . FREE_SHIPPING_FOR_THIS_PRODUCT3 . ''; } $lc_text .= '</span>'; break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; $lc_text = $image; break; case 'PRODUCT_LIST_BUY_NOW': if (PRODUCT_LIST_OPTIONS == 'true' ) $params = 'class="productListing-data" width="'.(int)((100/sizeof($column_list))*2).'%" colspan="2"'; $lc_align = 'center'; $button = $quantity_box . $button; $lc_text = $form . $buytable . (PRODUCT_LIST_OPTIONS == 'true' ? attribute_drop($listing['products_id'],$listing['products_tax_class_id']) . '</td><td align="center" class="productListing-data">' . $button : $button) . $buytableend; break; } $list_box_temp[] = array('align' => $lc_align, 'params' => $params, 'text' => $lc_text); } } else { if (PRODUCT_LIST_IMAGE) { $list_box_temp[] = array('align' => 'center', 'params' => 'class="productListing-data" ', 'text' => $image); } $display ='';$text = ''; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $last = (($col + $last_size + 1) > $n); $text .= ($text ? '<br />' : ''); switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $text .= $listing['products_model']; if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_NAME': $text .= $name . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br /><span class="short">' . $listing['short_desc'] . '</span>' : ''); $extra_fields_text = extra_fields($listing['products_id']); if ($extra_fields_text) $text .= '<br /><table>' . $extra_fields_text . '</table>'; if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_MANUFACTURER': $text .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>'; if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_PRICE': $text .= ($last ? '' : '<br />Price: ') . '<span class="productListing-list-price">'; $price = (function_exists(display_short_price)) ? $currencies->display_short_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])); if (tep_not_null($listing['specials_new_products_price'])) { $text .= '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>' . ($last ? '<br />' : ' ') . '<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>'; } else { $text .= ($listing['products_price'] > 0 ? '' . $price : '' . TEXT_POA); if (function_exists(tep_get_att_price)) $display .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ; } $text .= '</span>' . ($last ? '' : '<br />'); if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_QUANTITY': $text .= ($listing['products_quantity'] ? 'Stock = ' . $listing['products_quantity'] : 'Out of Stock'); if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_WEIGHT': $text .= 'Weight = ' . $listing['products_weight'].WEIGHT_ABRV . ($last ? '' : '<br />'); if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_BUY_NOW': $button = '<div align="right" width="100%">' . $quantity_box . '</div>' . ($last ? '' : ' ') . $button; $text .= $form . $buytable . (PRODUCT_LIST_OPTIONS == 'true' ? '<div ' . ($last ? 'align="right"' : 'align="left"' ) . ' width="100%">' . attribute_drop($listing['products_id'],$listing['products_tax_class_id']) . '</div>' . $button : '<br />' . $button) . $buytableend; //$display .= ($last ? '' : $text . '<br />'); if (!$last) {$display .= $text . '<br />'; $text = '';} break; } } $display .= ''; $list_box_temp[] = array('align' => 'left', 'params' => 'class="main" valign="top" ', 'text' => $display); $list_box_temp[] = array('align' => 'right', 'params' => 'class="productListing-data" valign="top" ', 'text' => $text); } return ($list_box_temp); } // function list_box_data end function attribute_drop($products_id,$tax_class_id) { global $languages_id, $multi_add; $currencies = new currencies(); $atrib_drop = ''; $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . (int)$products_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { $atrib_drop = '<table border="0" cellspacing="0" cellpadding="2" class="attributes">'; $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)$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 from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$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)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); 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($tax_class_id)) .') '; } } $atrib_drop .= '<tr><td class="attributes" >' . $products_options_name['products_options_name'] . ':' . '</td><td align="left">' . tep_draw_pull_down_menu('id' . ($multi_add ? '['. $products_id .']' : '') . '[' . $products_options_name['products_options_id'] . ']', $products_options_array) . '</td></tr>'; } $atrib_drop .= '</table>'; } return $atrib_drop; } // function attribute_drop end // set initial values $thumbnail_view = (isset($_GET['list']) ? $_GET['list'] : PRODUCT_THUMBNAIL_VIEW); $empty_list=false; if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { $title_name = tep_get_manufacturer_name($_GET['manufacturers_id']); } else { $title_name = (!$category['categories_name'] && tep_not_null($_GET['cPath']) ? tep_get_category_name(substr($_GET['cPath'], strpos($_GET['cPath'],'_')+1),$languages_id) : ''); } $grid = strstr(PRODUCT_THUMBNAIL_VIEW, 'grid'); $gborders = function_exists(mws_boxHeader);//$gborders = false; $Tborder = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : mws_boxHeader('<big>'.$title_name.'</big>')); $Tborderend = (!$gborders ? '</td></tr></table>' : mws_boxFooter ()); $border2 = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : ($graphic_bord == 'yes' ? mws_boxHeader('<big>'.$title_name.'</big>') : '')); $border2end = (!$gborders ? '</td></tr></table>' : ($graphic_bord == 'yes' ? mws_boxFooter() : '')); $list_box_empty[] = array(array('params' => 'class="productListing-data"','text' => TEXT_NO_PRODUCTS)); if (tep_not_null($_GET['categories_id']) && $current_category_id == 0) $current_category_id = $_GET['categories_id']; // output selected display if (strstr($thumbnail_view, 'thumbnails')) { //thumbnail $row = 0; $col = 0; $border = (!$grid ? '<table class="infoBoxProducts" cellpadding="2" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'" ><tr><td valign="top">' : '<br />'); $borderend = (!$grid ? '</td></tr></table>' : ''); $style = (!$grid ? 'class="smallText"' : 'class="infoBoxGrid"'); $info_box_contents = array(); if ($data_ok) { $listing_query = tep_db_query($listing_split->sql_query);} else { $listing_query = tep_db_query($listing_sql); } if (tep_db_num_rows($listing_query)) { while ($products = tep_db_fetch_array($listing_query)) { if ($row == 0) { if (!$gborders && !$grid) $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" valign="top"', 'text' => ' '); echo $Tborder;$row ++; } // build thumb $man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : ''); $link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : ''))) . '"' . ($man_id || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>'; $quantity_box = quantity ($products['products_id']); $image = (file_exists(DIR_WS_IMAGES . $products['products_image']) ? $products['products_image'] : 'no-image.jpg'); $addimages = (file_exists(DIR_WS_CLASSES . 'displayimages.php')); // Additional Images Present if ($addimages) { $image_query = tep_db_query( "SELECT ai.medium_images, ai.images_description, ai.popup_images, p.products_image_med, p.products_image_description FROM " . TABLE_ADDITIONAL_IMAGES . " ai, " . TABLE_PRODUCTS . " p WHERE ai.products_id=p.products_id and ai.products_id = '".(int)$products['products_id']."'"); $selected_image = tep_db_fetch_array($image_query); $image = ($selected_image['medium_images'] ? $selected_image['medium_images'] : ($selected_image['products_image_med'] ? $selected_image['products_image_med'] : ($selected_image['popup_images'] ? $selected_image['popup_images'] : $products['products_image']))); } $alt_text = ($addimages ? (tep_not_null($selected_image['images_description']) ? $selected_image['images_description'] : (tep_not_null($selected_image['products_image_description']) ? $selected_image['products_image_description'] : $products['products_name'])) : $products['products_name']); $image = (!$grid && $column_list[0] == 'PRODUCT_LIST_IMAGE' ? '<br />' : '') . ' <span class="ttip">' . $link . tep_image(DIR_WS_IMAGES . $image, $alt_text, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT) . ($ttip ? tep_image(DIR_WS_IMAGES . $image, $alt_text, $ttip_width, '', 'class="large"') : '' ) . '</a></span>' . '<br />'; if (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW) { $buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif'); $detail = $link . tep_image_button((strstr(LISTING_BUTTON, '&') || (strstr(LISTING_BUTTON, 'small')) ? 'button_details_small.gif' : 'button_details.gif'), IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a>'; $add_cart = ($multi_add ? ($quantity_box && PRODUCT_LIST_QUANTITY_BOX == 'true' ? '' : $detail) : tep_draw_hidden_field('products_id', $products['products_id']) . tep_image_submit($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"')); $button = (LISTING_BUTTON == 'buy now & details' ? '<br />' . $quantity_box . ($add_cart == $detail ? $add_cart : $add_cart . ' <span class="buy_now">|</span> ' . $detail . '<br /><br />') : (strstr(LISTING_BUTTON, 'buy now') ? '<br />' . $quantity_box . $add_cart . '<br /><br />' : '<br />'. $detail . '<br /><br />' )); if ($products['products_price'] == 0 || (isset($products['products_quantity']) && !$products['products_quantity'])) { $button = '<br /><span class="buy_now"> </span>'. $detail . '<br />';$quantity_box = ''; } } $name = $link . '<b>' . $products['products_name'] . '</b>' . '</a><br />'. ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br />' . $products['short_desc'] . '<br />' : ''); $price = (function_exists(display_short_price)) ? $currencies->display_short_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) : $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])); if (tep_not_null($products['specials_new_products_price'])) { $price = '<s>' . $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products['specials_new_products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</span>'; } if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($products['products_id']) > 0 ? '+' : '') ; $show_price = '<br /><font size="'.PRODUCT_PRICE_SIZE.'">' . ($products['products_price'] > 0 ? $price : TEXT_POA) . '<br /></font>'; $quantity = ($products['products_quantity'] ? 'Stock = '.$products['products_quantity'] : 'Out of Stock').'<br />'; $weight = 'Weight = '.$products['products_weight'].WEIGHT_ABRV.'<br />'; $model = $products['products_model'] . '<br />'; $manfact = '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $products['manufacturers_id']) . '">' . $products['manufacturers_name'] . '</a><br />'; $display = $border; for ($disp=0, $n=sizeof($column_list); $disp<$n; $disp++) { switch ($column_list[$disp]) { case 'PRODUCT_LIST_IMAGE': $display .= '<table summary="" width="100%" ><tr><td style="text-align:center;" valign="top" height="'.PRODUCT_IMAGE_VSPACE.'" >'.$image.'</td></tr></table>'; break; case 'PRODUCT_LIST_NAME': $display .= '<table summary="" width="100%" ><tr><td class="thumbcontent" height="'.PRODUCT_NAME_VSPACE.'" >'.$name.'</td></tr>' . extra_fields($products['products_id']) . '</table>'; break; case 'PRODUCT_LIST_MODEL': $display .= $model; break; case 'PRODUCT_LIST_MANUFACTURER': $display .= $manfact; break; case 'PRODUCT_LIST_PRICE': $display .= $show_price; break; case 'PRODUCT_LIST_QUANTITY': $display .= $quantity; break; case 'PRODUCT_LIST_WEIGHT': $display .= $weight; break; } } $form = ($multi_add ? '' : tep_draw_form('cart_quantity_' . $col . $row, tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_product'))); $display .= $borderend . $form . '<br />' . (PRODUCT_LIST_OPTIONS == 'true' ? attribute_drop($products['products_id'],$products['products_tax_class_id']) . $button : $button) . ($multi_add ? '' : '</form>'); // thumb built $info_box_contents[$row][$col] = array('align' => 'center', 'params' => $style . ' width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" valign="top"', 'text' => $display ); $col ++; if ($col > PRODUCTS_PER_ROW-1) { $col = 0; $row ++; } } // prod loop } else {$empty_list=true; }// no products!! // got display if ($row) { $i = 0 ; $nbx = class_exists(noborderBox); if ($col > 0 && $row > 1 && $nbx && !$grid) { for ($i=0, $n=$col; $i < $n; $i++) { $last_row[0][$i] = $info_box_contents[$row][$i]; unset($info_box_contents[$row][$i]); } } if (!$i) {$col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" ', 'text' => ' '); } if ($nbx) new noborderBox($info_box_contents); else new contentBox($info_box_contents); if($i) new noborderBox($last_row); echo $Tborderend; } else {$empty_list=true; } } elseif (strstr($thumbnail_view, 'manufacturer')) { //manufacturer $row = 0;$col = 0; if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { $filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and mi.languages_id = '" . (int)$languages_id . "'"); }else{ $filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' and mi.languages_id = '" . (int)$languages_id . "' order by m.manufacturers_name"); } if (tep_db_num_rows($filterlist_sql)) { $rows = 0; while ($manufacturer = tep_db_fetch_array($filterlist_sql)) { $info_box_heading = array(); if ($rows) echo tep_draw_separator('pixel_trans.gif', '100%', '4'); echo $border2; $info_box_heading[0] = array('text' => '<big>'.$manufacturer['manufacturers_name'].'</big><br />'.(MANU_DESCRIPTION == 'true' ? $manufacturer['manufacturers_description'].'<br />' : '')); new infoBoxHeading($info_box_heading, false, false); $list_box_contents = array(); $list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : ''); if ($data_ok) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query);} else { $rows = 0; $listing_query = tep_db_query($listing_sql); } while ($listing = tep_db_fetch_array($listing_query)) { if ($listing['manufacturers_id'] != $manufacturer['manufacturers_id']) continue; list_row ($listing, $column_list); } $list_box_contents[sizeof($list_box_contents)-1] = array(array('text' => '<br />')); if (!$rows && isset($_GET['manufacturers_id'])) { $rows++; $list_box_contents = $list_box_empty; $empty_list=true;} if ($rows) new productListingBox($list_box_contents); echo $border2end; } // man loop; } else {$empty_list=true; } // no manufacturers!! } if ((!strstr($thumbnail_view, 'thumbnails') && !strstr($thumbnail_view, 'manufacturer')) || $empty_list) { //default listing if (MANU_DESCRIPTION == 'true' && tep_not_null($_GET['manufacturers_id'])) { $manufacturer_query = tep_db_query("select manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)($_GET['manufacturers_id']) . "' and languages_id = '" . (int)$languages_id . "'"); $manufacturer = tep_db_fetch_array($manufacturer_query); } $info_box_heading[0] = array('text' => '<big>'.$title_name.'</big>'.($manufacturer['manufacturers_description'] ? '<br />' . $manufacturer['manufacturers_description'] : '')); $list_box_contents = array(); $list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : ''); if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($listing_query)) { list_row ($listing, $column_list); } $list_box_contents[sizeof($list_box_contents)-1] = array(array('text' => '<br />')); $empty_list = false; echo $border2; if ($title_name) new infoBoxHeading($info_box_heading, false, false); new productListingBox($list_box_contents); echo $border2end; //tep_draw_separator('pixel_trans.gif', '100%', '4'); } else { new productListingBox($list_box_empty); $empty_list=true; } } if ($multi_add) { if ($global_add != 'top') echo '<div class="multi_buy_now" id="gbutton2">' . $gbutton; echo '</form>'; } if ($base_nav && !$empty_list) echo $drop; if (($listing_split->number_of_rows > (int)$max_results) && $base_nav) echo $page_nav; if (LISTING_SWITCH != 'false' && !$empty_list) echo '<br /><span class="smalltext"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('list')). 'list='.(strstr($thumbnail_view, 'thumbnails') ? 'manufacturer' : 'thumbnails')) . '">' . (strstr($thumbnail_view, 'thumbnails') ? LIST_VIEW : THUMB_VIEW).'</a></span><br /><br />'; //echo '<hr>' . $listing_sql . '<hr>'; ?> Quote Link to comment Share on other sites More sharing options...
spooks Posted December 6, 2009 Author Share Posted December 6, 2009 The block section starts with: $last = (($col + $last_size + 1) > $n); $text .= ($text ? '<br />' : ''); switch ($column_list[$col]) { but I do't understand why you did'nt just search for $last_size since its states block mode only!! Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
Guest Posted December 6, 2009 Share Posted December 6, 2009 The block section starts with: $last = (($col + $last_size + 1) > $n); $text .= ($text ? '<br />' : ''); switch ($column_list[$col]) { but I do't understand why you did'nt just search for $last_size since its states block mode only!! i've added code for all features after where block section starts and I still get nothing in manufacturer block mode view. What I'm I doing wrong? <?php /* $Id: product_listing.php, v 2.2 2009/11/25 22:49:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ $graphic_bord = 'no'; // set to 'yes' if you have older 'graphic borders' and not 'easy graphic borders'. $cat_path = false; // set to true to include category paths in urls $no_drop = true; // set to true to remove resuls/page & sort order drop downs $set_width = true; // set to false to allow columns to find their own widths in list mode $ttip = false; // set to true to display tool tip pics on hover $ttip_width = 200; // width of tooltip image on hover $show_extra_fields = true; // set to true if you have products_extra_fields installed & you want to display the fields in the listing $head_title = true; // Set to true so each listing entry will have its own product TITLE header (list modes only) $multi_add = true; // Set to true to enable adding mutiple items to the cart at once $global_add = 'both'; // If $multi_add = true, set position of buy button, top, bottom or both (ie the ends of the listing) $qty_drop = false;// Set to true to have a drop down for quantity box instead of a input box $last_size = 2;// set the size of the last column in block mode if (tep_not_null($HTTP_GET_VARS['sort'])) $_GET['sort'] = $HTTP_GET_VARS['sort']; $max_results = (tep_not_null($_GET['max']) ? $_GET['max'] : MAX_DISPLAY_SEARCH_RESULTS); if (PRODUCTS_PER_ROW == 'PRODUCTS_PER_ROW' || PRODUCTS_PER_ROW == 0 || LISTING_SWITCH == 'LISTING_SWITCH') { $to = 'Setup Error!\nPlease ensure you have run the\nProduct Listing Setup File.' ; print "<script>alert('$to');</script>"; } // sort order array if ($_GET['sort'] == '0d') $sort_array[] = array('id' => 0 . 'd', 'text' => DATE_ORDER); for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_MODEL . APHA_ORDER); break; case 'PRODUCT_LIST_NAME': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_PRODUCTS . APHA_ORDER); break; case 'PRODUCT_LIST_MANUFACTURER': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_MANUFACTURER . APHA_ORDER); break; case 'PRODUCT_LIST_QUANTITY': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_QUANTITY . NUM_ORDER); break; case 'PRODUCT_LIST_WEIGHT': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_WEIGHT . NUM_ORDER); break; case 'PRODUCT_LIST_PRICE': $sort_array[] = array('id' => $i+1 . 'a', 'text' => TABLE_HEADING_PRICE . NUM_ORDER); break; } } for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_MODEL . REVERSE_ALPHA_ORDER); break; case 'PRODUCT_LIST_NAME': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_PRODUCTS . REVERSE_ALPHA_ORDER); break; case 'PRODUCT_LIST_MANUFACTURER': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_MANUFACTURER . REVERSE_ALPHA_ORDER); break; case 'PRODUCT_LIST_QUANTITY': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_QUANTITY . REVERSE_NUM_ORDER); break; case 'PRODUCT_LIST_WEIGHT': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_WEIGHT . REVERSE_NUM_ORDER); break; case 'PRODUCT_LIST_PRICE': $sort_array[] = array('id' => $i+1 . 'd', 'text' => TABLE_HEADING_PRICE . REVERSE_NUM_ORDER); break; } } // Max Results Array for ($i=1; $i<10; $i++) { $max_display[] = array('id' => MAX_DISPLAY_SEARCH_RESULTS * $i, 'text' => MAX_DISPLAY_SEARCH_RESULTS * $i); } $max_display[] = array('id' => 1000000, 'text' => 'Show All'); // store GET vars $get_vars = ''; reset($_GET); while (list($key, $value) = each($_GET)) { if ( ($key != 'sort') && ($key != 'max') && ($key != tep_session_name()) && ($key != 'x') && ($key != 'y') ) { $get_vars .= tep_draw_hidden_field($key, $value); } } $top_nav = ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3')); $base_nav = ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')); $listing_split = new splitPageResults($listing_sql, $max_results, 'p.products_id'); $data_ok = ($listing_split->number_of_rows > 0); $gbutton = ($data_ok ? tep_image_submit('button_multi_in_cart.gif', MULTI_ADD_ALT) : '') . '</div>'; $page_nav = '<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td class="smallText">' . $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS) . '</td><td class="smallText" align="right">' . TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))) . '</td></tr></table>'; $drop = $no_drop ? '' : '<table border="0" width="100%" cellspacing="0" cellpadding="2" class="drop"><tr><td class="smallText">Results/Page: '. tep_draw_form('maxdisplay', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get') . $get_vars . (isset($_GET['sort']) ? tep_draw_hidden_field('sort', $_GET['sort']) : '') . tep_draw_pull_down_menu('max', $max_display, $_GET['max'], 'onChange="this.form.submit();"') . tep_hide_session_id().'</form></td><td class="smallText" align="right">Sort Order: ' . tep_draw_form('sorting', tep_href_link(basename($PHP_SELF), '', $request_type, false), 'get') . $get_vars . (isset($_GET['max']) ? tep_draw_hidden_field('max', $_GET['max']) : '') . tep_draw_pull_down_menu('sort', $sort_array, $_GET['sort'], 'onChange="this.form.submit();"') . tep_hide_session_id().'</form></td></tr></table>'; if ( ($listing_split->number_of_rows > (int)$max_results) && $top_nav ) echo $page_nav; if ($top_nav && $data_ok) echo '<div id="drop1">' . $drop . '</div>'; if ($multi_add) { echo tep_draw_form('cart_quantity', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_multi')); if ($global_add != 'bottom') echo '<div class="multi_buy_now" id="gbutton1">' . $gbutton; } function tep_get_category_name($category_id, $language_id) { $category_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "' and language_id = '" . (int)$language_id . "'"); $category = tep_db_fetch_array($category_query); return $category['categories_name']; } function tep_get_manufacturer_name($manufacturer_id) { $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$manufacturer_id . "'"); $manufacturer = tep_db_fetch_array($manufacturers_query); return $manufacturer['manufacturers_name']; } function extra_fields($products_id) { global $languages_id, $show_extra_fields; $extra_fields_text = ''; if ($show_extra_fields) { $extra_fields_query = tep_db_query("SELECT pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef, ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf WHERE ptf.products_extra_fields_id=pef.products_extra_fields_id and ptf.products_id=". (int) $products_id ." and (pef.languages_id = '0' or pef.languages_id = '".(int)$languages_id."') and ptf.products_extra_fields_value <> '' and pef.products_extra_fields_status ORDER BY pef.products_extra_fields_order"); while ($extra_fields = tep_db_fetch_array($extra_fields_query)) { $extra_fields_text .= '<tr><td class="smallText"><span class="xtra-field-name">' . $extra_fields['name'] . ': </span><span class="xtra-field-value">' . $extra_fields['value'] . '</span></td></tr>'; } } return $extra_fields_text; } function list_row ($listing, $column_list) { global $rows, $gborders, $list_box_contents, $cPath, $cat_path, $head_title; $list_box_contents[][] = array('text' => '<br />'); if (!$rows && $gborders) $list_box_contents = array(); $rows++; $man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : ''); $link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : '')) ) . '"' . ($man_id || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>'; if ($head_title) { $list_box_contents[][] = array('align' => 'left', 'params' => 'colspan="'.sizeof($column_list).'" class="productListing-title"', 'text' => $link . '<b>' . $listing['products_name'] . '</b></a>');} $list_box_contents[] = list_box_data($listing, $column_list, $link); $list_box_contents[][] = array('align' => 'center', 'params' => 'class="separator" colspan="'.sizeof($column_list).'"', 'text' => '<br />'); return true; } ?> <script type="text/javascript" language="javascript"> <!-- function changeValue(inObject,delta) { var myVal = parseInt(inObject.value); isNaN(myVal) ? myVal = delta : myVal = myVal + delta; inObject.value = Math.max(myVal,0); return; } // --> </script> <?php function quantity ($products_id) { global $multi_add, $qty_drop, $thumbnail_view; if (PRODUCT_LIST_QUANTITY_BOX == 'true' && strstr(LISTING_BUTTON, 'buy now')) { if (tep_has_product_attributes($products_id) && PRODUCT_LIST_OPTIONS != 'true') return false; if (!$qty_drop) return '<table cellspacing="0" cellpadding="2"><tr><td class="quantity" >' . QUANTITY . tep_draw_input_field('cart_quantity' . ($multi_add ? '[]' : '') , ($multi_add ? '0' : '1') , 'maxlength="5" size="2" id="qid'.$products_id.'"') . ($multi_add ? tep_draw_hidden_field('products_id[]', $products_id) : '') . '</td><td><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),1);">' . tep_image_button('btn_up.gif',MORE) . '</a><br><a href="javascript:changeValue(document.getElementById(\'qid'.$products_id.'\'),-1);">' . tep_image_button('btn_down.gif',LESS) . '</a></td></tr></table>'; else $qty_array = array(); $pstock = min(tep_get_products_stock($products_id),MAX_QTY_IN_CART); for ($i=0; $i<=$pstock; $i++) { $qty_array[]=array('id' => $i, 'text' => $i); } return ($pstock ? '<div class="quantity" align="' . (strstr($thumbnail_view, 'thumbnails') ? 'center' : 'right' ) .'">' . QUANTITY . tep_draw_pull_down_menu('cart_quantity'.($multi_add ? '[]' : ''),$qty_array,($multi_add ? 0 : 1)) . '<br />' . ($multi_add ? tep_draw_hidden_field('products_id[]', $products_id) : '') . '</div>' : false); } else { return false; } } function list_box_head($column_list) { global $set_width; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = 'center'; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = 'center'; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = (PRODUCT_LIST_OPTIONS == 'true' ? 'Product Options</td><td align="center" class="productListing-heading">' : '') . (strstr(LISTING_BUTTON, 'buy now')? TABLE_HEADING_BUY_NOW : TABLE_HEADING_DETAIL); $lc_align = 'center'; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($_GET['sort'], $col+1, $lc_text); } $list_box_contents[] = array('align' => $lc_align,'params' => 'class="productListing-heading" ' . ($set_width ? 'width="'.(int)(100/sizeof($column_list)) . '%"' : ''),'text' => ' ' . $lc_text . ' '); } return ($list_box_contents); } // function list_head end function list_box_data($listing, $column_list, $link) { global $PHP_SELF, $ttip, $ttip_width, $head_title, $rows, $set_width, $multi_add, $last_size; $currencies = new currencies(); $alt_text = $listing['products_name']; $image = (file_exists(DIR_WS_IMAGES . $listing['products_image']) ? $listing['products_image'] : 'no-image.jpg'); $image = '<span class="ttip">' . $link . tep_image(DIR_WS_IMAGES . $image, $alt_text, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT) . ($ttip ? tep_image(DIR_WS_IMAGES . $image, $alt_text, $ttip_width, '', 'class="large"') : '' ) . '</a></span>'; $name = (!$head_title ? $link.'<b>' . $listing['products_name'] . '</b></a>' : ' '); if (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW) { $buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif'); $quantity_box = quantity ($listing['products_id']); $form = ($multi_add ? '' : tep_draw_form('cart_quantity_' . $rows, tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_product'))); $buytable = '<table class="buytable" border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td valign="bottom" class="productListing-data">'; $buytableend = '</td></tr></table>'. ($multi_add ? '' : '</form>'); $detail = $link . tep_image_button((strstr(LISTING_BUTTON, '&') || (strstr(LISTING_BUTTON, 'small')) ? 'button_details_small.gif' : 'button_details.gif'), IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a> '; $add_cart = ($multi_add ? ($quantity_box && PRODUCT_LIST_QUANTITY_BOX == 'true' ? '' : $detail) : tep_draw_hidden_field('products_id', $listing['products_id']) . tep_image_submit($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"')); $button = (LISTING_BUTTON == 'buy now & details' ? ($add_cart == $detail ? $add_cart : $add_cart . ' <span class="buy_now">|</span> ' . $detail ) : (strstr(LISTING_BUTTON, 'buy now') ? $add_cart : $detail )); if ($listing['products_price'] == 0 || (isset($listing['products_quantity']) && !$listing['products_quantity'])) { $button = $detail; $quantity_box = '';}//'<span class="buy_now"> </span>'. } $list_box_temp = array('params' => 'class="list-block"'); if (!strstr(PRODUCT_THUMBNAIL_VIEW, 'block')) { for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; $params = 'class="productListing-data" ' . ($set_width ? 'width="'.(int)(100/sizeof($column_list)) . '%"' : '') . ' valign="top" '; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = 'center'; $lc_text = ' ' . $listing['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': $lc_align = ''; $lc_text = $name . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br /><span class="short">' . $listing['short_desc'] . '</span>' : ''); $extra_fields_text = extra_fields($listing['products_id']); if ($extra_fields_text) $lc_text .= '<br /><table>' . $extra_fields_text . '</table>'; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_align = 'center'; $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> '; break; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; $lc_text = '<span class="productListing-list-price">'; $price = (function_exists(display_short_price)) ? $currencies->display_short_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])); if (tep_not_null($listing['specials_new_products_price'])) { $lc_text .= '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> '; } else { $lc_text .= ($listing['products_price'] > 0 ? '' . $price . ' ' : ' ' . TEXT_POA); if (function_exists(tep_get_att_price)) $lc_text .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ; } $lc_text .= '</span>'; break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; $lc_text = $image; break; case 'PRODUCT_LIST_BUY_NOW': if (PRODUCT_LIST_OPTIONS == 'true' ) $params = 'class="productListing-data" width="'.(int)((100/sizeof($column_list))*2).'%" colspan="2"'; $lc_align = 'center'; $button = $quantity_box . $button; $lc_text = $form . $buytable . (PRODUCT_LIST_OPTIONS == 'true' ? attribute_drop($listing['products_id'],$listing['products_tax_class_id']) . '</td><td align="center" class="productListing-data">' . $button : $button) . $buytableend; break; } $list_box_temp[] = array('align' => $lc_align, 'params' => $params, 'text' => $lc_text); } } else { if (PRODUCT_LIST_IMAGE) { $list_box_temp[] = array('align' => 'center', 'params' => 'class="productListing-data" ', 'text' => $image); } $display ='';$text = ''; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $last = (($col + $last_size + 1) > $n); $text .= ($text ? '<br />' : ''); switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $text .= $listing['products_model']; if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_NAME': $text .= $name . ($listing['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br /><span class="short">' . $listing['short_desc'] . '</span>' : ''); $extra_fields_text = extra_fields($listing['products_id']); if ($extra_fields_text) $text .= '<br /><table>' . $extra_fields_text . '</table>'; if (!$last) {$display .= $text . '<br />'; $text = '';} if ($listing['products_high_capacity'] == true) { $lc_text .= '<span class="productPriceEX">' . HIGH_CAPACITY_PRODUCT . '</span>'; } else { } if ($listing['products_multi_pack'] == true) { $lc_text .= '<span class="productPriceEX">' . MULTI_PACK_PRODUCT . '</span>'; } else { } break; case 'PRODUCT_LIST_MANUFACTURER': $text .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>'; if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_PRICE': $text .= ($last ? '' : '<br />Price: ') . '<span class="productListing-list-price">'; $price = (function_exists(display_short_price)) ? $currencies->display_short_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) : $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])); if (tep_not_null($listing['specials_new_products_price'])) { $text .= '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>' . ($last ? '<br />' : ' ') . '<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span><BR><span class="productSpecialPriceEX">(' . $currencies->display_price_ex($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>'; } else { $text .= ($listing['products_price'] > 0 ? '' . $price : '' . TEXT_POA). ' <br><span class="productPriceEX">(' . $currencies->display_price_ex($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ex.vat)</span><br>'; if (function_exists(tep_get_att_price)) $display .= (tep_get_att_price($listing['products_id']) > 0 ? '+' : ' ') ; } $text .= '</span>' . ($last ? '' : '<br />'); if (!$last) {$display .= $text . '<br />'; $text = '';} if ($listing['products_free_shipping'] == true) { $lc_text .= '<BR>' . FREE_SHIPPING_FOR_THIS_PRODUCT2 . ''; } else { $lc_text .= '<BR>' . FREE_SHIPPING_FOR_THIS_PRODUCT3 . ''; } break; case 'PRODUCT_LIST_QUANTITY': $text .= ($listing['products_quantity'] ? 'Stock = ' . $listing['products_quantity'] : 'Out of Stock'); if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_WEIGHT': $text .= 'Weight = ' . $listing['products_weight'].WEIGHT_ABRV . ($last ? '' : '<br />'); if (!$last) {$display .= $text . '<br />'; $text = '';} break; case 'PRODUCT_LIST_BUY_NOW': $button = '<div align="right" width="100%">' . $quantity_box . '</div>' . ($last ? '' : ' ') . $button; $text .= $form . $buytable . (PRODUCT_LIST_OPTIONS == 'true' ? '<div ' . ($last ? 'align="right"' : 'align="left"' ) . ' width="100%">' . attribute_drop($listing['products_id'],$listing['products_tax_class_id']) . '</div>' . $button : '<br />' . $button) . $buytableend; //$display .= ($last ? '' : $text . '<br />'); if (!$last) {$display .= $text . '<br />'; $text = '';} break; } } $display .= ''; $list_box_temp[] = array('align' => 'left', 'params' => 'class="main" valign="top" ', 'text' => $display); $list_box_temp[] = array('align' => 'right', 'params' => 'class="productListing-data" valign="top" ', 'text' => $text); } return ($list_box_temp); } // function list_box_data end function attribute_drop($products_id,$tax_class_id) { global $languages_id, $multi_add; $currencies = new currencies(); $atrib_drop = ''; $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id='" . (int)$products_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { $atrib_drop = '<table border="0" cellspacing="0" cellpadding="2" class="attributes">'; $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)$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 from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$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)) { $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']); 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($tax_class_id)) .') '; } } $atrib_drop .= '<tr><td class="attributes" >' . $products_options_name['products_options_name'] . ':' . '</td><td align="left">' . tep_draw_pull_down_menu('id' . ($multi_add ? '['. $products_id .']' : '') . '[' . $products_options_name['products_options_id'] . ']', $products_options_array) . '</td></tr>'; } $atrib_drop .= '</table>'; } return $atrib_drop; } // function attribute_drop end // set initial values $thumbnail_view = (isset($_GET['list']) ? $_GET['list'] : PRODUCT_THUMBNAIL_VIEW); $empty_list=false; if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { $title_name = tep_get_manufacturer_name($_GET['manufacturers_id']); } else { $title_name = (!$category['categories_name'] && tep_not_null($_GET['cPath']) ? tep_get_category_name(substr($_GET['cPath'], strpos($_GET['cPath'],'_')+1),$languages_id) : ''); } $grid = strstr(PRODUCT_THUMBNAIL_VIEW, 'grid'); $gborders = function_exists(mws_boxHeader);//$gborders = false; $Tborder = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : mws_boxHeader('<big>'.$title_name.'</big>')); $Tborderend = (!$gborders ? '</td></tr></table>' : mws_boxFooter ()); $border2 = (!$gborders ? '<table class="infoBoxList" width="100%"><tr><td>' : ($graphic_bord == 'yes' ? mws_boxHeader('<big>'.$title_name.'</big>') : '')); $border2end = (!$gborders ? '</td></tr></table>' : ($graphic_bord == 'yes' ? mws_boxFooter() : '')); $list_box_empty[] = array(array('params' => 'class="productListing-data"','text' => TEXT_NO_PRODUCTS)); if (tep_not_null($_GET['categories_id']) && $current_category_id == 0) $current_category_id = $_GET['categories_id']; // output selected display if (strstr($thumbnail_view, 'thumbnails')) { //thumbnail $row = 0; $col = 0; $border = (!$grid ? '<table class="infoBoxProducts" cellpadding="2" width="'.PRODUCT_LIST_WIDTH.'" height="'.PRODUCT_LIST_HEIGHT.'" ><tr><td valign="top">' : '<br />'); $borderend = (!$grid ? '</td></tr></table>' : ''); $style = (!$grid ? 'class="smallText"' : 'class="infoBoxGrid"'); $info_box_contents = array(); if ($data_ok) { $listing_query = tep_db_query($listing_split->sql_query);} else { $listing_query = tep_db_query($listing_sql); } if (tep_db_num_rows($listing_query)) { while ($products = tep_db_fetch_array($listing_query)) { if ($row == 0) { if (!$gborders && !$grid) $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" valign="top"', 'text' => ' '); echo $Tborder;$row ++; } // build thumb $man_id = (tep_not_null($_GET['manufacturers_id']) ? $_GET['manufacturers_id'] : ''); $link = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id'] . ($man_id ? '&manufacturers_id='.$man_id : ($cPath && $cat_path ? '&cPath=' . $cPath : ''))) . '"' . ($man_id || ($cat_path && $cat_path) ? ' rel="nofollow"' : '') . '>'; $quantity_box = quantity ($products['products_id']); $image = (file_exists(DIR_WS_IMAGES . $products['products_image']) ? $products['products_image'] : 'no-image.jpg'); $addimages = (file_exists(DIR_WS_CLASSES . 'displayimages.php')); // Additional Images Present if ($addimages) { $image_query = tep_db_query( "SELECT ai.medium_images, ai.images_description, ai.popup_images, p.products_image_med, p.products_image_description FROM " . TABLE_ADDITIONAL_IMAGES . " ai, " . TABLE_PRODUCTS . " p WHERE ai.products_id=p.products_id and ai.products_id = '".(int)$products['products_id']."'"); $selected_image = tep_db_fetch_array($image_query); $image = ($selected_image['medium_images'] ? $selected_image['medium_images'] : ($selected_image['products_image_med'] ? $selected_image['products_image_med'] : ($selected_image['popup_images'] ? $selected_image['popup_images'] : $products['products_image']))); } $alt_text = ($addimages ? (tep_not_null($selected_image['images_description']) ? $selected_image['images_description'] : (tep_not_null($selected_image['products_image_description']) ? $selected_image['products_image_description'] : $products['products_name'])) : $products['products_name']); $image = (!$grid && $column_list[0] == 'PRODUCT_LIST_IMAGE' ? '<br />' : '') . ' <span class="ttip">' . $link . tep_image(DIR_WS_IMAGES . $image, $alt_text, PRODUCT_IMAGE_WIDTH, PRODUCT_IMAGE_HEIGHT) . ($ttip ? tep_image(DIR_WS_IMAGES . $image, $alt_text, $ttip_width, '', 'class="large"') : '' ) . '</a></span>' . '<br />'; if (LISTING_BUTTON != 'none' && PRODUCT_LIST_BUY_NOW) { $buypic = (LISTING_BUTTON == 'buy now' ? 'button_in_cart.gif' : 'button_buy_now.gif'); $detail = $link . tep_image_button((strstr(LISTING_BUTTON, '&') || (strstr(LISTING_BUTTON, 'small')) ? 'button_details_small.gif' : 'button_details.gif'), IMAGE_BUTTON_DETAILS, 'class="thm_buy_now"') . '</a>'; $add_cart = ($multi_add ? ($quantity_box && PRODUCT_LIST_QUANTITY_BOX == 'true' ? '' : $detail) : tep_draw_hidden_field('products_id', $products['products_id']) . tep_image_submit($buypic, IMAGE_BUTTON_BUY_NOW, 'class="thm_buy_now"')); $button = (LISTING_BUTTON == 'buy now & details' ? '<br />' . $quantity_box . ($add_cart == $detail ? $add_cart : $add_cart . ' <span class="buy_now">|</span> ' . $detail . '<br /><br />') : (strstr(LISTING_BUTTON, 'buy now') ? '<br />' . $quantity_box . $add_cart . '<br /><br />' : '<br />'. $detail . '<br /><br />' )); if ($products['products_price'] == 0 || (isset($products['products_quantity']) && !$products['products_quantity'])) { $button = '<br /><span class="buy_now"> </span>'. $detail . '<br />';$quantity_box = ''; } } $name = $link . '<b>' . $products['products_name'] . '</b>' . '</a><br />'. ($products['short_desc'] && (PRODUCT_SHORT_DESC == 'true') ? '<br />' . $products['short_desc'] . '<br />' : ''); $price = (function_exists(display_short_price)) ? $currencies->display_short_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) : $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])); if (tep_not_null($products['specials_new_products_price'])) { $price = '<s>' . $currencies->display_price($products['products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products['specials_new_products_price'], tep_get_tax_rate($products['products_tax_class_id'])) . '</span>'; } if (function_exists(tep_get_att_price)) $price .= (tep_get_att_price($products['products_id']) > 0 ? '+' : '') ; $show_price = '<br /><font size="'.PRODUCT_PRICE_SIZE.'">' . ($products['products_price'] > 0 ? $price : TEXT_POA) . '<br /></font>'; $quantity = ($products['products_quantity'] ? 'Stock = '.$products['products_quantity'] : 'Out of Stock').'<br />'; $weight = 'Weight = '.$products['products_weight'].WEIGHT_ABRV.'<br />'; $model = $products['products_model'] . '<br />'; $manfact = '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $products['manufacturers_id']) . '">' . $products['manufacturers_name'] . '</a><br />'; $display = $border; for ($disp=0, $n=sizeof($column_list); $disp<$n; $disp++) { switch ($column_list[$disp]) { case 'PRODUCT_LIST_IMAGE': $display .= '<table summary="" width="100%" ><tr><td style="text-align:center;" valign="top" height="'.PRODUCT_IMAGE_VSPACE.'" >'.$image.'</td></tr></table>'; break; case 'PRODUCT_LIST_NAME': $display .= '<table summary="" width="100%" ><tr><td class="thumbcontent" height="'.PRODUCT_NAME_VSPACE.'" >'.$name.'</td></tr>' . extra_fields($products['products_id']) . '</table>'; break; case 'PRODUCT_LIST_MODEL': $display .= $model; break; case 'PRODUCT_LIST_MANUFACTURER': $display .= $manfact; break; case 'PRODUCT_LIST_PRICE': $display .= $show_price; break; case 'PRODUCT_LIST_QUANTITY': $display .= $quantity; break; case 'PRODUCT_LIST_WEIGHT': $display .= $weight; break; } } $form = ($multi_add ? '' : tep_draw_form('cart_quantity_' . $col . $row, tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action','products_id')) . 'action=add_product'))); $display .= $borderend . $form . '<br />' . (PRODUCT_LIST_OPTIONS == 'true' ? attribute_drop($products['products_id'],$products['products_tax_class_id']) . $button : $button) . ($multi_add ? '' : '</form>'); // thumb built $info_box_contents[$row][$col] = array('align' => 'center', 'params' => $style . ' width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" valign="top"', 'text' => $display ); $col ++; if ($col > PRODUCTS_PER_ROW-1) { $col = 0; $row ++; } } // prod loop } else {$empty_list=true; }// no products!! // got display if ($row) { $i = 0 ; $nbx = class_exists(noborderBox); if ($col > 0 && $row > 1 && $nbx && !$grid) { for ($i=0, $n=$col; $i < $n; $i++) { $last_row[0][$i] = $info_box_contents[$row][$i]; unset($info_box_contents[$row][$i]); } } if (!$i) {$col = 0;$row ++;$info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="'.(PRODUCTS_PER_ROW ? (int)(100/PRODUCTS_PER_ROW) : '').'%" ', 'text' => ' '); } if ($nbx) new noborderBox($info_box_contents); else new contentBox($info_box_contents); if($i) new noborderBox($last_row); echo $Tborderend; } else {$empty_list=true; } } elseif (strstr($thumbnail_view, 'manufacturer')) { //manufacturer $row = 0;$col = 0; if (isset($_GET['manufacturers_id']) && tep_not_null($_GET['manufacturers_id'])) { $filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where m.manufacturers_id = '" . (int)$_GET['manufacturers_id'] . "' and mi.languages_id = '" . (int)$languages_id . "'"); }else{ $filterlist_sql= tep_db_query("select distinct m.manufacturers_id, m.manufacturers_name, mi.manufacturers_description from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on m.manufacturers_id = mi.manufacturers_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' and mi.languages_id = '" . (int)$languages_id . "' order by m.manufacturers_name"); } if (tep_db_num_rows($filterlist_sql)) { $rows = 0; while ($manufacturer = tep_db_fetch_array($filterlist_sql)) { $info_box_heading = array(); if ($rows) echo tep_draw_separator('pixel_trans.gif', '100%', '4'); echo $border2; $info_box_heading[0] = array('text' => '<big>'.$manufacturer['manufacturers_name'].'</big><br />'.(MANU_DESCRIPTION == 'true' ? $manufacturer['manufacturers_description'].'<br />' : '')); new infoBoxHeading($info_box_heading, false, false); $list_box_contents = array(); $list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : ''); if ($data_ok) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query);} else { $rows = 0; $listing_query = tep_db_query($listing_sql); } while ($listing = tep_db_fetch_array($listing_query)) { if ($listing['manufacturers_id'] != $manufacturer['manufacturers_id']) continue; list_row ($listing, $column_list); } $list_box_contents[sizeof($list_box_contents)-1] = array(array('text' => '<br />')); if (!$rows && isset($_GET['manufacturers_id'])) { $rows++; $list_box_contents = $list_box_empty; $empty_list=true;} if ($rows) new productListingBox($list_box_contents); echo $border2end; } // man loop; } else {$empty_list=true; } // no manufacturers!! } if ((!strstr($thumbnail_view, 'thumbnails') && !strstr($thumbnail_view, 'manufacturer')) || $empty_list) { //default listing if (MANU_DESCRIPTION == 'true' && tep_not_null($_GET['manufacturers_id'])) { $manufacturer_query = tep_db_query("select manufacturers_description from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)($_GET['manufacturers_id']) . "' and languages_id = '" . (int)$languages_id . "'"); $manufacturer = tep_db_fetch_array($manufacturer_query); } $info_box_heading[0] = array('text' => '<big>'.$title_name.'</big>'.($manufacturer['manufacturers_description'] ? '<br />' . $manufacturer['manufacturers_description'] : '')); $list_box_contents = array(); $list_box_contents[0] = (LISTING_HEADINGS == 'true' && !strstr(PRODUCT_THUMBNAIL_VIEW, 'block') ? list_box_head($column_list) : ''); if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($listing_query)) { list_row ($listing, $column_list); } $list_box_contents[sizeof($list_box_contents)-1] = array(array('text' => '<br />')); $empty_list = false; echo $border2; if ($title_name) new infoBoxHeading($info_box_heading, false, false); new productListingBox($list_box_contents); echo $border2end; //tep_draw_separator('pixel_trans.gif', '100%', '4'); } else { new productListingBox($list_box_empty); $empty_list=true; } } if ($multi_add) { if ($global_add != 'top') echo '<div class="multi_buy_now" id="gbutton2">' . $gbutton; echo '</form>'; } if ($base_nav && !$empty_list) echo $drop; if (($listing_split->number_of_rows > (int)$max_results) && $base_nav) echo $page_nav; if (LISTING_SWITCH != 'false' && !$empty_list) echo '<br /><span class="smalltext"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('list')). 'list='.(strstr($thumbnail_view, 'thumbnails') ? 'manufacturer' : 'thumbnails')) . '">' . (strstr($thumbnail_view, 'thumbnails') ? LIST_VIEW : THUMB_VIEW).'</a></span><br /><br />'; //echo '<hr>' . $listing_sql . '<hr>'; ?> Quote Link to comment Share on other sites More sharing options...
leelee2023 Posted December 6, 2009 Share Posted December 6, 2009 Hi all, I just did a quick search of this thread but can't see to find the answer anywhere. Basically I had the MSRP (Display MSRP & Savings contrib) being displayed with my product listing, but since installing this cracking add-on... It's vanished and I can't seem to work out how to get it back again! Any help would be greatly appreciated! Cheers Quote Link to comment Share on other sites More sharing options...
spooks Posted December 6, 2009 Author Share Posted December 6, 2009 i've added code for all features after where block section starts and I still get nothing in manufacturer block mode view. What I'm I doing wrong? 2 points, please examine the code where u make your addition first, simply copy/paste rarely works as variables etc may change. your using $lc_text but that section uses $text also you need to make your addition b4 the if (!$last) {$display .= $text . '<br />'; $text = '';} as that sets whats in what column. Quote Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al. Link to comment Share on other sites More sharing options...
fan4chevy Posted December 6, 2009 Share Posted December 6, 2009 Spooks is the below something you think you might be doing in the future? Have you thought of customizing the product info page such where the images are on the left, product info such as price, title, sale, etc on the left and a details tab below similar to here? http://homelightingtoday.com/product_info.php?cPath=188_330&products_id=33971 or like this one: I believe it is using the contrib from here: http://addons.oscomm...com/info/6505/v,22 I am trying to find a way to use your product listing contrib (which I like better) with the fancybox contrib you created with the info page like the ones I mentioned. I think it would be a great contribution. :blush: Thanks, Charles Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.