Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

get parent category


adiwillow

Recommended Posts

ps tried various things, but either get a resource ID returned or simply 'array'. I know its wrong i just dont know why.

 

simply using stuff like..

 

$parent = tep_db_query("select parent_id from " . TABLE_CATEGORIES . " where categories_id = " . (int)$current_category_id);

$parentout = tep_db_fetch_array($parent);

echo $parent;

 

which i know is wrong... as is the same without the tep_db_fetch_array line ..

 

am i right in thinking its something to do with a while command?

Link to comment
Share on other sites

what great forum this place is.. it never fails to amaze me... the whole thing needs ditching and starting over. A simple coding help request, an no one answers because this place is such a mess , so why bother. The search function is a joke (fancy blocking 3 word search requests on a coding forum..duh), and the software hasnt been updated for about two years.FFS.

 

This is a simple bit of coding.. i've worked most of it out but are unsure of what i'm doing wrong... i guess i'd better hit the php forums...

Link to comment
Share on other sites

You might want to use the built-in get parent function instead of writing a new one. As for searching, the accepted method is to use google with something like: site:www.oscommerce.com/forums search phase

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

thanks jack.. you're on the few people on here who answer posts consistently well.. something to be conratulated. Yes, i've resorted to the google seach for this place, but why the forum isnt updated i have no idea... it seems to be getting worse and worse... it has to go pop soon surely.

 

Anyway, thanks for the tip, i wasnt aware such a function existed..

 

What would be the correct use of the get parent function then? lets say i am installing a box in the template which returns the parent... in what context would the get parent be?

Link to comment
Share on other sites

there is p2c table.

if You feel like firing a query then that is the table where You need to look in.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

thanks jack.. you're on the few people on here who answer posts consistently well.. something to be conratulated. Yes, i've resorted to the google seach for this place, but why the forum isnt updated i have no idea... it seems to be getting worse and worse... it has to go pop soon surely.

 

Anyway, thanks for the tip, i wasnt aware such a function existed..

 

What would be the correct use of the get parent function then? lets say i am installing a box in the template which returns the parent... in what context would the get parent be?

Search the includes/functions/general.php file for tep_get_parent_categories. That function returns an array of category ID's. You can make a copy of it and have it return the names as well. Then you just pick the one you want from the array.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...