Jump to content

Display product short description on product listing page in PS 1.6.0.9


Recommended Posts

 

Open yourdomain/themes/default-bootstrap/css/product_list.css and find this:

ul.product_list.grid > li .product-container .product-desc {
    display: none;
}

Change to: display:block;

 
 

 

Couldnt find this option , cant I make adjustment in product-list,tpl to make short desc appear just like on product detail page?

 

Thanks

  • Like 1
Link to comment
Share on other sites

try to use somewhere in product-list.tpl

{$product.description_short|strip_tags:'UTF-8'}

if it will appear - place this code there where you want to display short description

if it is a custom theme as dioniz suspected - search for this code there (in product-list.tpl)

Link to comment
Share on other sites

try to use somewhere in product-list.tpl

{$product.description_short|strip_tags:'UTF-8'}

if it will appear - place this code there where you want to display short description

if it is a custom theme as dioniz suspected - search for this code there (in product-list.tpl)

Found the code in prodcut-list.tpl

Check it 

{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}

I remvoed next part and use your code only but it still same yes its custom theme below is my product-list.tpl code

 

{*

* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
 
{if isset($products)}
<script>
jQuery(document).ready(function($){
    var default_view = "{$theme_options['product_list_layout']}";
theid = $('a.switcher').attr("id"),
theproducts = $("ul#product_list"),
classNames = $('a.switcher').attr('class').split(' '),
gridthumb = "{$base_dir}themes/control/images/grid-default-thumb.png",
listthumb = "{$base_dir}themes/control/images/list-default-thumb.png";
 
    if($.cookie('view') !== 'undefined'){
        $.cookie('view', default_view, { expires: 7, path: '/' });
    } 
    function get_grid(){
$('#gridview').addClass("active");
$("#listview").removeClass("active");
 
$("#listview").children("img").attr("src","{$base_dir}themes/control/images/list-view.png");
 
var theimg = $('#gridview').children("img");
theimg.attr("src","{$base_dir}themes/control/images/grid-view-active.png");
 
theproducts.removeClass("list");
theproducts.addClass("grid");
 
$("img.thumb").attr("src",gridthumb);
    }
    function get_list(){
$('#listview').addClass("active");
$("#gridview").removeClass("active");
 
$("#gridview").children("img").attr("src","{$base_dir}themes/control/images/grid-view.png");
 
var theimg = $('#listview').children("img");
theimg.attr("src","{$base_dir}themes/control/images/list-view-active.png");
 
theproducts.removeClass("grid")
theproducts.addClass("list");
 
$("img.thumb").attr("src",listthumb);
    }
 
    if($.cookie('view') == 'list'){ 
$('#listview').addClass("active");
$("#gridview").removeClass("active");
 
$("#gridview").children("img").attr("src","{$base_dir}themes/control/images/grid-view.png");
 
var theimg = $('#listview').children("img");
theimg.attr("src","{$base_dir}themes/control/images/list-view-active.png");
 
theproducts.removeClass("grid")
theproducts.addClass("list");
 
$("img.thumb").attr("src",listthumb);
    } 
 
    if($.cookie('view') == 'grid'){ 
$('#gridview').addClass("active");
$("#listview").removeClass("active");
 
$("#listview").children("img").attr("src","{$base_dir}themes/control/images/list-view.png");
 
var theimg = $('#gridview').children("img");
theimg.attr("src","{$base_dir}themes/control/images/grid-view-active.png");
 
theproducts.removeClass("list");
theproducts.addClass("grid");
 
$("img.thumb").attr("src",gridthumb);
    }
 
    $('#listview').click(function(e){   
        $.cookie('view', 'list'); 
        get_list();
e.preventDefault();
    });
 
    $('#gridview').click(function(e){ 
        $.cookie('view', 'grid'); 
        get_grid();
e.preventDefault();
    });
 
});
</script>
<!-- Products list -->
<ul id="product_list" class="nolist grid">
{foreach from=$products item=product name=products}
{if $theme_options['global_layout'] == full}
<li class="col-lg-3 col-sm-4 col-xs-6 col-ms-12">
{else}
<li class="col-lg-4 col-sm-6 col-xs-6 col-ms-12">
{/if}
<div>
 
{if $theme_options['control_quickview'] == '1'}
<a class="quick-view" href="{$product.link|escape:'html':'UTF-8'}" rel="{$product.link|escape:'html':'UTF-8'}">
<i class="fa fa-search"></i> {l s='Quick view'}
</a>
{/if}
 
<p class="icons">
{if isset($product.new) && $product.new == 1}<span class="new_list">{l s='New'}</span>{/if}
{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale_list">{l s='Sale'}</span>
{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount_list">{l s='Promotion'}</span>{/if}
</p>
<a class="product_img" href="{$product.link|escape:'html'}"><img class="img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'ph_home')|escape:'html'}" alt="{$product.name|escape:'htmlall':'UTF-8'}" /></a>
<div class="desc">
<h3><a href="{$product.link|escape:'html'}" title="{l s='see product'} {$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:55:'...'|escape:'htmlall':'UTF-8'}</a></h3>
<p class="p_desc">
{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
</p>
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
<span class="price">
{if !$priceDisplay}
{convertPrice price=$product.price}
{else}
{convertPrice price=$product.price_tax_exc}
{/if}
 
{hook h="displayProductPriceBlock" product=$product type="price"}
{hook h="displayProductPriceBlock" product=$product type="unit_price"}
 
{if isset($product.reduction) && $product.reduction && $theme_options['control_display_price_wo_reduction']}
{hook h="displayProductPriceBlock" product=$product type="old_price"}
<span class="price_without_reduction">
{convertPrice price=$product.price_without_reduction}
</span>
{/if}
</span>
{/if}
{/if}
 
<div class="displayProductDeliveryTime displayProductPriceBlock">
{hook h="displayProductDeliveryTime" product=$product}
{hook h="displayProductPriceBlock" product=$product type="weight"}
</div>
 
<div class="info">
<div class="buttons-wrapper">
{if $theme_options['control_display_add2cart']}
{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
{if ($product.allow_oosp || $product.quantity > 0)}
{if isset($static_token)}
<a class="ajax_add_to_cart_button pull-left button yellow" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{else}
<a class="ajax_add_to_cart_button pull-left button yellow" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{/if}
{else}
 
{/if}
{/if}
{/if}
 
{if !$product.available_for_order || isset($restricted_country_mode) || $product.quantity < 1 && !$product.allow_oosp}
{if $theme_options['control_display_noavailable_text']}
<span class="noavailable_text">{$theme_options['control_noavailable_text']}</a></span>
{/if}
{/if}
 
{if $theme_options['control_display_view']}
<a href="{$product.link|escape:'html'}" title="{l s='View product'}" class="pull-right button">{l s='View product'}</a>
{/if}
</div>
{hook h='displayProductCommentsOnList' id_product=$product.id_product}
{hook h='displayProductListActionsButton' id_product=$product.id_product}
</div><!-- .info -->
</div><!-- .desc -->
<div class="link-col">
{if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
{if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}<span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span>{/if}
{/if}
{if $theme_options['control_display_add2cart']}
{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
{if ($product.allow_oosp || $product.quantity > 0)}
{if isset($static_token)}
<a class="ajax_add_to_cart_button pull-left button yellow" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{else}
<a class="ajax_add_to_cart_button pull-left button yellow" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
{/if}
{else}
{/if}
{/if}
{/if}
{if $theme_options['control_display_view']}
<a href="{$product.link|escape:'html'}" title="{l s='View product'}" class="pull-right button">{l s='View product'}</a>
{/if}
</div><!-- .link-col -->
</div>
</li>
{/foreach}
</ul>
<!-- /Products list -->
{/if}
 

how can I change the Categories block back ground and font size ? using block category module in prestashop 1.6.9?

Edited by lovemyseo (see edit history)
Link to comment
Share on other sites

so simply, your code is in <p class="p_desc"> paragraph

<p class="p_desc">
{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
</p>

you can try to change class name, for example class="my_p_desc" :) after that  styles for class="p_desc" that are somewhere defined will not be used for this paragraph

Link to comment
Share on other sites

so simply, your code is in <p class="p_desc"> paragraph

<p class="p_desc">
{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
</p>

you can try to change class name, for example class="my_p_desc" :) after that  styles for class="p_desc" that are somewhere defined will not be used for this paragraph

So final code will be <p class="my_p_desc"} or <p clas="short_description"}

Link to comment
Share on other sites

so simply, your code is in <p class="p_desc"> paragraph

<p class="p_desc">
{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
</p>

you can try to change class name, for example class="my_p_desc" :) after that  styles for class="p_desc" that are somewhere defined will not be used for this paragraph

OK issue resolved please mark it as resolved thanks

Link to comment
Share on other sites

  • 5 months later...
  • 1 month later...

try to use somewhere in product-list.tpl

{$product.description_short|strip_tags:'UTF-8'}

if it will appear - place this code there where you want to display short description

if it is a custom theme as dioniz suspected - search for this code there (in product-list.tpl)

Also is it possible to display html tags e.g bold, italic, bullets, numbers on product listing page ? right now it appear as plan text no formatting?

Link to comment
Share on other sites

  • 1 year later...

Hello is what we have in our product-list.tpl

thema leo bestbuy ...

 

----------------------------------------------------------------------------------------

 

 

{*
* 2007-2015 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2015 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
{include file="$tpl_dir./layout/setting.tpl"}
{if isset($products) && $products}
{*define numbers of product per line in other page for desktop*}
        {if isset($class)}
            {*only display grid mode when include from other module*}
            {assign var="LISTING_GRIG_MODE" value="grid" scope="global"}
            {assign var='nbItemsPerLine' value=$LISTING_PRODUCT_COLUMN_MODULE}
            {if $LISTING_PRODUCT_COLUMN_MODULE=="5"}
                {assign var="colValue" value="col-xs-{12/$LISTING_PRODUCT_MOBILE} col-sm-{12/$LISTING_PRODUCT_TABLET} col-md-2-4 col-sp-12" scope="global"}
            {else}
                {assign var="colValue" value="col-sp-12 col-xs-{12/$LISTING_PRODUCT_MOBILE} col-sm-{12/$LISTING_PRODUCT_TABLET} col-md-{12/$LISTING_PRODUCT_COLUMN_MODULE}" scope="global"}
            {/if}
        {else}
            {assign var='nbItemsPerLine' value=$LISTING_PRODUCT_COLUMN}
{/if}
        {assign var='nbItemsPerLineTablet' value=$LISTING_PRODUCT_TABLET}
        {assign var='nbItemsPerLineMobile' value=$LISTING_PRODUCT_MOBILE}
{*define numbers of product per line in other page for tablet*}
{assign var='nbLi' value=$products|@count}
{math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
{math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet}
<!-- Products list -->
<div {if isset($id) && $id} id="{$id}"{/if} class="product_list {$LISTING_GRIG_MODE} row {if isset($class) && $class} {$class}{/if}">
{foreach from=$products item=product name=products}
{math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo}
{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet}
{math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile}
{if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
{if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if}
{if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if}
<div class="ajax_block_product col-sp-12 {$colValue}{if $smarty.foreach.products.iteration%$nbItemsPerLine == 0} last-in-line
{elseif $smarty.foreach.products.iteration%$nbItemsPerLine == 1} first-in-line{/if}
{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModulo)} last-line{/if}
{if $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 0} last-item-of-tablet-line
{elseif $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 1} first-item-of-tablet-line{/if}
{if $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 0} last-item-of-mobile-line
{elseif $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 1} first-item-of-mobile-line{/if}
{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModuloMobile)} last-mobile-line{/if}">
{include file="$tpl_dir./product-item.tpl" callFromModule=isset($class)}
</div>
{/foreach}
</div>
{addJsDefL name=min_item}{l s='Please select at least one product' js=1}{/addJsDefL}
{addJsDefL name=max_item}{l s='You cannot add more than %d product(s) to the product comparison' sprintf=$comparator_max_item js=1}{/addJsDefL}
{addJsDef comparator_max_item=$comparator_max_item}
{addJsDef comparedProductsIds=$compared_products}
{/if}
 
-----------------------------------------------------------------
 
What should I change
tank you
Link to comment
Share on other sites

  • 3 months later...

my product list. tpl contains:

 

<p class="product-desc" itemprop="description">
{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}
</p>
 
but in the frontend the value appears as undefined , 
 
I'm using PS 1.6.1.0
 
anyone knows the reason? THANKS!
 
 
 
Venta a Precios Netos - Lote 0001

undefined

Edited by pegasus6464 (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Hello guys,

 

I would like to ask if it is possible to do this via javascript and not .tpl? I would like to display short product description on ajax cart pop up and in case I use .tpl it returns previous product description.

 

Best regards

 

Rob

Edited by Rollaen (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...