X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   how to get a product root category name? (https://forum.x-cart.com/showthread.php?t=75298)

Eyeglasses Expert 05-04-2017 04:04 PM

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?

qualiteam 05-04-2017 08:34 PM

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).

Eyeglasses Expert 05-06-2017 12:31 PM

Re: how to get a product root category name?
 
would you pls teach me the details? tks

cherie 05-06-2017 01:02 PM

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.

PhilJ 03-18-2022 10:45 AM

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}



All times are GMT -8. The time now is 10:20 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.