Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Retreive Cat ID from current product page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 10-05-2011, 04:29 PM
 
makenoiz makenoiz is offline
 

Advanced Member
  
Join Date: Jun 2011
Posts: 35
 

Default Retreive Cat ID from current product page

I know this is a silly question but on a product page how would I echo the current categorys parent category ID? I have some code that is not working and its based on the parent category ID of the current product.


Thanks for your help. This will help with my logic
__________________
X-Cart version 4.4.3
Reply With Quote
  #2  
Old 10-05-2011, 07:44 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: Retreive Cat ID from current product page

You have to query the categories table for the parentid for that product's category in php and assign it to smarty. It is a product details page so there is no current category, there is no category
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 10-05-2011, 09:00 PM
 
makenoiz makenoiz is offline
 

Advanced Member
  
Join Date: Jun 2011
Posts: 35
 

Default Re: Retreive Cat ID from current product page

But I seem to be able to echo the current category just fine with

{$current_category.categoryid}
__________________
X-Cart version 4.4.3
Reply With Quote
  #4  
Old 10-06-2011, 05:02 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,191
 

Default Re: Retreive Cat ID from current product page

On product details page? Imposible unless you have some customization. $current_category doesn't exist on product details page by default. It does on product list pages (category pages).

{$current_category.parentid} will be the code to call parent category id if $current_category array exists
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 10-06-2011, 11:44 AM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: Retreive Cat ID from current product page

You can get information on the product page about an item's main category, and its parent categories. In webmaster mode, select show variables, and look at the $location array. This is what displays the breadcrumb.


---
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:59 PM.

   

 
X-Cart forums © 2001-2020