GemRock Posted January 6, 2007 Share Posted January 6, 2007 A Simpler Alternative to the Header Tags Controller According to the original creator (Linda McGrath) of the popular header tags controller (HTC), htc "allows for unique Header Tags for: Title, Keywords, Description on a per page basis". Subsequent variations of htc add admin side and other features to it, but I think its aim/purpose remains the same. HTC requires modifications to the database, i.e., adds extra fields to the relevant tables, e.g., three fields to the products_description table. You can either manually enter whatever you like into the extra title, description & keyword fields, or you can run the anto fill scripts to auto-fill these 3 extra fields. In the latter case, which is more likely if you got thousands of products and you find it unbearable to figure out what should be entered for each product, these 3 extra fields will simply repeat what's already in the table, i.e., name & description of product, with the product name being repeated twice. This is not a good idea/practice from the point of view of database design because this would create large amount of redundant data in the database, especially when you have lengthy product description and/or you have a multi-lingual site. Although "every little helps", we all now know that the 'weight' the major search engines give to meta tags (except the title tag, perhaps) is generally small, if any. I am not advising you should, or otherwise, install HTC. What I am doing is offer you an alternative, which, by my judge, is much simpler but yet still allows you to achieve almost the same goal for many shop owners, so that you can make your choice. Having explained the rationale behind this tiny project, now let's get to the real thing. First, let me make it clear so that I do not waste your time reading through to the end of this post: 1. what this can do: automatically fill the title tag and the two meta tags for description and keywords for each product page by using data already exists in the database, meaning: there's no changes made to the database; 2. what it can't do: manually enter title, description & keywords for each product page. If you really fancy doing that, then this is not for you. The 3 steps modification below is based on a stock installation of osc. (the usual precausion of backing up your files before making changes applies) Step 1: Copy & paste the following into a php editor, and save it as breadcrumb_tags.php then put it under the folder: catalog/includes/classes <?php /* $Id: breadcrumb.php,v 1.3 2003/02/11 00:04:50 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce ************************************************* a modified copy the original breadcrumb class to be used in generating header tags. By GemRock ************************************************* Released under the GNU General Public License */ class breadcrumb_tags { var $_trail_tags; function breadcrumb_tags() { $this->reset(); } function reset() { $this->_trail_tags = array(); } function add($title, $link = '') { $this->_trail_tags[] = array('title' => $title, 'link' => $link); } function trail_tags($separator = ' - ') { $trail_string = ''; for ($i=0, $n=sizeof($this->_trail_tags); $i<$n; $i++) { if (isset($this->_trail[$i]['link']) && tep_not_null($this->_trail[$i]['link'])) { $trail_string .= '<a href="' . $this->_trail_tags[$i]['link'] . '" class="headerNavigation">' . $this->_trail_tags[$i]['title'] . '</a>'; } else { $trail_string .= $this->_trail_tags[$i]['title']; } if (($i+1) < $n) $trail_string .= $separator; } return $trail_string; } } ?> Step 2 It is in fact some of the data needed for the title/meta tags are already available in application_top.php. with a small changes to it, we will get all that is needed to fill the title/description/keyword tags. Open application_top.php for edit. Go to the bottom 60 lines or so of that file, look for // include the breadcrumb class and start the breadcrumb trail require(DIR_WS_CLASSES . 'breadcrumb.php'); $breadcrumb = new breadcrumb; And insert immediately after: // include the breadcrumb_tags class and start the breadcrumb_tags trail - GemRock require(DIR_WS_CLASSES . 'breadcrumb_tags.php'); $breadcrumb_tags = new breadcrumb_tags; // added code ends - GR Look for this block of code (just a few lines further down the above): // 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'])); } } And replace it with: // add category names or the manufacturer name to the breadcrumb trail // modified by GemRock for auto fill header tags 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))))); $breadcrumb_tags->add($categories['categories_name']); } 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'])); $breadcrumb_tags->add($manufacturers['manufacturers_name']); } } // modified code ended - GR Look for this block of code (just below the above block of code): // add the products model to the breadcrumb trail if (isset($HTTP_GET_VARS['products_id'])) { $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " 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_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id'])); } } Immediately after it, add: // add the products name/description for use in product info meta tag - GR if (isset($HTTP_GET_VARS['products_id'])) { $product_info_tags_query = tep_db_query("select products_name, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); if (tep_db_num_rows($product_info_tags_query)) { $product_info_tags = tep_db_fetch_array($product_info_tags_query); $breadcrumb_tags->add($product_info_tags['products_name']); } } // added code ended - GemRock Step 3 1. Open index.php (under the catalog folder) for edit: Add or replace (if you have already got them there): <title><?php echo (strlen($categories['categories_name']) > 5) ? $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?></title> <meta name="description" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(' ')); ?>"> <meta name="keywords" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(', ')); ?>"> 2. Open products_info.php (under the same folder as index.php above) for edit: Add or replace (if you have already got them there): <title><?php echo (strlen($categories['categories_name']) > 5) ? $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?></title> <meta name="description" content="<?php echo (strlen($product_info_tags['products_description']) > 10) ? strip_tags($product_info_tags['products_description']) : strip_tags($breadcrumb_tags->trail_tags(' ')); ?>"> <meta name="keywords" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(', ')); ?>"> 3. you can add/replace the title/description/keywords tags in other files that are related to products the same way as shown above. That's it! Please note that this is by no means the final product, but it would give you some ideas how it works. You probably need to make further changes to it to fit into your individual situation. For example, if you osc shop does not use the breadcrumbs for navigation, then step 1 is not needed (but you'd need to make changes accordingly). The description/keywords tags in the index page probably are empty for the code in 1 in step 3 above, so you may want to use something like this in stead: <meta name="description" content="<?php echo (strlen($product_info_tags['products_description']) > 10) ? strip_tags($product_info_tags['products_description']) : 'default description'; ?>"> <meta name="keywords" content="<?php echo (strlen($product_info_tags['products_name']) > 3) ? strip_tags($product_info_tags['products_name']) : 'default keywords'; ?>"> Good luck! If I miss something, you are welcome to point it out and post it here. If you have problem with implementing this, please post your questions here and I will do my best to see if I could help. If you'd like to see a live demo, here are two sites that implemented this alternative solution: (these are live shops, please do not make any test order, thank you.) http://www.noipublishing.com http://www.universaljewellery.co.uk Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
GemRock Posted January 7, 2007 Author Share Posted January 7, 2007 One small addition to make it work in a multi-lingual store, i.e., the product name and description tag will use the language the visitor chooses. Just replace the last block of code in step 2 above: Replace: // add the products name/description for use in product info meta tag - GR if (isset($HTTP_GET_VARS['products_id'])) { $product_info_tags_query = tep_db_query("select products_name, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); if (tep_db_num_rows($product_info_tags_query)) { $product_info_tags = tep_db_fetch_array($product_info_tags_query); $breadcrumb_tags->add($product_info_tags['products_name']); } } // added code ended - GemRock with: // add the products name/description for use in product info meta tag - GR if (isset($HTTP_GET_VARS['products_id'])) { $product_info_tags_query = tep_db_query("select products_name, products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if (tep_db_num_rows($product_info_tags_query)) { $product_info_tags = tep_db_fetch_array($product_info_tags_query); $breadcrumb_tags->add($product_info_tags['products_name']); } } // added code ended - GemRock If your osc shop use just one language, then you do not need to make the above change. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
GemRock Posted January 7, 2007 Author Share Posted January 7, 2007 another small improvement to the above. If you have lengthy product description, you might want to limit it to be shown in the description tag. How many words should there be in the description tag? Well, it depends who you ask. But I think in all cases a page long of description tag is not a good idea. So it has to be limited. Also, there may be whitespaces in the product description and this has to be taken off before adding it to the description tag. Here's how: Find this line in my second post above: $breadcrumb_tags->add($product_info_tags['products_name']); immediately after it, add: $product_info_tags['products_description'] = substr(preg_replace('/\s\s+/', ' ',(strip_tags($product_info_tags['products_description']))),0,1000); The number 1000 is the limit for the returned product description, which is about 200 words (in English). You can change this number to suit your needs. I don't think the search engines would care if there's a bloken word at the end of the description tag. Enjoy! Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
GemRock Posted January 8, 2007 Author Share Posted January 8, 2007 Please note that the number 1000 in my last post was not my recommendation for the length of the description tag. It was selected randomly as an example only. If there's such things as SEO Experts, then I am not one of them. You need to be your own site's seo expert and decide what would be the best. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
mutter Posted January 11, 2007 Share Posted January 11, 2007 Very nice, i just intalled this mod and works very good. Especially for my videogame shop. For people who have too short products names or categories. Modify the strlen values in the meta tags and titles. Thanks... Link to comment Share on other sites More sharing options...
GemRock Posted January 11, 2007 Author Share Posted January 11, 2007 Thanks for your feedback, Ruben. Yes, you are right. The strlen values of either 3 or 10 were selected randomly, you can or should change them for your shop's situation. BTW, all feedbacks, good or bad, would be welcome, as I am making it a contribution, which will take into consideration of the following 3 scenarios: Scenario 1 is for shops that do not use the breadcrumb class as a navigation tool; Scenario 2 is for shops that use the breadcrumb class as a navigation tool; Scenario 3 is for those who want to enter title tag and the two meta tags for each product manually. THis will add three extra fields to the products_description table but there won't be any fill tags function. You either enter the text manually or leave them empty (in which case the product description that has already been in the table will be used), so that there won't be any redundant/duplicate data in the table. Scenario 3 could be combined with either scenario 1 or 2. In all the 3 scenarios, there is only one file to modify, and it probably takes less than 10 minutes to install. The contribution will be released very soon, hopefully :) . Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
jonquil Posted January 11, 2007 Share Posted January 11, 2007 http://www.universaljewellery.co.uk Ken Oooh, what's the contribution or mod you used to get that cool "Click to Enlarge" effect. Need it, wannit, have to have it! (w00t) jon It's all just ones and zeros.... Link to comment Share on other sites More sharing options...
GemRock Posted January 11, 2007 Author Share Posted January 11, 2007 Oooh, what's the contribution or mod you used to get that cool "Click to Enlarge" effect. Need it, wannit, have to have it! (w00t) jon I think you are talking about the lightbox javascripts. You can find it in the contribution section - sorry I haven't got the link but it'd be easy to find it. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
mutter Posted January 15, 2007 Share Posted January 15, 2007 Hi, i noted that when i come from the manufactuers drop down menu and then enter to a product the title only show the Store name. I changed the code in the title tags in product_info.php to: <title><?php echo TITLE . ': ' . $breadcrumb_tags->trail_tags(' - '); ?></title> This way it shows the manufactuer name when a user come from the drop down menu, and when the user is normally viewing the catalog it shows the ctaeogires names. I dont know if this is optimal for SEO cause it generate differente titles if someone is navigating the site from the manufacturers drop down menu. later... Link to comment Share on other sites More sharing options...
GemRock Posted January 15, 2007 Author Share Posted January 15, 2007 ...it generate differente titles if someone is navigating the site from the manufacturers drop down menu... Generating different titles is one of the aims of all sorts of header/meta tags contributions. The beauty of the my way of implementing the meta tags is that it'd make shop owners life much easier in terms of installation and adaptation. You just showed how easy it was to adapt it your own liking. In the forthcoming release of it as a contribution, I have changed the title tag in the product_info.php to: <title><?php echo (strlen($categories['categories_name']) > 3) || (strlen($manufacturers['manufacturers_name']) > 3) ? $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?></title> That'd take care of both situations, ie, whether it is coming from selecting a category or a manufacturer. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
Guest Posted January 16, 2007 Share Posted January 16, 2007 wow, I really love http://www.universaljewellery.co.uk that looks amazing, would you mind telling me a bit about how you did it?? I am pretty new to oscommerce and the only site i have running still looks like oscommerce... How did you get the picture on the main page to change every few seconds? Link to comment Share on other sites More sharing options...
GemRock Posted January 16, 2007 Author Share Posted January 16, 2007 Hi Dave Thank you! Since this is a bit off topic for this thread, I'll pm you for that. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
zindy Posted January 18, 2007 Share Posted January 18, 2007 If I may... I got your contribution to work with STS by changing the following in includes/modules/sts_inc/general.php Look for the line: $sts->template['headertags']= "<title>" . TITLE ."</title>"; And replace with the following: #>>>> sts title + tags $sts->template['headertags']= "<title>"; $sts->template['headertags'] .= (strlen($breadcrumb_tags->trail_tags('')) > 0) ? TITLE . ' - ' . $breadcrumb_tags->trail_tags(' - ') : TITLE; $sts->template['headertags'] .= "</title>"; $sts->template['headertags'] .= "<meta name=\"description\" content=\""; $sts->template['headertags'] .= (strlen($product_info_tags['products_description']) > 10) ? strip_tags($product_info_tags['products_description']) : strip_tags($breadcrumb_tags->trail_tags(' ')); $sts->template['headertags'] .= "\"><meta name=\"keywords\" content=\""; $sts->template['headertags'] .= strip_tags($breadcrumb_tags->trail_tags(', ')); $sts->template['headertags'] .= "\">"; #>>>> For my title, I like the format shop name - categories - categories - product Not sure if that's the right way to go about it, will need to wait and see what google thinks about it. Any comments appreciated. Regards, Egor Link to comment Share on other sites More sharing options...
GemRock Posted January 18, 2007 Author Share Posted January 18, 2007 Egor: Great work! Since I do not use any sts so I could not test it on sts implementations. AS it works for you, then others who use sts could follow. One of my aims is to offer something which does not cause any compatibility issues with any contributions you may have installed. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
sky7 Posted January 18, 2007 Share Posted January 18, 2007 would it cause a problem if you had more than one contrib for header tags, such as header tags controller and the alternative plus basic tags? Link to comment Share on other sites More sharing options...
GemRock Posted January 18, 2007 Author Share Posted January 18, 2007 would it cause a problem if you had more than one contrib for header tags, such as header tags controller and the alternative plus basic tags? No, I don't think so, provided you only use one set of header tags (in fact you could only have one set title tag, description tag and keywords tag) on any one page. You either use this implementation in the header tags and leave the ones you already installed in the background if you dont want to uninstall them, or use the others. But then why you want to use more than one header tags contribs at same time on same site? Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
zindy Posted January 18, 2007 Share Posted January 18, 2007 Egor: Great work! Since I do not use any sts so I could not test it on sts implementations. AS it works for you, then others who use sts could follow. One of my aims is to offer something which does not cause any compatibility issues with any contributions you may have installed. Ken Thank you Ken, you're the one who did all the work! Nope, no compatibility problems with sts but as I said before, there's a bit of work required, sts + your contrib won't do anything on their own. Also, the title of my "contact" "conditions" "shipping" and "privacy" pages are only the shop name. I'll look into why this is happening. I want to keep the shortest title (the shop name) for the front page only (and maybe a shop description on that one). I think google gets a bit confused with multiple pages being displayed with the same title. When I sort this one out, I'll post it here. Regards, Egor Link to comment Share on other sites More sharing options...
zindy Posted January 24, 2007 Share Posted January 24, 2007 Another thing to be careful about: I got this instead of the checkout_shipping.php page: Warning: Cannot modify header information - headers already sent by (output started at /.../myshop/includes/classes/breadcrumb_tags.php:49) in /.../myshop/includes/functions/general.php on line 36 The fix? At the begining and end of breadcrumb_tags, be careful not to leave any space / return before <?php or after the final ?> This problem's been mentioned before for other modules. Cheers, Egor Link to comment Share on other sites More sharing options...
GemRock Posted January 24, 2007 Author Share Posted January 24, 2007 Thanks, Egor. :thumbsup: It happens when the code is copied & pasted into a file. I have released a contribution which can be found Here So now the breadcrumb_tags.php is included in the contribution. I am also thinking of getting rid of the file breadcrumb_tags.php as it seems it may not be needed. But for the time being, I'd leave it what it is. Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
GemRock Posted January 28, 2007 Author Share Posted January 28, 2007 Hi Zindy: Please take a look at the support thread (see my signature) to see your question has been answered there. Cheers! Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
bill110 Posted February 1, 2007 Share Posted February 1, 2007 Ken, Just to let you know The newest version dated jan 29 did not include the screenshots or the install text file. I downloaded the original then just used the new files for copy and paste. (Just in case the corrections made to the original were typos in the text file also). Thanks for the contribution! My Contributions Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly Password Protect Admin "No matter where you go....There you are" - Buccaroo Bonsai Link to comment Share on other sites More sharing options...
GemRock Posted February 1, 2007 Author Share Posted February 1, 2007 Hi Bill110 Thank you very much for making it known to everyone who might want to download the latest upload - I did realise soon after I uploaded the package, which aws a shame: correcting typos but forgot the instruction! :blush: . Reason for not uploading another one immediately is my believing that people like you are smart enough to look for the missing files in the previous uploads (not an excuse for me!), and I am thinking I will soon do another update to include a back button & links to product info pages from header tags edit, as requested by posts in the support thread, possible at the weenend. ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
Guest Posted April 5, 2007 Share Posted April 5, 2007 Ken Please could you assist me with installation of your tag controller. I am not sure where I should post step 3 & 2 to in the index/product_info pages. Add or replace (if you have already got them there): <title><?php echo (strlen($categories['categories_name']) > 5) ? $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?></title> <meta name="description" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(' ')); ?>"> <meta name="keywords" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(', ')); ?>"> Below is my index . <?php/* $Id: index.php,v 1.1 2003/06/11 17:37:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); // the following cPath references come from application_top.php $category_depth = 'top'; if (isset($cPath) && tep_not_null($cPath)) { $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $cateqories_products = tep_db_fetch_array($categories_products_query); if ($cateqories_products['total'] > 0) { $category_depth = 'products'; // display products } else { $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'"); $category_parent = tep_db_fetch_array($category_parent_query); if ($category_parent['total'] > 0) { $category_depth = 'nested'; // navigate through the categories } else { $category_depth = 'products'; // category has no products, but display the 'no products' message } } } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="767" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <?php if ($category_depth == 'nested') { $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); $category = tep_db_fetch_array($category_query); ?> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <?php if (isset($cPath) && strpos('_', $cPath)) { // check to see if there are deeper categories within the current category $category_links = array_reverse($cPath_array); for($i=0, $n=sizeof($category_links); $i<$n; $i++) { $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'"); $categories = tep_db_fetch_array($categories_query); if ($categories['total'] < 1) { // do nothing, go through the loop } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); break; // we've found the deepest category the customer is in } } } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); } $number_of_categories = tep_db_num_rows($categories_query); $rows = 0; while ($categories = tep_db_fetch_array($categories_query)) { $rows++; $cPath_new = tep_get_path($categories['categories_id']); $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%'; echo ' <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n"; if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) { echo ' </tr>' . "\n"; echo ' <tr>' . "\n"; } } // needed for the new products module shown below $new_products_category_id = $current_category_id; ?> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td> </tr> </table></td> </tr> </table></td> <?php } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) { // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) $column_list[] = $key; } $select_column_list = ''; for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, '; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name, '; break; case 'PRODUCT_LIST_QUANTITY': $select_column_list .= 'p.products_quantity, '; break; case 'PRODUCT_LIST_IMAGE': $select_column_list .= 'p.products_image, '; break; case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_weight, '; break; } } // show the products of a specified manufacturer if (isset($HTTP_GET_VARS['manufacturers_id'])) { if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only a specific category $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"; } } else { // show the products in a given categorie if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; break; } } } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); $listing_sql .= ' order by '; switch ($column_list[$sort_col-1]) { case 'PRODUCT_LIST_MODEL': $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $listing_sql .= "pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } } ?> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <?php // optional Product List Filter if (PRODUCT_LIST_FILTER > 0) { if (isset($HTTP_GET_VARS['manufacturers_id'])) { $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name"; } else { $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m 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 . "' order by m.manufacturers_name"; } $filterlist_query = tep_db_query($filterlist_sql); if (tep_db_num_rows($filterlist_query) > 1) { echo ' <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' '; if (isset($HTTP_GET_VARS['manufacturers_id'])) { echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']); $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)); } else { echo tep_draw_hidden_field('cPath', $cPath); $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)); } echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']); while ($filterlist = tep_db_fetch_array($filterlist_query)) { $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']); } echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"'); echo '</form></td>' . "\n"; } } // Get the right image for the top-right $image = DIR_WS_IMAGES . 'table_background_list.gif'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); $image = tep_db_fetch_array($image); $image = $image['manufacturers_image']; } elseif ($current_category_id) { $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $image = tep_db_fetch_array($image); $image = $image['categories_image']; } ?> <td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td> </tr> </table></td> <?php } else { // default page ?> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_default.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"><?php echo TEXT_MAIN; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td> </tr> <?php include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS); ?> </table></td> </tr> </table></td> <?php } ?> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- PayPal Logo --><table border="0" cellpadding="10" cellspacing="0" align="center"><tr><td align="center"></td></tr> <tr><td align="center"><a href="#" onclick="java script:window.open('https://www.paypal.com/uk/cgi-bin/webscr?cmd=xpt/cps/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');"><img src="https://www.paypal.com/en_GB/i/bnr/horizontal_solution_PP.gif" border="0" alt="Solution Graphics"></a></td></tr></table><!-- PayPal Logo --> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> and product_info scripts. which need this code inserting: <title><?php echo (strlen($categories['categories_name']) > 5) ? $breadcrumb_tags->trail_tags(' ') . ' - ' . TITLE : TITLE; ?></title> <meta name="description" content="<?php echo (strlen($product_info_tags['products_description']) > 10) ? strip_tags($product_info_tags['products_description']) : strip_tags($breadcrumb_tags->trail_tags(' ')); ?>"> <meta name="keywords" content="<?php echo strip_tags($breadcrumb_tags->trail_tags(', ')); ?>"> <?php/* $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_check = tep_db_fetch_array($product_check_query); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <script language="javascript"><!-- function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le ft=150') } //--></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <?php if ($product_check['total'] < 1) { ?> <tr> <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } else { $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product_info = tep_db_fetch_array($product_info_query); tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading" valign="top"><?php echo $products_name; ?></td> <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"> <?php if (tep_not_null($product_info['products_image'])) { ?> <table border="0" cellspacing="0" cellpadding="2" align="right"> <tr> <td align="center" class="smallText"> <script language="javascript"><!-- document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>'); //--></script> <noscript> <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?> </noscript> </td> </tr> </table> <?php } ?> <p><?php echo stripslashes($product_info['products_description']); ?></p> <?php $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { ?> <table border="0" cellspacing="0" cellpadding="2"> <tr> <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td> </tr> <?php $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name"); while ($products_options_name = tep_db_fetch_array($products_options_name_query)) { $products_options_array = array(); $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options = tep_db_fetch_array($products_options_query)) { $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($product_info['products_tax_class_id'])) .') '; } } if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) { $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']]; } else { $selected_attribute = false; } ?> <tr> <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td> <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td> </tr> <?php } ?> </table> <?php } ?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'"); $reviews = tep_db_fetch_array($reviews_query); if ($reviews['count'] > 0) { ?> <tr> <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if (tep_not_null($product_info['products_url'])) { ?> <tr> <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> <?php } else { ?> <tr> <!-- <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td> //--> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main"><?php echo// '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td> <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td> <?php if ((USE_CACHE == 'true') && empty($SID)) { echo tep_cache_also_purchased(3600); } else { include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); } } ?> </td> </tr> </table></form></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Hoping you can assist. Peter Link to comment Share on other sites More sharing options...
GemRock Posted April 25, 2007 Author Share Posted April 25, 2007 Hi All Please note that I no longer follow this thread as there is an 'official' support thread for my header tag contribution, which can be found here, so please do not post any question here regarding my contribution. Peter: sorry as explained above I did not know you had a question/problem RE the contribution. I hope by now you'd have got it resolved. If not or if you have any further question please post them to the support thread. Thank you! Ken commercial support - unProtected channel, not to be confused with the forum with same name - open to everyone who need some professional help: either PM/email me, or go to my website (URL can be found in my profile). over 20 years of computer programming experience. Link to comment Share on other sites More sharing options...
proulout Posted July 29, 2007 Share Posted July 29, 2007 Hello there, I am trying to understand how to implement this excellent meta tag generator from Gemrock in my website. On the website, I don't use the table "products" but have added a table "hotels" and "hotels_descriptions". I have tried to put Gemrock's code, but all descriptions and tags are filled with nothing, except title which is "Initule" for each page. How can I modify Gemrock's code to make this work properly? :blush: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.