|
Группа: Пользователь
Ранг: Новичек
Регистрация: 05.11.2009
Город: Москва
|
версия koobi 6.25
Здравствуйте! Появился актуальный вопрос:
Как вывести товары на главное в несколько столбцов. (По умолчанию, новые товары магазина выводятся либо в 1 столбик, либо в 2... Хотелось бы, чтобы можно было вывести товары по 3 или 4 на строку. Как это сделать? Вот код шаблона, который выводит товары на главной:
{if checkactive('shop')}
{strip}
{assign var="cols" value=$max_tds}
<div class="box_innerhead">{$lang.shop_new_atstore}</div>
{foreach from=$articles item=file}
<div class="{cycle name='np' values='container_newproducts_1,container_newproducts_2'}">
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td colspan="2">
<a href="{get_itemurl_bynumber n=$file->artnumber}"><strong>{$file->title}</strong></a>
</td>
</tr>
<tr>
<td width="20%" valign="top">
{assign var="newtr" value=$newtr+1}
{if $file->icon!=''}
<a href="{get_itemurl_bynumber n=$file->artnumber}"><img src="system/shopthumb.php?smode=5&img={$file->icon}" alt="" border="0" style="padding-right:5px" /></a>
{else}
<a href="{get_itemurl_bynumber n=$file->artnumber}"><img src="{$img_shop}/no_image_small.gif" border="0" alt="" /></a>
{/if}
{if $file->fsk18==1}
<br />
<a href="/index.php?p=shop&action=fsk18&area={$area}"><img src="{$img_shop}/fsk18.gif" border="0" alt="" /></a>
{/if}</td>
<td>
{$file->descr_short|truncate:90}
<div class="shop_product_price_big">
{$file->price|string_format:"%.2f"} {$currency_symbol}
</div>
{if $file->netto_price > '0' && $show_netto==1}
<div align="right"><small>{$file->netto_price|string_format:"%.2f"} {$currency_symbol} {$lang.netto}</small></div>
{/if}
{if $file->unit_count > 0}
<div align="right">
<small>1 {$file->UnitName}: {$file->price_once|string_format:"%.2f"} {$currency_symbol}<br />{$file->unit_count} {$file->UnitNameMz} {$text_includedunits}</small>
</div>
{/if}
<div class="newproducts_detail">
<a class="new_articles" href="{get_itemurl_bynumber n=$file->artnumber}"><img src="{$img_shop}/newproducts_detail.gif" alt="" border="0" /></a>
</div>
{if $newtr % $cols == 0}{/if}
</td>
</tr>
</table>
</div>
{/foreach}
<br />
{/strip}
{/if}
|
Добавлено RASH: 13.11.2010, 12:34:01
или второй вариант last_shoparticles.tpl
{strip}
<br />
{assign var="cols" value=$max_tds}
{* {$lang.shop_new_atstore} *}
{foreach from=$articles item=file name=np}
{assign var="newtr" value=$newtr+1}
<div style="{if $newtr % $cols != 0}float:left;{else}float:right;{/if} width:{math equation='x / y - 2' x=100 y=$cols}%" {if $newtr % $cols != 0}{/if}class="product_newest_box_mleft">
<div class="shop_lastitems"><a class="light" href="{get_itemurl_bynumber n=$file->artnumber}"><strong>{$file->title}</strong></a><br /></div>
<div align="left">
{if $file->price_list > '0'}
{assign var=text_price value=$lang.shop_our_price}
{else}
{assign var=text_price value=$lang.shop_our_price_norm}
{/if}
{if $file->price_list > '0'}
<span class="shop_listprice"> {$lang.shop_norm_price} <span style="text-decoration:line-through"> {$file->price_list|string_format:"%.2f"} {$currency_symbol}</span></span>
{/if}
<span class="shop_product_price_big"><!-- {$text_price} -->{$file->price|string_format:"%.2f"} {$currency_symbol}{$flag_ust}</span>
{if $file->netto_price > '0' && $show_netto==1}
<br />
{$file->netto_price|string_format:"%.2f"} {$currency_symbol} {$lang.netto}
{/if}
{if $file->unit_count > 0}
<br /><br />
<small>1 {$file->UnitName}: {$file->price_once|string_format:"%.2f"} {$currency_symbol}<br />{$file->unit_count} {$file->UnitNameMz} {$text_includedunits}.</small>
{/if}
</div>
<table width="60%"border="0" cellspacing="0" cellpadding="3">
<tr>
<td valign="top">
{if $file->icon!=''}
<a href="{get_itemurl_bynumber n=$file->artnumber}"><img src="system/shopthumb.php?smode=4&img={$file->icon}" alt="" border="0" style="padding-right:5px" /> </a>
{else}
<a href="{get_itemurl_bynumber n=$file->artnumber}"><img src="{$img_shop}/no_image_small.gif" border="0" alt="" /></a>
{/if}
{if $file->fsk18==1}
<br />
<a href="/index.php?p=shop&action=fsk18&area={$area}"><img src="{$img_shop}/fsk18.gif" border="0" alt="" /></a>
{/if}
</td>
<td valign="top">
<div style="height:80px">
{$file->descr_short|truncate:120}
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div style="text-align:right">
<form method="post" action="/index.php?p=shop&action=showbasket&sub=tobasket&fid={$file->artnumber}&area={$area}">
{if $file->amount_store > 0}
{if $file->fsk18==1 && $fsk18!=1}
{else}
<input name="redir" type="hidden" value="{redir}" />
<input type="image" src="{$img_shop}/fast_to_cart_startpage.gif" alt="{$lang.shop_product_buy}" style="border:0px" />
{/if}
{/if}
<a href="{get_itemurl_bynumber n=$file->artnumber}"><img src="{$img_shop}/details_small_startpage.gif" alt="{$lang.showdetails}" border="0" /></a>
</form>
</div>
</td>
</tr>
</table>
</div>
{if $newtr % $cols == 0}
<div style="clear:both">
</div>
{else}
{/if}
{/foreach}
<br />
<div style="clear:both"></div>
{$navi}
{/strip}
|
Спасибо за помощь!
Добавлено RASH: 01.12.2010, 01:16:35
Пожалуйста, обратите внимание на тему, думаю многие знают, как помочь, но попросту не заметили тему... Очень нужно, вопрос актуален!
|