Guest Posted October 18, 2006 Share Posted October 18, 2006 Support Thread for "Sub Category Description on Selected Categories" Contribution This contribution, is designed to insert a customiseable short description into a selected sub category. Only one file requires modifying, a small piece of code inserted into catalog/index.php. The contribution uses an an IF Command, e.g IF subcategory_ID = 25 then print "Hello" Demo: http://www.almat-computers.co.uk/index.php/cPath/28 Download package includes a screenshot of contribution also. Download Contrib: http://www.oscommerce.com/community/contributions,4608 Quote Link to comment Share on other sites More sharing options...
shaytaan Posted October 18, 2006 Share Posted October 18, 2006 (edited) Support Thread for "Sub Category Description on Selected Categories" Contribution This contribution, is designed to insert a customiseable short description into a selected sub category. Only one file requires modifying, a small piece of code inserted into catalog/index.php. The contribution uses an an IF Command, e.g IF subcategory_ID = 25 then print "Hello" Demo: http://www.almat-computers.co.uk/index.php/cPath/28 Download package includes a screenshot of contribution also. Download Contrib: http://www.oscommerce.com/community/contributions,4608 Well done :thumbsup: very usefull contribution for ads or info/picture for categories :) Actualy we can add anything inside that if statement :) Is it possible to make it work for manufacturers and subcategories too? I made something like this but it's not working for manufacturers <?php $lewandert_query = tep_db_query("select c.manufacturers_id from " . TABLE_MANUFACTURERS . " c, " . TABLE_MANUFACTURERS_INFO . " cd where c.manufacturers_id = '" . (int)$current_manufacturers_id . "' and cd.manufacturers_id = '" . (int)$current_manufacturers_id . "' and cd.manufacturers_id = '" . (int)$manufacturers_id . "'"); $lewandert = tep_db_fetch_array($lewandert_query); ?> <?php if ($lewandert['manufacturers_id'] == '9') picture/text/info { ?> ?> thanks Edited October 18, 2006 by shaytaan Quote ?,???`???,?? God must love stupid people, he made so many ??,???`???,? Link to comment Share on other sites More sharing options...
Guest Posted October 20, 2006 Share Posted October 20, 2006 Sorry for late reply, I would try the following code, insert roughly in the same area, before the call for Products_listing --- <?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?> (not tested) <?php $manu_query = tep_db_query("select manufacturers_id from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); $manu = tep_db_fetch_array($manu_query); ?> <?php if ($manu['manufacturers_id'] == '2') { ?> <tr><td>Insert Text Here</td></tr> <?php } ?> Quote Link to comment Share on other sites More sharing options...
shaytaan Posted October 23, 2006 Share Posted October 23, 2006 Sorry for late reply, I would try the following code, insert roughly in the same area, before the call for Products_listing --- <?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?> (not tested) <?php $manu_query = tep_db_query("select manufacturers_id from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); $manu = tep_db_fetch_array($manu_query); ?> <?php if ($manu['manufacturers_id'] == '2') { ?> <tr><td>Insert Text Here</td></tr> <?php } ?> Thanks for your time, but it's not showing anything up :( Quote ?,???`???,?? God must love stupid people, he made so many ??,???`???,? Link to comment Share on other sites More sharing options...
Guest Posted November 10, 2006 Share Posted November 10, 2006 Thanks for the contribution, Stuart - it's the snippet of code that I've been looking for. However, for some reason it doesn't seem to be working for me. In your installation guide, you suggest that the category URL will look something like: http://www.almat-computers.co.uk/index.php/cPath/28 Where as my category path URL looks like this: http://www.mydomain.com/index.php?cPath=21 I've changed the <?php if ($text['categories_id'] == '28') { ?> to '21', but I still just get the listing on the categories page, nothing else. Any ideas? Thanks for your help! Quote Link to comment Share on other sites More sharing options...
Guest Posted November 10, 2006 Share Posted November 10, 2006 can you post a few lines before and after on your index.php file and also a url so I can see if theres a problem, its a very simple contrib and should work, do you have any other contribs installed on your index.php file? Stuart Quote Link to comment Share on other sites More sharing options...
Guest Posted November 10, 2006 Share Posted November 10, 2006 can you post a few lines before and after on your index.php file and also a url so I can see if theres a problem, its a very simple contrib and should work, do you have any other contribs installed on your index.php file? Stuart Wow! Thanks for the speedy response! I'd love to be able to give you access to the URL, but it's currently password protected and the guy I'm doing this for wants it to stay that way - sorry to be annoying. Here's above, including and below the script anyhow: // 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"></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $text_query = tep_db_query("select c.categories_id 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 . "'"); $text = tep_db_fetch_array($text_query); ?> <?php if ($text['categories_id'] == '21') { ?> <tr> <td>Technology for the home content should go here<br> <br></td></tr> <?php } ?> <?php if ($text['categories_id'] == '22') { ?> <tr> <td>Professional, commercial content should go here<b></b><br> <br></td></tr> <?php } ?> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td> </tr> </table></td> <?php } else { // default page ?> Thanks again for your time and help! :D Quote Link to comment Share on other sites More sharing options...
Guest Posted November 10, 2006 Share Posted November 10, 2006 Will have a look and see what I can come up with. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 10, 2006 Share Posted November 10, 2006 Nope, can you PM or post your full index.php file and will try it with your coding Quote Link to comment Share on other sites More sharing options...
Onkel Sid Posted November 10, 2006 Share Posted November 10, 2006 Thanks for a great contib. I have been looking everywhere for something like this. I am a beginner to osCommerce/PHP and this is my first post on the forum. My question: How can i change the font in the Sub Category Description ? I use Verdana, Arial, sans-serif; font-size: 10px in my stylesheet, but this contrib looks like Times 12 or something. Do i edit inside the script or in the stylesheet? And how? Any ideas... Quote Link to comment Share on other sites More sharing options...
Guest Posted November 13, 2006 Share Posted November 13, 2006 Onkel, To save Stuart some trouble, i'll try and explain. All you need to do is define the style class in the individual cells, ie. if your stylesheet class was 'main', it would look like this: <?php if ($text['categories_id'] == '22') { ?> <tr><td class="main">All certificates are from trusted secure sites (Geotrust & RapidSSL) and provide the yellow secure padlock, the only difference being the level of security and the insurance offered.<br><br><b>We offer 3 different types of SSL Certificates:</b><br><br></td></tr> <?php } Hope that helps, Leumas Quote Link to comment Share on other sites More sharing options...
Onkel Sid Posted November 13, 2006 Share Posted November 13, 2006 Thanks leumas. Worked out perfectly. Onkel Sid Quote Link to comment Share on other sites More sharing options...
clikbiz Posted November 14, 2006 Share Posted November 14, 2006 Hi Stuart, This is a great contrib and it's exactly what I'm looking for. However, I think I'm having the same problem as leumas. Did you find out leumas' problem? Thanks for your help in advance Quote Link to comment Share on other sites More sharing options...
Guest Posted November 14, 2006 Share Posted November 14, 2006 Just to keep the forum up to date on the progress, here's a copy of a PM I just sent to Stuart. It (tries) to explain my solution/dilemna combo! Good news! Kind of...well, I shall try to explain: I've been trying different setup permutations to try and sort this out. Beforehand, when the contribution wasn't functioning, my store structure was like this: index>category>sub-category>product list with multiple categories followed my multiple sub-categories. So, my initial category pages had nothing but sub-category links in them and no 'products' as such. However, when I tried adding a single product to one of my sub-category lists, the contribution suddenly started working as it should. This would infer that the contribution requires a product listing, not just a category or sub-category listing to function. In fact, when I add a product to a page that only previously had sub-categories, the sub-cateogries disappear and it only displays the contribution and product listing. Sorry if that's a bit of a verbose description. Do you think there is a way that the contribution could function just as part of a category with further sub-category links in it and no products? I think this may be the problem other people are having aswell. Once again Stuart, thanks for all of your time and help! :thumbsup: Leumas For others that are trying to resolve issues with this contribution, try adding a single product to one of your category or sub-category lists and then check whether the contirubtion functions properly. Before you do this, comply with the universal laws of oscommerce and back up, back-up, back-up! Report back here with your results and suggestions! Leumas Quote Link to comment Share on other sites More sharing options...
clikbiz Posted November 15, 2006 Share Posted November 15, 2006 Thanks Leumas for posting your findings. I see what you mean. You need to have a product, otherwise the Contrib wouldn't work. Quote Link to comment Share on other sites More sharing options...
Guest Posted November 16, 2006 Share Posted November 16, 2006 I've managed to sort out a workaround (of sorts) that lets people who want to have content on their category (or even subcategory) pages but do not wish to have products showing. This also makes the contribution function if it wasn't working previously. As always, back up! Whilst this worked for me, I wouldn't want to disrupt anyone else's site and I can't verify how well it will work with other contributions. STEP 1. ---------------------- Install the contribution as normal. STEP 2. ---------------------- Go in to your admin panel. Click in to your first category folder and add a blank product of zero value alongside your subcategory folders. Repeat this in any subcategory folders of any depth where you don't want products showing. STEP 3 ---------------------- Open your index.php file. Below the contribution code, you'll find something like this: <tr> <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td> </tr> </table></td> Quote Link to comment Share on other sites More sharing options...
Guest Posted November 16, 2006 Share Posted November 16, 2006 PREVIOUS MESSAGE CONTINUED (freakin' board fomatting!): Replace that with this: <?php if ($text['categories_id'] > '23') { ?> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td> </tr> </table></td> <?php } ?> Just as when installing the original contribution, the '23' in the code above stands for a category ID. In this case, the ID needs to be that of the last category or subcategory where you only want to have content and no products showing. If you're determining this from a URL and it says something like '21_24', the category ID is 24. STEP 4 -------------------- Test! If you're having problems, leave a message below, or PM me and I'll try to respond as quickly as I can. Leumas Quote Link to comment Share on other sites More sharing options...
clikbiz Posted November 21, 2006 Share Posted November 21, 2006 I realised that if you create a product that is out of stock, this Contrib would also work. However, the links for the sub category would disappear along with any products in that category. Quote Link to comment Share on other sites More sharing options...
chnapka Posted January 23, 2007 Share Posted January 23, 2007 I need subcategory text everywhere, i need text here : ../index.php?cPath=21 and here: ../index.php?cPath=21_22 How change the code? Quote Link to comment Share on other sites More sharing options...
Guest Posted March 27, 2007 Share Posted March 27, 2007 I can´t really express how much you saved my day, I was looking around for a category description solution, which migh be easy to install an does not interfere with the admin/categories.php because I have headertags installed. Thank you so much for this superb solution! Best wishes from Germany, baka Quote Link to comment Share on other sites More sharing options...
blakepetersen Posted August 10, 2007 Share Posted August 10, 2007 Leumas, I was wondering if somehow the CSS can be tweaked to make it possible to have the description appear in a blank info box area. Basically what i want to do is get the category and subcategorys to appear in the infobox area but not necessarily as an infobox. If it can be positioned absolutely over the empty area that would be great but i am not really sure how or if it would work. Would i just make a new div layer? im pretty new to css as i learned it like 3 days ago. Let me know the possibilities Quote Link to comment Share on other sites More sharing options...
Fuzzbutt.co.uk Posted April 30, 2008 Share Posted April 30, 2008 Open Catalog/includes/languages/english/index.php------------------------------------------------- Before the closing ?> at the bottom of the page add: define('SUB_CAT_DESC_28', 'Insert Text Here'); define('SUB_CAT_DESC_29', 'Insert Text Here'); Hi there, if I want to put HTML and image codings into my subcat descriptions can I put the code into these lines? eg: define('SUB_CAT_DESC_28', '<p align="center"><img src="img/full-metal-fuzzbutt.jpg" alt="Full Metal Fuzzbutt movie poster"></p> <p><strong><em><font color="#FF0000">It\'s time to kick some butt with "Sarge" Cheezer and our fab new <strong>BunkerCubes</strong> - for the Fuzzy that defends his territory! Strike back against the enemy of poor quality thin bedding with our thick and chunky Sherpa-lined cubes, with a "bunker" style letterbox opening for effortless surveillance.</p> <p>Available in regulation Army Camouflage, Bomb-proof Brick, or in black "Flaming Moe" fiery fabric. Nothing pink and fluffy here, BunkerCubes only available in the toughest designs.</p> <ul> <li>Improved wider "Emergency Exit" (extra opening at the back to stop your Fuzzy chewing one of his own!)</li> <li>Inner seams concealed and stitched - no fraying edges</li> <li>Double layer of fleece padding & MORE padding on the floor!</li> <li>Hangs by D rings and strong webbing</li> <li>All-over stitching to prevent burrowing</li> <li>Turns inside out for easy washing</li> <li>Standard bunker measures approx 9"l x 6.5"h x 6.5"d. </li> </ul> </p>'); Will this work? Quote Imperial Sandtrooper TD-2441, UK Garrison Ghostbuster "Dr Smith" Link to comment Share on other sites More sharing options...
Fuzzbutt.co.uk Posted May 1, 2008 Share Posted May 1, 2008 I've added this contribution and tried just some simple text first, but I'm using the method where you insert the text into the languages/english.php file. It' snot working and I wonder if it's because my category URL ends in: index.php?cPath=1_22 and not just a single number like /index.php/cPath/28 Anyways, it's totally not working :( The coding I added to languages/english/index.php is: define('SUB_CAT_DESC_1_22', 'Snooze Cube Subcategory text'); and the coding added to catalog/index.php is <?php $text_query = tep_db_query("select cd.categories_name, c.categories_id, 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 . "'"); $text = tep_db_fetch_array($text_query); ?> <?php if ($text['categories_id'] == '1_22') { ?> <tr><td><?php echo SUB_CAT_DESC_1_22; ?> <br><br></td></tr> <?php } ?> Quote Imperial Sandtrooper TD-2441, UK Garrison Ghostbuster "Dr Smith" Link to comment Share on other sites More sharing options...
Guest Posted May 13, 2008 Share Posted May 13, 2008 I am trying to install this contribution but I cannot find the following line in my catalog/index.php page. I am certain it is not there since I did a search for the exact line: <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> Is there a workaround for this? Any help would be much appreciated. Thanks! Quote Link to comment Share on other sites More sharing options...
shokt Posted September 4, 2009 Share Posted September 4, 2009 Thanks you, but i want the text to appear on product_info.php page as additional text or link. can i use it on product info page ? thanks in advance shake 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.