alvaroceballos Posted July 26, 2011 Share Posted July 26, 2011 Hi: 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. Quote Link to comment Share on other sites More sharing options...
alvaroceballos Posted August 1, 2011 Author Share Posted August 1, 2011 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] . "'"); $land=tep_db_fetch_array($query_ciclica); if (! $land[parent_id] == 0) { $cat_completa = $land[parent_id] . '_' . $cat_completa; } } return $cat_completa; } Quote Link to comment Share on other sites More sharing options...
♥kymation Posted August 1, 2011 Share Posted August 1, 2011 Wouldn't it be easier to just use substr(tep_get_path($category_id), 6) Regards Jim burt 1 Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
alvaroceballos Posted August 2, 2011 Author Share Posted August 2, 2011 Yes, it would. ¿Is there any kind of documentation of oscommerce? (not the install one) Quote Link to comment Share on other sites More sharing options...
♥kymation Posted August 2, 2011 Share Posted August 2, 2011 Documentation on the code? No, you just have to read through it. It gets easier with experience. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
drferrari Posted February 4, 2013 Share Posted February 4, 2013 this maybe help: http://www.oscommerce.com/forums/topic/391546-full-categories-path-in-xml-file/#entry1662445 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.