tresudek Posted January 16, 2010 Posted January 16, 2010 A client has a cart built on oscommerce that is a wreck. I am trying to patch things up until I can start from scratch and build a new site. I have managed to work my way through the templating pretty reasonably but I can't figure out how to make something only display on the homepage. I am accustomed to systems that have page conditionals to check but I haven't been able to find anything like that in oscommerce. Anyone know how to make an image display only on the homepage? Thanks everyone, TR
♥mdtaylorlrim Posted January 16, 2010 Posted January 16, 2010 A client has a cart built on oscommerce that is a wreck. I am trying to patch things up until I can start from scratch and build a new site. I have managed to work my way through the templating pretty reasonably but I can't figure out how to make something only display on the homepage. I am accustomed to systems that have page conditionals to check but I haven't been able to find anything like that in oscommerce. Anyone know how to make an image display only on the homepage? Thanks everyone, TR Partly depends on where osC is installed. Is the url to your store www.mydomain.com/catalog or www.mydomain.com? If it is at .../catalog then your 'home' page is actually not a part of osC and is at www.mydomain.com/index.xxx If it is at www.mydomain.com then you will look in the index.php about 3/4 of the way down you will find the code: } else { // default What follows that is what is displayed as the 'home' page. Community Bootstrap Edition, Edge Avoid the most asked question. See How to Secure My Site and How do I...?
tresudek Posted January 16, 2010 Author Posted January 16, 2010 Partly depends on where osC is installed. Is the url to your store www.mydomain.com/catalog or www.mydomain.com? If it is at .../catalog then your 'home' page is actually not a part of osC and is at www.mydomain.com/index.xxx If it is at www.mydomain.com then you will look in the index.php about 3/4 of the way down you will find the code: } else { // default What follows that is what is displayed as the 'home' page. Thanks - I saw that and it makes sense although that section doesn't seem to effect anything (as far as I can tell). The site is installed at the root and uses index.php. Isn't there a way to check what page you are on in oscommerce? Something like if($page=='home') or something like that? Thanks, TR
satish Posted January 16, 2010 Posted January 16, 2010 $category_depth = 'top'; So the variable $category_depth and its value will let You know if You are on Home page or not. Use that logic. Satish Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
tresudek Posted January 16, 2010 Author Posted January 16, 2010 This must be some wacky installation. I echo'ed the value of $category_depth and I get "nested" on the homepage.
Jack_mcs Posted January 16, 2010 Posted January 16, 2010 I've seen a number of shops where programmers have changed the code on the index page so that it load the categories by default. That's the wrong way to do it but it works. It causes the kind of problem you are facing though. You might want to download a fresh pacakge and compare your index file with the fresh one. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
tresudek Posted January 16, 2010 Author Posted January 16, 2010 Thanks - Yeah, this must have been a hack-y installation. I found a solution for my situation which may be helpful to anyone else in this situation. if (isset($cPath) && strpos($cPath, '_')) { // Insert item for product pages } else { if($category_depth == 'nested'){ // Insert item that should ONLY be on the homepage } else { // Insert item for non-product pages } } Thanks everyone, TR
♥FWR Media Posted January 16, 2010 Posted January 16, 2010 Thanks - Yeah, this must have been a hack-y installation. I found a solution for my situation which may be helpful to anyone else in this situation. if (isset($cPath) && strpos($cPath, '_')) { // Insert item for product pages } else { if($category_depth == 'nested'){ // Insert item that should ONLY be on the homepage } else { // Insert item for non-product pages } } Thanks everyone, TR That's not actually correct cPath can have underscores but not be listing products it could be another depth of categories. index.php has 3 levels as detailed below: - if ($category_depth == 'nested') { // these are nested categories } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) { // These are listing the products from a category or a manufacturer } else { // This is the standard index.php entry page } Hope that helps. Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls KissMT Dynamic SEO Meta & Canonical Header Tags KissER Error Handling and Debugging KissIT Image Thumbnailer Security Pro - Querystring protection against hackers ( a KISS contribution ) If you found my post useful please click the "Like This" button to the right. Please only PM me for paid work.
burt Posted January 17, 2010 Posted January 17, 2010 switch ($category_depth) { case "nested": // more categories break; case "top": // index page break; default: // could be manufacturers // could be products } Off the top of my head, haven't tested.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.