madmaxx Posted October 21, 2016 Share Posted October 21, 2016 Witam zrobiłem sobie podział na dwie kolumny na karcie produktów w jednej jest atrybut koloru a w drugiej reszta atrybutów. Teraz tylko nie wiem jak zmienić pętlę wyświetlającą nazwy danych atrybutów tak aby nie potrzebne naglówki się nie wyświetlały. {foreach from=$groups key=id_attribute_group item=group} {if $group.attributes|@count} <fieldset class="attribute_fieldset"> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title"> <label class="attribute_label" {if $group.group_type != 'color' && $group.group_type != 'radio'}for="group_{$id_attribute_group|intval}"{/if}>{$group.name|escape:'html':'UTF-8'} </label> Link to comment Share on other sites More sharing options...
design4VIP Posted October 21, 2016 Share Posted October 21, 2016 ale co znaczy "niepotrzebne" ? czyli ogonie zeby sie nie wyswietlaly czy tylko te puste? jezleli chodzi o te puste to ogolnie rzecz ujmujac, jezlei nie beda przypisane do produktu to nie beda sie wyswweitlac. musisz je usunac z poziomu konfiguracji atrybutow w karcie produktu Link to comment Share on other sites More sharing options...
madmaxx Posted October 24, 2016 Author Share Posted October 24, 2016 ale co znaczy "niepotrzebne" ? czyli ogonie zeby sie nie wyswietlaly czy tylko te puste? jezleli chodzi o te puste to ogolnie rzecz ujmujac, jezlei nie beda przypisane do produktu to nie beda sie wyswweitlac. musisz je usunac z poziomu konfiguracji atrybutow w karcie produktu Wiem że istnieje coś takiego, ale tak jak pisałem wczesniej w pierwszej kolumnie potrzebuje pętli tylko z kolorami a w drugiej z resztą atrybutów. więc teraz mam w pętle tylko nie wiem jak je przeformatować. Załączam cały kod <div class="row"> <!-- column 1 od 2 --> <div class="col-xs-6"> {if isset($groups)} {foreach from=$groups key=id_attribute_group item=group} {$colors.$id_attribute.value|escape:'html':'UTF-8'} {/foreach} <!-- attributes --> <div id="attributes"> <div class="clearfix"></div> {foreach from=$groups key=id_attribute_group item=group} {if $group.attributes|@count} <fieldset class="attribute_fieldset"> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title"> <label class="attribute_label" {if $group.group_type != 'color' && $group.group_type != 'radio'}for="group_{$id_attribute_group|intval}"{/if}>{$group.name|escape:'html':'UTF-8'} </label> </h3></div> <div class="panel-body"> {assign var="groupName" value="group_$id_attribute_group"} <div class="attribute_list"> {if ($group.group_type == 'color')} <ul id="color_to_pick_list" class="clearfix"> {assign var="default_colorpicker" value=""} {foreach from=$group.attributes key=id_attribute item=group_attribute} {assign var='img_color_exists' value=file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')} <li{if $group.default == $id_attribute} class="selected"{/if}> <a href="{$link->getProductLink($product)|escape:'html':'UTF-8'}" id="color_{$id_attribute|intval}" name="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}"{if !$img_color_exists && isset($colors.$id_attribute.value) && $colors.$id_attribute.value} style="background:{$colors.$id_attribute.value|escape:'html':'UTF-8'};"{/if} title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}"> {if $img_color_exists} <img src="{$img_col_dir}{$id_attribute|intval}.jpg" alt="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" title="{$colors.$id_attribute.name|escape:'html':'UTF-8'}" width="20" height="20"/> {/if} </a> </li> {if ($group.default == $id_attribute)} {$default_colorpicker = $id_attribute} {/if} {/foreach} </ul> <input type="hidden" class="color_pick_hidden" name="{$groupName|escape:'html':'UTF-8'}" value="{$default_colorpicker|intval}"/> {/if} </div> </div> </div> <!-- end attribute_list --> </fieldset> {/if} {/foreach} </span> </div> <!-- end attributes --> {/if} </div><!-- end column 1 of 2 --> <!-- column 2 of 2 --> <div class="col-xs-6"> {if isset($groups)} <!-- attributes --> <div id="attributes"> <div class="clearfix"></div> {foreach from=$groups key=id_attribute_group item=group} {if $group.attributes|@count} <fieldset class="attribute_fieldset"> <div class="panel panel-default"> <div class="panel-heading"><h3 class="panel-title"><label class="attribute_label" {if $group.group_type != 'color' && $group.group_type != 'radio'}for="group_{$id_attribute_group|intval}"{/if}>{$group.name|escape:'html':'UTF-8'} </label> </h3></div> <div class="panel-body"> {assign var="groupName" value="group_$id_attribute_group"} <div class="attribute_list"> {if ($group.group_type == 'select')} <select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="form-control attribute_select no-print"> {foreach from=$group.attributes key=id_attribute item=group_attribute} <option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'html':'UTF-8'}">{$group_attribute|escape:'html':'UTF-8'}</option> {/foreach} </select> {elseif ($group.group_type == 'radio')} <ul> {foreach from=$group.attributes key=id_attribute item=group_attribute} <li> <div class="tooltip"> <label style="font-weight: 500;"><input type="radio" class="attribute_radio" name="{$groupName|escape:'html':'UTF-8'}" value="{$id_attribute}" onclick="showPicture({$id_attribute|intval})" {if ($group.default == $id_attribute)} checked="checked"{/if} />{$group_attribute|escape:'html':'UTF-8'} </label> <span class="tooltiptext"><img src="{$img_col_dir}{$id_attribute|intval}.gif" width="420px"></span> </div> </li> {/foreach} </ul> {/if} </div> <!-- end attribute_list --> </div> </div> </fieldset> {/if} {/foreach} </span> </div> <!-- end attributes --> {/if} </div><!-- end column 2 of 2 --> </div> <!-- end product_attributes --><br> Link to comment Share on other sites More sharing options...
design4VIP Posted October 24, 2016 Share Posted October 24, 2016 (edited) nie wiem po co tyle kombinowac... wystarczy jedne {foreach} bez rozbijania "na drobne" i bezsensownego obciazania strony powielonym zapytaniem. skup sie na zmiennej, ktora juz masz wprost wyciagnieta {if $group.group_type != 'color'}..{else}..{/if} tym ustaw sobie bloki wedle np. stylu float=left/right czy klasami bootstrampa. Edited October 24, 2016 by design4VIP (see edit history) Link to comment Share on other sites More sharing options...
endriu107 Posted October 24, 2016 Share Posted October 24, 2016 Dokładnie dla bloku koloru i reszty dajesz sobie np. col-md-6 i już tylko operujesz pull-left/pull-right. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now