Guest Posted August 10, 2004 Posted August 10, 2004 Is there a way to include a "Category Description" that appears when the user clicks on a category? Like when clicking on "Punched Cards", a description like "All the following products are available in both 80-column and 96-column (system/3) formats. yadda yadda yadda". I don't want to have to duplicate common information in every product description, so if I could move it to a "category" description, this would be a big help.
robr Posted August 10, 2004 Posted August 10, 2004 Hi, try this http://www.oscommerce.com/community/contributions,1373 Robr
Guest Posted August 10, 2004 Posted August 10, 2004 Thanks, I downloaded this contribution, and the zip file contained only a readme file that describes the changes to be made. It references two non-included files: "db_changes" and "admin/includes/functions/categories_description.pnp", which contains two new service routines and should be installed in "admin/includes/functions". Does anyone have these missing files? Or is there another contribution that would do the same thing?
Jan Zonjee Posted August 10, 2004 Posted August 10, 2004 Would this be useful? Including a text file (that can contain PHP, HTML, images, links etc. etc.) which is included whenever cPath is in the URL and the file with index_"cPath".inc.php is in the subdirectory /includes/templates. For orientation I included the part before and after the include section (from the product_listing.php included in Master Products 1.1.5. <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 /* adapted PHP code from here, to include regular HTML on index.php, based on subcat cPath */ $other_text_indexfile = $_SERVER['DOCUMENT_ROOT']."/".DIR_WS_CATALOG."includes/templates/index_".$cPath.".inc.php"; switch ( isset($cPath) && file_exists($other_text_indexfile) ) { case true: include($other_text_indexfile); break; // default: in case index_X_Y.inc.php doesn't exist default: include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); } /* end of adapted PHP code */ ?> </td> </tr> </table></td> <?php } else { // default (start) page
jackpb Posted August 10, 2004 Posted August 10, 2004 I still don't understand the whole database text file thing. Is that some thing that we should create or download?
Guest Posted August 10, 2004 Posted August 10, 2004 Thanks, I downloaded this contribution, and the zip file contained only a readme file that describes the changes to be made. It references two non-included files: "db_changes" and "admin/includes/functions/categories_description.pnp", which contains two new service routines and should be installed in "admin/includes/functions". Does anyone have these missing files? Or is there another contribution that would do the same thing? I looked at it as well and the uploads are a mess. You'll need to download a few versions of the contribution to get all relevant pieces.
Guest Posted August 10, 2004 Posted August 10, 2004 Which ones should you download? v1.5, v1.6 and possibly the v1.5 fix as I don't know whether or not it is implemented in v1.6
jackpb Posted August 10, 2004 Posted August 10, 2004 you're right this really is a mess. Thanks a lot for your help.
Guest Posted August 13, 2004 Posted August 13, 2004 JanZ: This sounds like it would do what I want. I have some common, lenghty descriptive text that I want to include for many products. What should I store this text file as [name?], and how would I tell which products should use it in their descriptions? Can the description for the products actually embed an "include filename" type of command, so that only these products would include the common text?
Jan Zonjee Posted August 13, 2004 Posted August 13, 2004 What should I store this text file as [name?], and how would I tell which products should use it in their descriptions? Can the description for the products actually embed an "include filename" type of command, so that only these products would include the common text? To be clear, what I suggested is for the pages index.php that normally only show a product listing (in a table) of the products in a certain category. I use it also to get rid of the product listing in certain categories, but this is probably not what you want. So either also add: include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); after " include($other_text_indexfile); " or keep that whole line outside, but below this extra piece of PHP. This modification cannot be used on the pages for individual products (product_info.php?cPath etc.). If you use it exactly as I suggested, you would have to make a subdirectory "templates" in "includes" and the text files (containing HTML and/or PHP) would be named index_1_2.inc.php for subcategory 1_2 (so for the page index.php?cPath=1_2). If there is no file for the subcategory, nothing will be "included", so it will just show the default behaviour like you are used to (just the product listing). The index_1_2.inc.php is just a text file e.g.: <h2>Widgets</h2> <p class="main">We produce all these widgets ourselves. See for more widgets our page on <a href="<?php echo tep_href_link('index.php', 'cPath=2_3') ; ?>" class="our_own_class">super widgets</a>. You might also want to look at our <a href="<?php echo tep_href_link('product_info.php', 'cPath=1_7&products_id=310') ; ?>">heavy duty widget</a>. There is nothing more to it.
jackpb Posted August 20, 2004 Posted August 20, 2004 The Missing catalog_description.php file <?php //---------------------------------------------------------------------------// // // Code: categories_description // Author: Brian Lowe <[email protected]> // Date: June 2002 // // Contains code snippets for the categories_description contribution to // osCommerce. //---------------------------------------------------------------------------// // Code: categories_description MS2 1.5 // Editor: Lord Illicious <[email protected]> // Date: July 2003 // //---------------------------------------------------------------------------// //---------------------------------------------------------------------------// // Get a category heading_title or description // These should probably be in admin/includes/functions/general.php, but since // this is a contribution and not part of the base code, they are here instead //---------------------------------------------------------------------------// function tep_get_category_heading_title($category_id, $language_id) { $category_query = tep_db_query("select categories_heading_title from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $category_id . "' and language_id = '" . $language_id . "'"); $category = tep_db_fetch_array($category_query); return $category['categories_heading_title']; } function tep_get_category_description($category_id, $language_id) { $category_query = tep_db_query("select categories_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $category_id . "' and language_id = '" . $language_id . "'"); $category = tep_db_fetch_array($category_query); return $category['categories_description']; } ?> Kill any spaces after the ?>
Recommended Posts
Archived
This topic is now archived and is closed to further replies.