Jump to content

Problem with Responsive Columns PS 1.6


Recommended Posts

Hi all,

I have a problem with responsive columns, my web at normal desktop have 6 columns of product, in an Tablet have 3 columns and in a Smartphone have 2 columns.

At desktop vision I have any problem.

 

post-785181-0-97484700-1410951902_thumb.jpg

 

At the horizontal of smartphone and tablet anyone too.

 

post-785181-0-76135900-1410951903_thumb.jpg

 

post-785181-0-85887400-1410951904_thumb.jpg

 

 

But when I put smartphone or tablet at vertical this happen.

 

post-785181-0-37051100-1410951904_thumb.jpg

 

post-785181-0-37975900-1410951905_thumb.jpg

 

I know that the problem is in this code (product-lit.tpl) but I don't know what else change.

 

{if isset($products) && $products}
	{*define numbers of product per line in other page for desktop*}
	{if $page_name !='index' && $page_name !='product'}
		{assign var='nbItemsPerLine' value=6}
		{assign var='nbItemsPerLineTablet' value=3}
		{assign var='nbItemsPerLineMobile' value=2}
	{else}
		{assign var='nbItemsPerLine' value=6}
		{assign var='nbItemsPerLineTablet' value=2}
		{assign var='nbItemsPerLineMobile' value=3}
	{/if}
	{*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 -->
	<ul{if isset($id) && $id} id="{$id}"{/if} class="product_list grid row{if isset($class) && $class} {$class}{/if}{if isset($active) && $active == 1} active{/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}
		<li class="ajax_block_product{if $page_name == 'index' || $page_name == 'product'} col-xs-6 col-sm-4 col-md-4 col-lg-2{else} col-xs-6 col-sm-4 col-md-4 col-lg-2{/if}{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 == 0} first-item-of-tablet-line{/if}{if 
		$smarty.foreach.products.iteration%$nbItemsPerLineMobile == 1} last-item-of-mobile-line{elseif 
		$smarty.foreach.products.iteration%$nbItemsPerLineMobile == 0} first-item-of-mobile-line{/if}
		{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModuloMobile)} last-mobile-line{/if}">

Thanks a lot.

Link to comment
Share on other sites

  • 3 months later...
  • 1 month later...
  • 2 months later...

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...