quetzlcoatl Posted November 24, 2003 Posted November 24, 2003 Some of my category names are kinda long and either overhang the edge of the box or are squished into two rows (I'm using the graphical infobox header contribution with a background image). Is there a way to limit the length of the category names as displayed in the category box, without changing anything in mysql? I need the full category name to display with the product listing. Any help would be greatly appreciated!
eHo Posted November 24, 2003 Posted November 24, 2003 You can try to expand the box width in ... "catalog/includes/application_top.php" On line 58 you will probably see something like... // customization for the design layout define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125) Just change your box width to a higher number and see if that works for you.
Guest Posted November 25, 2003 Posted November 25, 2003 In includes/boxes/categories.php (around line 35), changing $categories_string .= $tree[$counter]['name']; to $categories_string .= substr($tree[$counter]['name'], 0, 20 - 2*$tree[$counter]['level']); will limit all category names to 20 spaces (including blanks preceding the category name). Adjust 20 as needed (e.g. if you can fit 40, change 20 to 40). Hth, Matt
quetzlcoatl Posted November 25, 2003 Author Posted November 25, 2003 Thank you!!!! You're the best! :D
quetzlcoatl Posted November 25, 2003 Author Posted November 25, 2003 Could you help with one more thing? I would like to set the category names to 20 characters. If a category name is longer then 20, then shorten it and add "..." to the end of the cat name. I wrote this, but it's adding "..." to all cat names, even those that are four or five characters long: if ($cat_name = $cat_length) { $categories_string .= substr($tree[$counter]['name'], 0, 20 - 2*$tree[$counter]['level']). "..."; } else { $categories_string .= $tree[$counter]['name']; } I added a line under $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; in categories.php that says: $cat_length=20; Thanks for your help!
quetzlcoatl Posted November 26, 2003 Author Posted November 26, 2003 AH-HA fixed.... if anyone else wants to know, here is the code that will limit cat names to 22 characters, if the name exceeds 22, then a "..." is placed after the shortened name!! Pretty cool. Thanks iiinetworks for helping with this! Put this below $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; $cat_length=22; Then look for $categories_string .= $tree[$counter]['name']; And replace with if (strlen($tree[$counter]['name'])>$cat_length) { $categories_string .= substr($tree[$counter]['name'], 0, $cat_length - 3). "..."; } else { $categories_string .= $tree[$counter]['name']; } The "..." is good, that way if a cat name is cut short, it won't look confusing to the customer.
Guest Posted January 10, 2004 Posted January 10, 2004 Do you know how to fix the product title limit. I seem to have the same problem you had however it's in product name. Thanks Paris
quetzlcoatl Posted January 10, 2004 Author Posted January 10, 2004 Which page are you trying to modify? The product listing or product detail?
Guest Posted January 10, 2004 Posted January 10, 2004 It's the product Title... Lets say i sell computers well it's not the catagorie name or the description of the product but rather the title of the product. Thank you Paris
quetzlcoatl Posted January 11, 2004 Author Posted January 11, 2004 If you want to limit the length of the product names everywhere on your site, you will have to edit in phpmyadmin and set the field length to a smaller number.
Guest Posted January 11, 2004 Posted January 11, 2004 I was told that on one of my earlier post however i'm not sure what steps to take for this. Isn't that the database area?
quetzlcoatl Posted January 11, 2004 Author Posted January 11, 2004 You should either have a direct link to phpmyadmin in your hosting control panel, or a database management link with a phpmyadmin link there. Just select the database you are using, click on the table name, products_description. The field you need to edit is products_name, click "change" beside it and set a new number there. Another way, if you wanted to limit the length on just the product listing, would be to modify the php code similar to what I did for the category names. That would be in either catalog/includes/modules/product_listing.php or catalog/index.php
Guest Posted January 11, 2004 Posted January 11, 2004 I got it to work ;-) Thank you for your help everyone, finally got it working.. Thanks Paris
Recommended Posts
Archived
This topic is now archived and is closed to further replies.