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

how to get a product root category name?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-04-2017, 04:04 PM
 
Eyeglasses Expert Eyeglasses Expert is offline
 

eXpert
  
Join Date: May 2010
Posts: 307
 

Default how to get a product root category name?

i am testing x-cart v4.7.
how to get a product root category name at the product page, pls?
Reply With Quote
  #2  
Old 05-04-2017, 08:34 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: how to get a product root category name?

I think X-Cart 4 doesn't pass information on the product's category to the product page template, so you should tweak product.php first: use the func_get_category_data() function to load information on the category and send it to the template with $smarty->assign('NAME_OF_SMARTY_VARIABLE', $DATA).
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #3  
Old 05-06-2017, 12:31 PM
 
Eyeglasses Expert Eyeglasses Expert is offline
 

eXpert
  
Join Date: May 2010
Posts: 307
 

Default Re: how to get a product root category name?

would you pls teach me the details? tks
Reply With Quote
  #4  
Old 05-06-2017, 01:02 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default Re: how to get a product root category name?

Quote:
Originally Posted by qualiteam
I think X-Cart 4 doesn't pass information on the product's category to the product page template, so you should tweak product.php first: use the func_get_category_data() function to load information on the category and send it to the template with $smarty->assign('NAME_OF_SMARTY_VARIABLE', $DATA).
Root category info should be present on all pages as it is used to display category menus.

See how $categories_menu_list is used in customer/categories.tpl.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #5  
Old 03-18-2022, 10:45 AM
 
PhilJ PhilJ is offline
 

X-Guru
  
Join Date: Nov 2002
Posts: 4,094
 

Default Re: how to get a product root category name?

You could get it from the breadcrumb...
Code:
{foreach $location item=l name=location} {assign var="total" value=$l@total} {if $l@index eq $total - 2} {assign var="root_category" value=$l.0|amp} {/if} {/foreach} {if $root_category}{$root_category}{/if}
__________________
xcartmods.co.uk
Reply With Quote

The following 2 users thank PhilJ for this useful post:
peggyr (03-21-2022), www.cheapglasses.net (03-18-2022)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:49 PM.

   

 
X-Cart forums © 2001-2020