Guest Posted November 9, 2005 Share Posted November 9, 2005 First and foremost, I can't say enough about the oscommerce community- I've found so many answers here that I myself have been able to answer a few questions for others. (Don't get too excited, I know nothing of .php other than how to *somewhat* hack it togther!) That being said, I'm quite sure I'm missing something very simple for my 'modded' header found at: 9to5life.com. Basically what I wanted is to be able to associate category images and page images (also those found on login page, checkout, etc.) into the custom design I have. It's a huge space, but anyway, I *thought* I had this one figured out by pulling code from the index page and shuffling it into the header. Header code is below. If you'll notice on the site, going into a t-shirt category works fine, but any other page does not show up. The code links to "images/". It looks like the "non-category" pages have the images hard-coded. (i.e. table_background_login.gif) Is this the case, and if so, am I screwed? I could have sworn I saw this done, but with smaller images. Thanks in advance; here's the code I promised: <?php /* $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ // check if the 'install' directory exists, and warn of its existence if (WARN_INSTALL_EXISTENCE == 'true') { if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) { $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning'); } } // check if the configure.php file is writeable if (WARN_CONFIG_WRITEABLE == 'true') { if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) { $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning'); } } // check if the session folder is writeable if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') { if (STORE_SESSIONS == '') { if (!is_dir(tep_session_save_path())) { $messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning'); } elseif (!is_writeable(tep_session_save_path())) { $messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning'); } } } // check session.auto_start is disabled if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) { if (ini_get('session.auto_start') == '1') { $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning'); } } if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) { if (!is_dir(DIR_FS_DOWNLOAD)) { $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning'); } } if ($messageStack->size('header') > 0) { echo $messageStack->output('header'); } ?> <?php // Get the right image for the Category $image = DIR_WS_IMAGES . 'table_background_list.gif'; if ($HTTP_GET_VARS['manufacturers_id']) { $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . $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 = '" . $current_category_id . "'"); $image = tep_db_fetch_array($image); $image = $image['categories_image']; } // END EXTRA CODE ?> <table width="785" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="3"><img src="../images/header.gif" width="785" height="122" border="0" usemap="#Map"></td> </tr> <tr> <td background="../images/left_tile.gif"><img src="../images/spacer.gif" width="19" height="19"></td> <td valign="top"><table width="747" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> <tr> <td valign="top" bgcolor="#66CC00"><table border="0" width="100%" cellspacing="0" cellpadding="1"> <tr class="headerNavigation"> <td class="headerNavigation"> <?php echo $breadcrumb->trail(' » '); ?></td> <td align="right" class="headerNavigation"> | <?php if ((tep_session_is_registered('customer_id')) && (!tep_session_is_registered('noaccount'))) // DDB - PWA - 040622 - no display of logoff for PWA customers { ?> <a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?> </a> | <?php } ?> <?php if (!tep_session_is_registered('noaccount')) // DDB - PWA - 040622 - no display of account for PWA customers { ?> <a href="<?php echo tep_href_link(FILENAME_ACCOUNT, 'my_account_f=1', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?> </a> | <?php } ?> <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?> | </a></td> </tr> </table></td> </tr> </table></td> <td background="../images/right_tile.gif"><img src="../images/spacer.gif" width="19" height="19"></td> </tr> </table> <?php if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) { ?> <table width="763" border="0" align="center" cellpadding="2" cellspacing="0"> <tr class="headerError"> <td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td> </tr> </table> <?php } if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) { ?> <table width="785" align="center"border="0" cellspacing="0" cellpadding="0"> <tr> <td width="20" background="images/left_tile.gif"><img src="images/spacer.gif" width="20" height="20"></td> <td width="743"><table width="743" border="0" align="center" cellpadding="2" cellspacing="0"> <tr class="headerInfo"> <td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td> </tr> </table></td> <td width="20" background="images/right_tile.gif"><img src="images/spacer.gif" width="20" height="20"></td> </tr> </table> <?php } ?> Link to comment Share on other sites More sharing options...
Wendy James Posted November 9, 2005 Share Posted November 9, 2005 They are hard coded in there for the pages other than the index/category pages. Not sure why you would say screwed cause you're not. :) One thing you could do is move that part of the header into the main pages. A bit of work, but then you won't have to try and figure out a different way to get images there. You can move the image and the navigation/my account table to the body of the page and it will not mess anything up. I am always having to do things like that depending on how a site needs to look. I would also suggest using the banner manager for the index front page and the other pages (all of the ones you do not have specific images for). This way no hard linking and you get lots of exposure there so you could push certain items, sales... or just have an interesting greeting there. Hope this gives you an idea. :) Wendy James Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep. Link to comment Share on other sites More sharing options...
Guest Posted November 9, 2005 Share Posted November 9, 2005 They are hard coded in there for the pages other than the index/category pages. Not sure why you would say screwed cause you're not. :) One thing you could do is move that part of the header into the main pages. A bit of work, but then you won't have to try and figure out a different way to get images there. You can move the image and the navigation/my account table to the body of the page and it will not mess anything up. I am always having to do things like that depending on how a site needs to look. I would also suggest using the banner manager for the index front page and the other pages (all of the ones you do not have specific images for). This way no hard linking and you get lots of exposure there so you could push certain items, sales... or just have an interesting greeting there. Hope this gives you an idea. :) Thanks for the Response; I guess I'm still a little confused. First, I'd love to go the banner manager route as it would alleviate a lot of things, but we have a completely different plan for that. Soooo..... If I move the index page content to the header (assuming I'm adept enough to do that without *breaking*anything!) I am to assume I would just rename (or better yet) replace the existing images with mine, right? This unfortunately sounds like it would mean editing every single page and removing the duplicate code. ugh! I'm thinking I'm still in the *screwed* category, at least for time... Do you know of a contrib. that might let me do a "page-specific" header like this? Thanks again for your time, -D Link to comment Share on other sites More sharing options...
dandelion Posted November 9, 2005 Share Posted November 9, 2005 Do you have fireworks and dreamweaver? If you do just create the top header banner in fireworks. And slice it into different images. Add behaviour links to the slices that you want to link to different pages index.php about_us.php etc.... export this with html and images open your header.php file in dreamweaver open your header.html file that fireworks created in dreamweaver and copy this code and paste into header.php and dreaweaver with blend the codes - very cool. Done Link to comment Share on other sites More sharing options...
Mediajuggle Posted November 9, 2005 Share Posted November 9, 2005 nice design by the way, thought the text is off when viewed through Safari on a Mac My Contribution Music Download Store Template http://www.oscommerce.com/community/contributions,4275 Link to comment Share on other sites More sharing options...
Guest Posted November 11, 2005 Share Posted November 11, 2005 Thanks for the responses.... Yes, building my own header was my first thought, and I know how to setup for specific pages, but I don't know how to incorporate the 'behaviors' with the prodcut category pages... Do you have an example of this? Is it using the "cPath=X" part of the URL that can accomplish this? nice design by the way, thought the text is off when viewed through Safari on a Mac Safari has always been a problem for me when designing... Nothing seems to work in it... What text specifically is off? My header code is very staright-forward html, and basically everything else is straight from osc, which I assumed was fairly compatible with most browsers... (If you're referring to the 'shopping cart' module on the right, I'm working on that problem. Shows up funky on all browsers.) Thanks for all your input folks, and I hope to have this running soon.... BTW, when I'm finished, I'm hoping to "reskin" (as my client wouldn't like this copied all over other sites) this as an osc template so people can put together something similar. (And it's great for me to have a 'standardized' kind of deal for other clients...) -D Link to comment Share on other sites More sharing options...
Guest Posted November 11, 2005 Share Posted November 11, 2005 OK, frustration setting in; I apologize for milking this question... So I tried moving the header area just below the tabs (where the 'big banner image' is supposed to go) as well as breadcrumbs onto the page, so that each page can still keep it's precious image hard-coding. ugh. Now I have the opposite result. The login.php page was my guinea pig and it works fine. (Not the image I want yet, but it works!) The problem is that index.php page is such a mess that I can't simply use the same code and have it show on the category pages.... The main page is 3 columns and it determines which areas need to load in depending on page, right? So if I simply put that area where the NEW image is supposed to go in the are that exists now for loading category images, the right column is to the right of the WHOLE deal. I need the right column and all information to be BELOW that main long image. If you look at a category now (http://www.9to5life.com/index.php?cPath=1) you'll see what I mean. The login page (login.php) is fine, which tells me if I duplicate that process about 80 times (jeez) for the rest of the 'static' pages, I can get the desired results, but the dynamically created category pages are then screwed. I tried playing with the index.php page since I know that's where this is going to end up at, but it just doesn't want to cooperate. I either get duplaicate images or I get broken image links.... I'm getting more lost now.... Which means desperate! LOL! If I can't figure this one out does anyone know of a good source to get someone (paid) to fix this problem for me? (I'd prefer to fix it myself, but...) I'd like to stay away from freelance bidding sites only because this is too small for something like that and I'm sort of coming down to the wire which leaves no time for my project to be stuck in a bidding war.... lol. Thanks again ! -D Link to comment Share on other sites More sharing options...
Guest Posted November 11, 2005 Share Posted November 11, 2005 UPDATE: FINISHED *ENOUGH* Well, I'm really not happy with my 'coding' results, but it's going to get the job done. (I think) Please let me know if this is going to potentially cause any problems: The header has a duplicate statement from the home page: <?php if ($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, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id 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, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id 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, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id 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, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id 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; } } ?> Which then loads my custom table that contains a left column graphic, right column graphic, and the middle "category" graphic loaded from the tep_image command. Directly under this is the breadcrumb. I'm then going to hardcode on EACH AND EVERY NON-CATEGORY PAGE this same custom table with the image name also hardcoded. This should then let me get one little custom image on each page. This sucks. I've never worked with OSC outside of the "standard" design layout; typically just changing buttons and such. I don't think I'll ever do it again, at least not until my .php skills are seriously upgraded, which is sad. I think something like this should be a bit more intuitive. 99% of the site is "standard" osc. What did I have to do all of this? Well, if I knew how to properly re-build/code the index.php page, I probably wouldn't have had to, but the way that page is put together is a designer's nightmare. Essentially, I was able to tweak things in there to get the layout I wanted, BUT the problem was that no matter how I designed my layout, the right column (I removed my left) would always "wrap" around the outside of the layout. This means my single long graphic would always be to the left of the shopping cart and would essentially chew up my layout. As I'm not a php developer, I don't know how to "keep" the bits of code that 1.) do the "if/else if" statements to determine which areas are loaded, and 2.) get those areas that are loaded to have the column_right page start only AFTER (below) a particular table. The entire table (which contains 3 other tables, only one of which is loaded, depending on content) has a final <td> wrapping EVERYTHING... I've outlined my problems for those out there that are looking to do a similar layout... Put simply DON'T! Use a system that was recommended above (providing you understand how to do it) such as the Fireworks/Dreamweaver scenario. (Unfortunately I use notepad more than Dreamweaver, so I'm really not versed in that prog.) I really appreciate everyone that tried to help me out on this. Ultimately I did a "hack" because (IMO) you need to be very skilled in programming to go even slightly 'outside the box' with OSC design.... Thanks, -D Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.