Jump to content

Limit number of products in Products of same category Module - Prestashop 1.6


Recommended Posts

How to limit the number of product of this module ? (prestashop 1.6)

 

I have this code:

{if count($categoryProducts) > 0 && $categoryProducts !== false}

<section class="blockproductscategory">
	<h3 class="productscategory_h3 ">{l s='Related Products' mod='productscategory'}</h3>
	<div id="productscategory_list" class="clearfix">
		<ul class="related-product">
             {foreach from=$categoryProducts item='categoryProduct' name=categoryProduct}
              
              
			<li class="product-box item">
				<a href="{$link->getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category, $categoryProduct.ean13)}" class="lnk_img product-image" title="{$categoryProduct.name|htmlspecialchars}">
					<img class="img_1" src="{$link->getImageLink($categoryProduct.link_rewrite, $categoryProduct.id_image, 'small_default')|escape:'html':'UTF-8'}" alt="{$categoryProduct.name|htmlspecialchars}" />
					
				</a>
				<div class="related-content">
                
					<h5 class="product-name">
						<a href="{$link->getProductLink($categoryProduct.id_product, $categoryProduct.link_rewrite, $categoryProduct.category, $categoryProduct.ean13)|escape:'html':'UTF-8'}" title="{$categoryProduct.name|htmlspecialchars}">{$categoryProduct.name|truncate:54:'...'|escape:'html':'UTF-8'}</a>
					</h5>
					{if $ProdDisplayPrice AND $categoryProduct.show_price == 1 AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}
                    
                  
					<p class="price_display">
						<span class="price{if isset($categoryProduct.specific_prices) && $categoryProduct.specific_prices} special-price{/if}">{convertPrice price=$categoryProduct.displayed_price}</span>
					{if isset($categoryProduct.specific_prices.reduction) && $categoryProduct.specific_prices.reduction && $categoryProduct.specific_prices.reduction_type == 'percentage'}<span class="price-percent-reduction small">-{$categoryProduct.specific_prices.reduction * 100}%</span>{/if}
					{if isset($categoryProduct.specific_prices) && $categoryProduct.specific_prices}<span class="old-price">{displayWtPrice p=$categoryProduct.price_without_reduction}</span>{/if}
					</p>
					{else}
					<br />
					{/if}
					{hook h='displayProductListReviews' product=$product}
				</div>
			</li>
		{/foreach}
		</ul>
	</div>
</section>
{/if}


Link to comment
Share on other sites

I resolve,

 

 {foreach from=$categoryProducts item='categoryProduct' name=categoryProduct}
               {if $smarty.foreach.categoryProduct.iteration eq 6} 
           {break}    
        {/if} 
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...