Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Adding subcategory to product name?


Recommended Posts

Hi Everyone,


I'll try to keep this brief, and to the point. I'm buildling an auto parts website and say one model #, "Rubber Floor Mats" are copied/linked to 5 different subcategories (car models, in fact).. Is there an easy way I can add the category to the product name? For instance, if the original product name was simply "Rubber Floor Mats", and it's listed under a subcategory of "2005 Subaru Forester", I'd like it to display dynamically as "Rubber Floor Mats - 2005 Subaru Forester" in the listings and in the product_info.php, for instance... I'm sure with some sort of a JOIN statement in SQL, it could be done, but I'm not so good at writing queries myself... If this question has been asked already, feel free to point me to a previous post, I'm not sure what I'm asking myself :)


Thanks for any help,


Link to comment
Share on other sites

The products_to_categories table keeps an association of products and categories. You have to do something else that will keep a field (like which item was inserted first in order to do that). Like adding an autoincrement field. Then the query (sorted by this autoincrement column) can stop on the first instance of the products_id that matches the criteria.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...