Jump to content

assigning database field to tag in template file


Recommended Posts

hi,

 

please bear with me as I might not be using the correct terminology here, but I will try to describe what I am trying to accomplish.

 

I have bought a custom theme, JMS fresh food. I think that the two files I need to edit are the same as the default 1.6 theme, so here goes:

 

For my own reasons I need a truncated short description in the breadcrumbs.tpl

 

In product.tpl I see the following snippet of code:

{if $product->description_short}
<div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description_short}</div>
{/if}

I presume that this is where the short description is generated for the product page. If I transplant this snippet into the correct(?) position in breadcrumb.tpl, nothing happens. I don't see my text.

 

this is what I have done (added three lines towards the bottom):

<div class="content_scene_cat block" {if $category->id_image}style="background-image:url({$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category_default')});background-repeat:no-repeat;background-size:cover;"{/if}>
			<div class="cat-info">
				<div class="cat-info-inner container">
					<span class="category-name">
						{strip}
							{$category->name|escape:'html':'UTF-8'}
							{if isset($categoryNameComplement)}
								{$categoryNameComplement|escape:'html':'UTF-8'}
							{/if}
						{/strip}
					</span>
				</div>	
			{if $product->description_short}
				<div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description_short}</div>
			{/if}
				
			</div>            			
		</div>

Are the variables assigned per tpl file? if so how do I make prestashop know where to find this variable?

 

Please, if anyone knows (and I am sure someone does) explain in baby steps, as I am not a programmer.... just an enthusiast!

 

regards,

dave.

Edited by David S Johnston (see edit history)
Link to comment
Share on other sites

Try to use this snippet to truncate the description to 200 characters

{if $product->description_short}
<div id="short_description_content" class="rte align_justify" itemprop="description">{$product->description_short|strip_tags:'UTF-8'|truncate:200:'...'}</div>
{/if}
Link to comment
Share on other sites

Hi Tuk66,

 

thanks for your reply, but I think I was unclear of my intentions. I realize that I need to use the truncate modifier, but I don't see how to get the short description to be displayed by the breadcrumb.tpl file.

 

 

damn, I just realized that I was looking at this all wrong. In the back office there is also a Category description, I now need to see if there is any way of displaying the category description in the header, just under the Category name.

 

Thanks for your help,

Dave.

Edited by David S Johnston (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...