Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Category Descriptions 2.0


Recommended Posts

I am using contrib Category Descriptions 2.0:



It has been working very well for me, but I recently ran into a situation where I have multiple categories with the same categories_name. Since this contrib prints the description based on category name, the same description is printed for all categories with the same name. I realize I can rename my categories to be more specific, but I was hoping someone could point me towards using the categories_id, instead of categories_name to determine the current category the customer is viewing.


For example, standard code:

if ($category['categories_name'] == 'Clormatic III') 
echo tep_image(DIR_WS_IMAGES . 'CM3.JPG', 'Clormatic III');


But say I have a separate category in a different location, I'd want to specify the category I want the description to be displayed in. I tried the following with no success:

if ($category['categories_id'] == '27') 
echo tep_image(DIR_WS_IMAGES . 'CM3.JPG', 'Clormatic III');

Is anyone familiar enough with this contribution to point me in the right direction?



My second question is more along the lines of general PHP knowledge, which I have little of :P .


My site is going to have 5000+ Products by the time we are finished, and tons of categories for these products. My descriptions.php is already at 50kb with 20+ descriptions added. Will this greatly affect the speed of my page loads if the server has to search through 100+kb of code to find the category it is looking for?


At the moment, I have all of the HTML output included in the descriptions.php. Would it be more efficient to call for exterior scripts to run once the server has found the category in descriptions.php? In other words, have the HTML output located in separate files for each category, and call the file from descriptions.php.



Thanks for your time,


Edited by o_cnick
Link to comment
Share on other sites

  • 1 month later...

Ok, forget about the 1st question, not an issue anymore.


But my second question I am still interested in, as I have included HTML output for many of the categories (not just a picture like my above examples). So now I am growing a huge descriptions.php file.


I am not sure of the most efficient way (for server load, and load speed), of loading a unique description for each category.


As of now I am writing all of the HTML in my descriptions.php like the following code:

if ($category['categories_name'] == 'Clormatic III')
<!--HTML code here-->


Alternative is to call an external php file that specifies HTML output for each category description:

if ($category['categories_name'] == 'Clormatic III')
require(DIR_WS_INCLUDES . "clormaticiiidesc.php"


So my question is whether it would be faster to:


A. Include all of my HTML output in 1 descriptions.php file, which is a long series of "if" statements.


B. Call external php scripts for HTML output, which would require loading another file.


Any suggestions would be awesome!

Edited by o_cnick
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...