CRE Loaded Community



Board index » CRE Loaded PCI 6.4 » CRE Loaded PCI 6.4 Support

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Help with categories parent_id in product listing
PostPosted: Tue Mar 09, 2010 9:53 pm 
Offline
CRE Freak
User avatar

Joined: Sun Apr 17, 2005 12:00 am
Posts: 104
I need a little help please... basically what I want to to is display certain information on product listing page based on the categories parent_id.

If I try to display the parent_id from the query bellow I keep getting 0
Code:
<?
    $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_name");
      $product_info1 = tep_db_fetch_array($categories_query);
      
     echo $product_info1['parent_id'];
?>

If from the same query I try
Code:
echo $product_info1['categories_name];
, I get the correct category name where the product is located, as well as if I try
Code:
echo $product_info1['categories_id];
I get the correct number of the category where the product is located in.

I just cant get the parent_id. Can anybody please help me find what I'm doing wrong or with the correct query.


Top
 Profile  
 
 Post subject: Re: Help with categories parent_id in product listing
PostPosted: Tue Mar 09, 2010 11:06 pm 
Offline
CRE Legend
User avatar

Joined: Fri Jan 13, 2006 1:00 am
Posts: 10881
Location: Nappanee Indiana
0 would be a top category.. are you sure you are echoing on a sub cat

_________________
Jason Miller
CRE Loaded Expert
CRE Loaded Expert Team
Home of the FIRST 100% tableless CRE Loaded template


Top
 Profile  
 
 Post subject: Re: Help with categories parent_id in product listing
PostPosted: Wed Mar 10, 2010 3:56 am 
Offline
CRE Freak
User avatar

Joined: Sun Apr 17, 2005 12:00 am
Posts: 104
Yes, I know the for sure the parent id should be 8. I dont know. I also tried the query as bellow, with the exact same resoult.

Code:
     $categories_query = tep_db_query("select c.categories_id, p.products_id, p.categories_id, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p where c.categories_id = p.categories_id");
      $product_info1 = tep_db_fetch_array($categories_query);
      
     echo $product_info1['parent_id'];


Top
 Profile  
 
 Post subject: Re: Help with categories parent_id in product listing
PostPosted: Wed Mar 10, 2010 5:59 am 
Offline
CRE Freak
User avatar

Joined: Sun Apr 17, 2005 12:00 am
Posts: 104
OK, I'm getting close, with the query bellow I get the parent ID of the current,is there any way of getting the main parent id. For example my main category has the parent_id 8 some categories have subcategories, and then the subcategory parent_id will not be 8 any more will be whatever id the category in which is located has.

What I'm trying to do is display another tab but only when the main parent_id is 8.

Code:

$categories_query = tep_db_query("select p.products_id, p.products_model, c.categories_id, c.parent_id, pc.products_id, pc.categories_id, c.categories_image
from " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc where p.products_id = '" . (int)$_GET['products_id'] . "' and pc.products_id = p.products_id and pc.categories_id = c.categories_id");
  $categories = tep_db_fetch_array($categories_query);

echo $categories['parent_id'];


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

Board index » CRE Loaded PCI 6.4 » CRE Loaded PCI 6.4 Support

All times are UTC - 5 hours


Who is online

Users browsing this forum: Ask Jeeves [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Fri Jul 30, 2010 12:03 pm
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Top Listing

1. Credit Card with CCV
    Category: Payment Modules
    
2. CC7333_ATS
    Category: Templates
    
3. Points & Rewards PLUS!...
    Category: Add-Ons
    
4. One Page Checkout...
    Category: Fixes
    
5. Configuration Server...
    Category: Fixes
    
Show more...

Follow Us on Twitter

@likeOMGitsFEDAY we do offer a wiki and other resources at www.creloaded.org
@smellgoodslady 6.2 is old code, we are at 6.4 now. come and get the latest.
@smellgoodslady what version/release are you running?
CRE Secure in the news: Payment News Article about Hosted Payment Pages reducing PCI friction - http://is.gd/ba0CH
@smellgoodslady yes it should work for 6.2 as well. let me know of you have any issues.

CRE Loaded Community Chat hosted by CRE Loaded.

Join now


Chat about what's on your mind. More about public chats.


© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy