X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Displaying Category Name in a Product Description (https://forum.x-cart.com/showthread.php?t=49556)

ecollier2012 09-05-2009 01:46 PM

Displaying Category Name in a Product Description
 
I need to show the current Category Name within the product description. How can this be done.

Example:

If a customer is in the following category...

TV Repair Kits > Sony > KP-57WS500

The product description would automaticaly include the "KP-57WS500" category in the descrition like this...

.................................................. .........
Sony Projection TV Repair Kit for model number "KP-57WS500"

* Screen looks distorted, 3D, etc.
* One or more colors can't be adjusted when when using the convergence menu.
* Video looks bowed or warped

cflsystems 09-05-2009 03:40 PM

Re: Displaying Category Name in a Product Description
 
Try this: in product.tpl insert
Code:

{$product.producttitle} for {$current_category.category}
just before the call for $product.descr

ecollier2012 09-06-2009 06:57 PM

Re: Displaying Category Name in a Product Description
 
Thanks Steve,

That works but seems to be global. What I would like is to add this per product or per category. I may just add an if/then statement.

Is there any way to put $current_category.category within the actual product description text?

Ed

cflsystems 09-07-2009 07:43 AM

Re: Displaying Category Name in a Product Description
 
Not sure if you insert $current_category.category directly into the descr will it work, try. Also you can try substitute - you can do like this: in description insert {{category_text}} where you want it to appear and then when you call the descr in product.tpl do like this
{$product.descr|substitute:"category_text":$curren t_category.category}. Not sure if this will work either :)

topspin6711 11-04-2012 10:10 AM

Re: Displaying Category Name in a Product Description
 
I found this old post when trying to do the same thing... or close to. I want to have a simple link "Back to {Category Name}" on my product pages.

Here's what I came up with that works for me on 4.5.2 using the $location loop I found in breadcrumbs.tpl. I created a new language variable and made a custom breadcrumbs.tpl file which I call only for the product pages.

{if $location}
{foreach from=$location item=l name=location}
{if $smarty.foreach.location.index == $smarty.foreach.location.total - 2}
<div class="backtocat">
<div class="label">
<a href="{$l.1|amp}"><div class="icon"></div>{$lng.lbl_back_to} {$l.0}</a>
</div>
</div>
{/if}
{/foreach}
{/if}


All times are GMT -8. The time now is 05:42 PM.

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