Плагин "Картинки как на Али" тема "Unishop"

1. В настройках темы дизайна магазина в разделе "СТРАНИЦА ПРОДУКТА" отключите галку у "Вид выбора опций продукта - селектом"

2. Добавьте в конец шаблона unishop.custom.css следующий код

/*ALAALI*/
.product_options .inline-select a.alaali{
    padding: 0;
    background: none;
    vertical-align: top;
}
.product_options .inline-select a.alaali.selected{
    background: #ffdd54;
}
.product_options .inline-select.color a.alaali{
    width: 40px;
    height: 40px;
    line-height: 10px;
    margin-bottom: 15px;
    background: none;
}
.alaali_img{
    vertical-align: middle;
    border-radius: 3px;
    height: auto;
    width: 40px;
    max-width: unset !important;
}
.product_options .inline-select a.alaali .descr{
    font-size: 9px;
}
.product_options .inline-select a.alaali .descr.color{
    color: white;
}
.product_options .inline-select a.alaali.selected .descr.color{
    color: black;
}
.product_options .inline-select a.alaali.selected .descr{
    color: black;
}
.alaali_img2{ 
    border: 0px solid rgba(0,0,0,0.2); 
    width: 20px;
    vertical-align: top;
}
/*\ALAALI*/

3. Отредактируйте шаблон product.cart.html
Найдите код

{if $product.sku_type}
            <!-- SELECTABLE FEATURES selling mode -->
            {$default_sku_features = $product.sku_features}
            {$product_available = $product.status}
            {if !$theme_settings.product_select_options}
                <div class="product_options options">
                    {foreach $features_selectable as $f}
                        <div class="inline-select{if $f.type == 'color'} color{/if}">
                            <div class="inline-select_title">{$f.name}:</div>
                            {foreach $f.values as $v_id => $v}
                                {if !isset($default_sku_features[$f.id])}{$default_sku_features[$f.id]=$v_id}{/if}
                                <a data-value="{$v_id}" href="#"{if $v_id == ifset($default_sku_features[$f.id])} class="selected"{/if}{if $f.type == 'color'} style="{$v->style};"{/if}>
                                    {if $f.type == 'color'} <i class="fa fa-check color_checkmark"></i>{/if}
                                    {if $f.type != 'color'}{$v}{/if}
                                </a>
                            {/foreach}
                            <input type="hidden" data-feature-id="{$f.id}" class="js-sku-feature" name="features[{$f.id}]" value="{ifset($default_sku_features[$f.id])}">
                        </div>
                    {/foreach}

и замените его на

        {if $product.sku_type}
            <!-- SELECTABLE FEATURES selling mode -->
            {$default_sku_features = $product.sku_features}
            {$product_available = $product.status}
			{$feature_images = shopAlaaliHelper::getFeaturesImg($product.id)}
            {if !$theme_settings.product_select_options}
                <div class="product_options options">
                    {foreach $features_selectable as $f}
                        <div class="inline-select{if $f.type == 'color'} color{/if}">
                            <div class="inline-select_title">{$f.name}:</div>
                            {foreach $f.values as $v_id => $v}
                                {if !isset($default_sku_features[$f.id])}{$default_sku_features[$f.id]=$v_id}{/if}
								{if in_array($v_id,$feature_images[$f.id]['id'])}
									{$v_img = "<img src='"|cat:$feature_images[$f.id]['img'][$v_id]|cat:"' title='"|cat:$feature_images[$f.id]['value'][$v_id]|cat:"' class='alaali_img'>"}
								{/if}
                                {if !isset($default_sku_features[$f.id])}{$default_sku_features[$f.id]=$v_id}{/if}
                                {if in_array($v_id,$feature_images[$f.id]['id'])}
                                    <a data-value="{$v_id}" href="#" class="alaali{if $v_id == ifset($default_sku_features[$f.id])} selected{/if}">
                                        {$v_img}
                                        <span class="descr {if $f.type == 'color'}color{/if}">{strip_tags($v)}</span>
                                    </a>
                                {else}
                                    <a data-value="{$v_id}" href="#"{if $v_id == ifset($default_sku_features[$f.id])} class="selected"{/if}{if $f.type == 'color'} style="{$v->style};"{/if}>
                                        {if $f.type == 'color'} <i class="fa fa-check color_checkmark"></i>{/if}
                                        {if $f.type != 'color'}{$v}{/if}
                                    </a>
                                {/if}
                            {/foreach}
                            <input type="hidden" data-feature-id="{$f.id}" class="js-sku-feature" name="features[{$f.id}]" value="{ifset($default_sku_features[$f.id])}">
                        </div>
                    {/foreach}

4. Отредактируйте шаблон product.html
Найдите код

{if $is_show_features}
                            <div id="product-options" class="js-tab-content content-block {if $theme_settings.product_card_tabs} tab-content_el{/if}{if !$is_show_description} selected{/if}">
                                {if $wa->isMobile() || $theme_settings.product_card_tabs != 1}
                                    <div class="product-tab_head"><h2>[`Characteristics`]</h2></div>
                                {/if}
                                <table class="product_features">
                                    {foreach $product.features as $f_code => $f_value}
                                        <tr class="product_features-item {if $features[$f_code].type == 'divider'} divider{/if}">
                                            <td class="product_features-title">
                                                <span>{$features[$f_code].name|escape}</span>
                                            </td>
                                            <td class="product_features-value">
                                                {if is_array($f_value)}
                                                    {if $features[$f_code].type == 'color'}
                                                        {implode('
', $f_value)} {else} {implode(', ', $f_value)} {/if} {else} {$f_value} {/if} </td> </tr> {/foreach} </table> </div> {/if}

и замените его на

{if $is_show_features}
                            <div id="product-options" class="js-tab-content content-block {if $theme_settings.product_card_tabs} tab-content_el{/if}{if !$is_show_description} selected{/if}">
                                {if $wa->isMobile() || $theme_settings.product_card_tabs != 1}
                                    <div class="product-tab_head"><h2>[`Characteristics`]</h2></div>
                                {/if}
                                {$feature_images = shopAlaaliHelper::getFeaturesImg_code($product.id,false)} 
                                <table class="product_features">
                                    {foreach $product.features as $f_code => $f_value}
                                        <tr class="product_features-item {if $features[$f_code].type == 'divider'} divider{/if}">
                                            <td class="product_features-title">
                                                <span>{$features[$f_code].name|escape}</span>
                                            </td>
                                            <td class="product_features-value">
            {if is_array($f_value)} 
                {if $features[$f_code].type == 'color'} 
                    {foreach $f_value as $v_id => $value} 
                        {if in_array($v_id,$feature_images[$f_code]['id'])} 
                            {$v_img = "<img src='"|cat:$feature_images[$f_code]['img'][$v_id]|cat:"' title='"|cat:$feature_images[$f_code]['value'][$v_id]|cat:"' class='alaali_img2' >"}
                            {$v_img} {$feature_images[$f_code]['value'][$v_id]}<br /> 
                        {else} 
                            <span style="padding-left: 4px; line-height: 150%;">{$value}</span><br /> 
                        {/if} 
                    {/foreach} 
                {else} 
                    {foreach $f_value as $v_id => $value} 
                        {if in_array($v_id,$feature_images[$f_code]['id'])} 
                            {$v_img = "<img src='"|cat:$feature_images[$f_code]['img'][$v_id]|cat:"' title='"|cat:$feature_images[$f_code]['value'][$v_id]|cat:"' class='alaali_img2' >"}
                            {$v_img}<span> {$feature_images[$f_code]['value'][$v_id]}</span><br /> 
                        {else} 
                            <span style="padding-left: 25px; line-height: 150%;">{$value}</span><br /> 
                        {/if} 
                    {/foreach} 
                {/if} 
            {else} 
                {assign var=v_id value=$f_value} 
                {if in_array($v_id,$feature_images[$f_code]['id']) || in_array($v_id,$feature_images[$f_code]['value'])} 
                    {$v_img = "<img src='"|cat:$feature_images[$f_code]['img'][$v_id]|cat:"' title='"|cat:$feature_images[$f_code]['value'][$v_id]|cat:"' class='alaali_img2' >"}
                    {$v_img}<br /> 
                {else} 
                    <span style="padding-left: 25px; line-height: 150%;">{$f_value}</span><br /> 
                {/if} 
            {/if}
                                            </td>
                                        </tr>
                                    {/foreach}
                                </table>
                            </div>
                        {/if}
Опубликовано: 25 ноября 2017
Эта статья была полезна? Да Нет

0 комментариев


    Добавить комментарий

    Чтобы добавить комментарий, зарегистрируйтесь или войдите