1. В бекенде «Сайт» → «Структура» → «Магазин. Настройки» → "Дополнительные параметры" добавить код с идентификаторами нужных характеристик товара(featureButton=список кодов через запятую).
Например:
featureButton=size,color,top_material, sole_material, tsvet, khar1,khar2,khar3
Подробнее смотрите в инструкции авторов темы дизайна.
2. В приложении «Магазин» создать файл под названием alaali.css в разделе «Витрина» во вкладке «Шаблоны» с кодом:
.feature-btn.alaali{ padding: 1px; } .option-item img.alaali{ border-radius: 3px; vertical-align: middle; height: 29px; width: 29px; } .option-item.color span.alaali{ height: auto; width: auto; } .alaali_img2{ border: 1px solid rgba(0,0,0,0.2); margin: 0.2em 0.25em 0 0; vertical-align: top; height: 15px; width: 15px; }
3. Там же («Витрина» → вкладка «Шаблоны») внести изменения в файл head.html:
Найдите код (3 последние строки в файле)
<!-- plugin hook: 'frontend_head' --> {* @event frontend_head.%plugin_id% *} {foreach $frontend_head as $_}{$_}{/foreach}
добавьте после него код
<link rel="stylesheet" href="{$wa_active_theme_url}alaali.css?v{$wa_theme_version}">
4. Там же («Витрина» → вкладка «Шаблоны») внести изменения в файл product.cart.html:
В файле product.cart.html найдите блок кода
<!-- SELECTABLE FEATURES selling mode --> {$default_sku_features = $product.sku_features} {$product_available = $product.status} <div class="options"> {$featureButton = $wa->globals("featureButton")} <span class="bold skus-select-text">[`Please select`]: </span> {foreach $features_selectable as $f} <div class="option-item{if $f.type == 'color'} color{/if}"> <span class="option-name">{$f.name}</span> {if strpos($featureButton, $f.code) !== false} {foreach $f.values as $v_id => $v} <span data-value-id="{$v_id}" class="feature-btn{if $v_id == ifset($default_sku_features[$f.id])} selected{/if}"{if $f.type == 'color'} style="{$v->style}; margin-bottom: 20px;" rel="{$v->style}; margin-bottom: 20px;" rel="{$v->style}; margin-bottom: 20px;" rel="{$v->style}; margin-bottom: 20px;" {/if}> {if $f.type == 'color'}<span class="color_name">{strip_tags($v)}</span>{else}{$v}{/if} </span> {/foreach} {/if} <select data-feature-id="{$f.id}" class="sku-feature{if strpos($featureButton, $f.code) !== false} invisible{/if}" name="features[{$f.id}]"> {foreach $f.values as $v_id => $v} <option value="{$v_id}" {if $v_id == ifset($default_sku_features[$f.id])}selected{/if}>{$v}</option> {/foreach} </select> </div> {/foreach} </div>
исправьте на
<!-- SELECTABLE FEATURES selling mode --> {$default_sku_features = $product.sku_features} {$product_available = $product.status} {$feature_images = shopAlaaliHelper::getFeaturesImg($product.id)} <div class="options"> {$featureButton = $wa->globals("featureButton")} <span class="bold skus-select-text">[`Please select`]: </span> {foreach $features_selectable as $f} <div class="option-item{if $f.type == 'color'} color{/if}"> <span class="option-name">{$f.name}</span> {if strpos($featureButton, $f.code) !== false} {foreach $f.values as $v_id => $v} {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'>"} {/if} {if in_array($v_id,$feature_images[$f.id]['id'])} <span data-value-id="{$v_id}" class="alaali feature-btn{if $v_id == ifset($default_sku_features[$f.id])} selected{/if}">{$v_img}</span> {else} <span data-value-id="{$v_id}" class="feature-btn{if $v_id == ifset($default_sku_features[$f.id])} selected{/if}"{if $f.type == 'color'} style="{$v->style};"{/if}> {if $f.type == 'color'} <span class="color_name">{strip_tags($v)}</span> {else} {$v} {/if} {/if} </span> {/foreach} {/if} <select data-feature-id="{$f.id}" class="sku-feature{if strpos($featureButton, $f.code) !== false} invisible{/if}" name="features[{$f.id}]"> {foreach $f.values as $v_id => $v} <option value="{$v_id}" {if $v_id == ifset($default_sku_features[$f.id])}selected{/if}>{$v}</option> {/foreach} </select> </div> {/foreach} </div>
5. Там же («Витрина» → вкладка «Шаблоны») внести изменения в файл product.html:
Найдите код
{if $product.features} <!-- product features --> <div class="tab-name-print show-print"><h2>[`Features`]</h2></div> <div id="tab2" class="tab-content show-print"> <table class="features" id="product-features"> {foreach $product.features as $f_code => $f_value} <tr class="{if $f_value@iteration is div by 2}new-background{/if}{if $f_value@last} no-border{/if}{if $features[$f_code].type == 'divider'} divider{/if}"> <td class="name"> {$features[$f_code].name|escape} </td> <td class="value" itemprop="{$f_code|escape}"> {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 $product.features} <!-- product features --> {$feature_images = shopAlaaliHelper::getFeaturesImg_code($product.id,false)} <div class="tab-name-print"><h2>[`Features`]</h2></div> <div id="tab2" class="tab-content"> <table class="features" id="product-features"> {foreach $product.features as $f_code => $f_value} <tr{if $features[$f_code].type == 'divider'} class="divider"{/if}> <td class="name">{$features[$f_code].name|escape}</td> <td class="value" itemprop="{$f_code|escape}"> {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} {$value}<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} {$value|escape}<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} {$f_value|escape}<br /> {/if} {/if} </td> </tr> {/foreach} </table> </div> {/if}
0 комментариев