chris23 Posted November 16, 2006 Share Posted November 16, 2006 Support for "Subcategory textboxes" contribution This contribution will allow you to add a text information box to the top of a subcategory page. This allows you to give general information about a product range, rather than duplicating information within the product page. See enclosed screeshot.jpg for an example of its use. This contribution is based in part on the excellent and simple contribution "Sub Category Description on Selected Categories": http://www.oscommerce.com/community/contributions,4608 Whilst this offered the functionality required by a recent client, the client wanted to support multiple subcategories and didn't like the idea of editing the index.php source file to add / amend entries. This contribution builds on "Sub Category Description on Selected Categories": 1. Textbox descriptions stored in database table. 2. Full admin control to allow adding / editing / deleting textbox contents. 3. Ability to switch off textboxes globally - allows you to add your copy before going 'live' 4. Ability to customise amount of textbox text previewed on the admin page. 5. Protection against overwriting existing textbox contents. Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
chris23 Posted November 16, 2006 Author Share Posted November 16, 2006 Download contribution at: http://www.oscommerce.com/community/contributions,4668 Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
i2Paq Posted November 16, 2006 Share Posted November 16, 2006 Great contribution! Installed it in 5 min, works like a charm! Wished it was multilingual :'( But h?, we all need somthing to wish for, right? :lol: It will do for now, thanks again! :thumbsup: Quote Norman in 't Veldt Moderator osCommerce The Netherlands Link to comment Share on other sites More sharing options...
chris23 Posted November 18, 2006 Author Share Posted November 18, 2006 Wished it was multilingual :'( Pleased you like the contribution! I've rewritten to v1.1 which now includes full multi-lingual support for both the admin and store side. Enjoy! :D Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
matrix2223 Posted November 19, 2006 Share Posted November 19, 2006 Quick question? Does this also work with main categories as well? Thanks, Eric Quote Link to comment Share on other sites More sharing options...
The dutch dude Posted November 19, 2006 Share Posted November 19, 2006 The screenshot looks nice so lets try.. :'( Whats wrong?? FoutSQL-query: -- -- Table structure for table `extra_cat_info` -- CREATE TABLE `extra_cat_info` ( `categories_id` int( 11 ) NOT NULL , `categories_description` text NOT NULL , `language_id` int( 11 ) NOT NULL default '1', PRIMARY KEY ( `categories_id` , `language_id` ) ) ENGINE = MYISAM INSERT INTO configuration VALUES ( NULL , 'Subcategory text preview length', 'CAT_TEXT_PREVIEW', '150', 'Set length of subcategory text to be displayed in preview field.<br>Set to something huge (50000) to view all text', 1, 100, NULL , '2006-11-03 14:40:05', NULL , NULL ); MySQL retourneerde: Documentatie #1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO configuration VALUES (NULL, 'Subcategory text previ A hint for a DB noob ? :blush: Quote Link to comment Share on other sites More sharing options...
chris23 Posted November 19, 2006 Author Share Posted November 19, 2006 Quick question? Quick answer - yes and no! The original idea of the contribution was to have an additional text box above the subcategory product listing. 1. If you want a text box to appear on a main category that doesn't have nested subcats then yes, all that is required is a trivial change after installation. 2. If, however, you want a text box on a main category that has subcats (ie on the page where you have the subcategory list), then this will require a more substantial hack. For case 1) after installation, edit admin/product_extra_category.php FIND: $categories_query = tep_db_query("select " . TABLE_CATEGORIES_DESCRIPTION . ".categories_id, categories_name from " . TABLE_CATEGORIES . " left join " . TABLE_CATEGORIES_DESCRIPTION . " using (categories_id) left join " . TABLE_EXTRA_CATEGORIES . " on ". TABLE_EXTRA_CATEGORIES . ".categories_id = ". TABLE_CATEGORIES_DESCRIPTION . ".categories_id where " . TABLE_EXTRA_CATEGORIES .".categories_id is null and parent_id !=0 and " . TABLE_CATEGORIES_DESCRIPTION . ".language_id=".$languages_id); and replace with: $categories_query = tep_db_query("select " . TABLE_CATEGORIES_DESCRIPTION . ".categories_id, categories_name from " . TABLE_CATEGORIES . " left join " . TABLE_CATEGORIES_DESCRIPTION . " using (categories_id) left join " . TABLE_EXTRA_CATEGORIES . " on ". TABLE_EXTRA_CATEGORIES . ".categories_id = ". TABLE_CATEGORIES_DESCRIPTION . ".categories_id where " . TABLE_EXTRA_CATEGORIES .".categories_id is null and " . TABLE_CATEGORIES_DESCRIPTION . ".language_id=".$languages_id); If you want case 2) , let me know! I suggest installing v1.1 multi-lingual even if you have no need for language support as it has a few extra features / fixes. HTH Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
chris23 Posted November 19, 2006 Author Share Posted November 19, 2006 The screenshot looks nice so lets try.. :'( Whats wrong?? A hint for a DB noob ? :blush: Many apologies - theres a syntax error in subcategory_textboxes.sql. I've missed a ; off the end of ENGINE = MYISAM Please change CREATE TABLE `extra_cat_info` ( `categories_id` int(11) NOT NULL, `categories_description` text NOT NULL, `language_id` int(11) NOT NULL default '1', PRIMARY KEY (`categories_id`,`language_id`) ) ENGINE=MyISAM to: CREATE TABLE `extra_cat_info` ( `categories_id` int(11) NOT NULL, `categories_description` text NOT NULL, `language_id` int(11) NOT NULL default '1', PRIMARY KEY (`categories_id`,`language_id`) ) ENGINE=MyISAM; and retry. Will upload a corrected version to contributions area Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
The dutch dude Posted November 19, 2006 Share Posted November 19, 2006 :thumbsup: Thats a perfect fix. Now i have to do some reading, i can't find any text on de shop or text field at the admin side te put in.. :blush: Tnx for this fix.. Quote Link to comment Share on other sites More sharing options...
The dutch dude Posted November 19, 2006 Share Posted November 19, 2006 :blink: how hard can it be... i had a cup of coffee en TADAAAAAAAAAAAA.. Many tnx for the contribution, works just fine :D Quote Link to comment Share on other sites More sharing options...
abz786 Posted November 19, 2006 Share Posted November 19, 2006 Hi Chris, Great contibition. I've been looking to add an extra text box field to the to the product.info.php page? Do you think this can be adapted for that? Quote Link to comment Share on other sites More sharing options...
The dutch dude Posted November 19, 2006 Share Posted November 19, 2006 Just ones more..one question. Chris, do you want de dutch translations? (Still working at it) Quote Link to comment Share on other sites More sharing options...
chris23 Posted November 19, 2006 Author Share Posted November 19, 2006 Chris, do you want de dutch translations?(Still working at it) Hi Evert, That would be great - you could either upload your language file to the contributions area, or if you prefer, I'll PM you my e-mail address so you can send it over when finished. I can then bundle it into my next upload. Many thanks BTW - a strong coffee fixes all bugs ;) Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
chris23 Posted November 19, 2006 Author Share Posted November 19, 2006 I've been looking to add an extra text box field to the to the product.info.php page? Do you think this can be adapted for that? Hi Abdul, If you're looking to have the subcategory textbox that appears at the top of the product listing appear on every product page within the subcategory, then yes: After installation of the contribution: Edit product_info.php:- FIND (around line 85) if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br /><br /><span class="smallTextOR">Our code: ' . $product_info['products_model'] . '</span>'; } else { $products_name = $product_info['products_name']; } ?> immediately AFTER add: <?php // category textbox mod if (DISPLAY_EXTRA_CATEGORIES == 'true'){ // now get textbox description for this *product* and display $query = tep_db_query("select categories_description from " . TABLE_EXTRA_CATEGORIES . " left join " . TABLE_PRODUCTS_TO_CATEGORIES . " using (categories_id) where " . TABLE_PRODUCTS_TO_CATEGORIES .".products_id=" . (int)$HTTP_GET_VARS['products_id'] . " and " . TABLE_EXTRA_CATEGORIES .".language_id = '" . (int)$languages_id . "'"); while($category_info_text = tep_db_fetch_array($query)){ if($category_info_text['categories_description']!=""){ // prevent output where description not set for particular language echo ("<tr><td colspan=\"2\"><div class=\"cat_info_box\">".$category_info_text['categories_description']."</div></td></tr>"); } } } ?> Done! Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
The dutch dude Posted November 20, 2006 Share Posted November 20, 2006 The translations are almost done but i found a smal error, the flag link is incorrect. It's carincludes/languages/dutch/images/icon.gif but it has to be includes/languages/dutch/images/icon.gif. When this problem is solved i will finish the translations. :P Quote Link to comment Share on other sites More sharing options...
LuckyDuke Posted November 23, 2006 Share Posted November 23, 2006 Hello chris, Great contribution - It works very good. :) It's possible to make a Addition for Main Categories? Regards Anton Quote Link to comment Share on other sites More sharing options...
chris23 Posted November 24, 2006 Author Share Posted November 24, 2006 Hello chris, Great contribution - It works very good. :) It's possible to make a Addition for Main Categories? Regards Anton Hi Anton, I'm currently working on an updated version as a result of feedback on the forum about having boxes on main categories and product pages. The new version will have optional configuration options for main category boxes (for both categories with and without nested subcategories) and also to have the textbox cascade down to the product_info page for products within a category having a textbox. I'll post here as soon as I've finished (just install and upgrade instructions left to do so shouldn't be too long!) Glad you like the contribution. Regards Chris HTH Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
ocellusad Posted November 25, 2006 Share Posted November 25, 2006 Hi I've installed this contribution but when I go into the admin and select the textbox page all I get is this error message 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20, 20' at line 1 select extra_cat_info.categories_id, categories_description, categories_name from extra_cat_info LEFT JOIN categories_description USING (categories_id) limit -20, 20 any ideas? many thanks! Quote Link to comment Share on other sites More sharing options...
chris23 Posted November 26, 2006 Author Share Posted November 26, 2006 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20, 20' at line 1 select extra_cat_info.categories_id, categories_description, categories_name from extra_cat_info LEFT JOIN categories_description USING (categories_id) limit -20, 20 Hi Karen, Sorry you're having problems . Could you let me know a couple of thing? 1) Which version of the contribution you've installed 2) Confirm that you ran the supplied subcategory_textboxes.sql - if you did, please check your database, via phpMyAdmin, that you have a new table, extra_cat_info Thanks Chris Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
chris23 Posted November 26, 2006 Author Share Posted November 26, 2006 New version released [v2.0] What's new? -------------- As a result of feedback on the support forum, I've rewritten the contribution to: 1. Display Subcategory textbox on product listing page [ Default = false ] . Displays the subcategory textbox at the top of the contained product's information page. 2. Display textboxes on MAIN categories [ Default = false ] . Enabling this option allows support for textboxes on main categories (both with or without nested subcategories). Enabling this option has two effects: i) enables display of textboxes on main categories and ii) allows main categories to be selected from the pull down menu within the "Add subcategory" option. You could say that enabling this option renames the contribution "Category textboxes"! Other changes: 1. Moved the configuration options from "My Store" to their own configuration group - "Textboxes". The new installation sql file will find your next available configuration group (regardless of installed modules) and configure the new options automatically. 2. Moved the required index.php code to an include module to allow for easier upgrading / reduce code duplication. Full upgrade instructions also supplied for those using v1.x multilingual Enjoy :D Quote Please use forum for support rather than PM - PMs unrelated to my contributions will be ignored. Google Site Search is your friend My contributions: Tracking Module | PDF Customer Invoice | Subcategory textboxes Link to comment Share on other sites More sharing options...
Guest Posted November 26, 2006 Share Posted November 26, 2006 What an absolutely excellent contribution! A client asked me about this feature last week and I told him I would look into it. He is delighted with the addition. A very important addition. Worked first time (not all do). Thanks so much. Quote Link to comment Share on other sites More sharing options...
The dutch dude Posted November 27, 2006 Share Posted November 27, 2006 Chris, update completed en it's working like a charme.. :thumbsup: Nice work en tnx.. Quote Link to comment Share on other sites More sharing options...
i2Paq Posted November 27, 2006 Share Posted November 27, 2006 I will try your version 2 somewhere today. The upgrade-path from 1.x to v2 looks simple so I think it will be about 10min. or so. Thanks again! Quote Norman in 't Veldt Moderator osCommerce The Netherlands Link to comment Share on other sites More sharing options...
kbking Posted November 27, 2006 Share Posted November 27, 2006 Very useful! Thank You! Quote Link to comment Share on other sites More sharing options...
i2Paq Posted November 27, 2006 Share Posted November 27, 2006 There is a little problem in your catalog\admin\products_extra_category.php! I think you use TintMCE and there are sort of leftovers of this program in the file mentioned. I use TinyMCE as well and when adding the code I get twice the TinyMCE edittor :huh: Quote Norman in 't Veldt Moderator osCommerce The Netherlands 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.
Note: Your post will require moderator approval before it will be visible.