Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

How to get full cat path?

Recommended Posts



I am skining my oscommerce 2.3 file by file, and I am making a module for am improved cat listing on index (only certain cats).


I want to know, if there is a fast way, from a categories ID, to get the full cat for making the URL to it.


From a given categories number, IE:

Category id 4817

Full path to 4817 21_29_4751_4746_4817


Is there any other way to make the URL link o a given cat? or to generate the full cPath from a cat id?


I hope I explained myself correctly.

Link to comment
Share on other sites

Finaly I wrote a quite simple function, with works fine for me.

I only call that function if cPath does not contain "_" string.



function get_full_cat_from_cPath ($zipote)

$query_trabajo_1=tep_db_query("SELECT `parent_id` FROM `categories` WHERE `categories_id` =  '" . $zipote . "'");
$land = tep_db_fetch_array($query_trabajo_1);
$cat_completa = $zipote;
while (! $land[parent_id] == 0) {
$query_ciclica=tep_db_query("SELECT `parent_id` FROM `categories` WHERE `categories_id` =  '" . $land[parent_id] . "'");
if (! $land[parent_id] == 0) {
$cat_completa = $land[parent_id] . '_' . $cat_completa;
return $cat_completa;

Link to comment
Share on other sites

  • 1 year later...

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...