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

Displaying Category Name in a Product Description

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-05-2009, 01:46 PM
 
ecollier2012 ecollier2012 is offline
 

Advanced Member
  
Join Date: Mar 2003
Posts: 85
 

Default 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
__________________
Xcart 4.2.1
Xcart 4.1.9
Reply With Quote
  #2  
Old 09-05-2009, 03:40 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,199
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 09-06-2009, 06:57 PM
 
ecollier2012 ecollier2012 is offline
 

Advanced Member
  
Join Date: Mar 2003
Posts: 85
 

Default 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
__________________
Xcart 4.2.1
Xcart 4.1.9
Reply With Quote
  #4  
Old 09-07-2009, 07:43 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,199
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 11-04-2012, 10:10 AM
 
topspin6711 topspin6711 is offline
 

Member
  
Join Date: May 2010
Posts: 22
 

Default 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}
__________________
X-Cart 4.5.2 Gold Live
X-Cart 4.7.3 Gold Dev
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 03:01 PM.

   

 
X-Cart forums © 2001-2020