craftables Posted August 24, 2006 Share Posted August 24, 2006 Hi all, In my usual hack and slash way I thought I could make some tweaks to the categories db. I was trying to add a category description and keywords to the categories_desc table. I jumped into phpMyAdmin and added the text fields for the new description and keywords and got inxed.php working so that it checks for a description and adds this text between the subcategories and the product lists. I will also add this to the meta tag description too along with the category keywords from the new table entry. Now up to this point it all works fine! Jobs a gooden! I wade into admin/categories.php so that I can add the ability to define these two new fields within the admin control panel and thats where I just got lost! Can anyone give me some pointers to where I should be looking to make tweaks and changes in this file ? I thought it would stand out as a few lines to copy and edit and fields added to sql statements in this file but I m just lost. Note: I only appear to have enable/disable categories mod affecting this file. Thanks in advance for any help. Steven Link to comment Share on other sites More sharing options...
craftables Posted September 18, 2006 Author Share Posted September 18, 2006 Well, I thought I had nearly cracked it - and then just as I got confident and tried to add some extra information it all falls apart! Can anyone offer a reason why the categories_name, catergories_keywords and categories_desc all works but categories_pageDesc doesnt always seems to result as NULL ? The code: english.php $category_query = tep_db_query("select cd.categories_name, cd.categories_desc, cd.categories_keywords, cd.categories_pageDesc, 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 . "'"); $category = tep_db_fetch_array($category_query); if ($category['categories_name'] != NULL) { define('INDEX_META_TITLE', 'Craftables craft shop category: ' . $category['categories_name']); } else { define('INDEX_META_TITLE', 'Craftables: Online card and craft supplies'); } if ($category['categories_desc'] != NULL) { define('INDEX_META_DESCRIPTION', $category['categories_desc']); } else { define('INDEX_META_DESCRIPTION', 'Supplying paper, card, embellishments, card kits, accessories and more for card-makers and scrappers! Stockists include Bazzill Basics, Making Memories, Dovecraft, Trimcraft and Me and My Big Ideas'); } if ($category['categories_keywords'] != NULL) { define('INDEX_META_KEYWORDS', $category['categories_keywords']); } else { define('INDEX_META_KEYWORDS', 'card, craft, supply, craftables, making, memories, bazzill, basics, kits, online, shop, embellishments, fiber, ribbon, stickers, peel-offs, envelopes, toppers, beads, glitter'); } index.php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); if ( $category['categories_pageDesc'] != NULL ) { echo '<tr><td class="main"><b>' . $category['categories_name'] . ':</b>??' . $category['categories_pageDesc'] . '</td></tr>'; echo tep_draw_separator('pixel_trans.gif', '100%', '10'); } One issue I have noted is in the creation of the table in phpmyAdmin. When creating the categories_desc initially I created it as text field, NULL-able and default as NULL. All is well. Later when (I thought) I went through the same process for the categories_pageDesc; text field, NULL-able and default as NULL. However browsing the table all the categories_desc fields are all blank, but all the categories_pageDesc fields are all populated with NULL. Even so, after getting the admin to update these fields within the categories pages I update a category with pageDesc information (after checking in phpmyAdmin the field has been updaed from NULL to the text I entered) but when trying to load the text onto the index page it alway tests as NULL! Can anyone pick up where I can going wrong ? Thanks in advance for ANY reply on this thread other than me! ;) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.