Prestashop: показать все атрибуты продукта
Я добавил комбинации в каждый товар моего магазина. Эта комбинация является "упаковкой" и имеет 2 атрибута: коробка на 100 единиц и коробка на 200 единиц. Каждый атрибут имеет ссылочный номер.
На странице продукта отображается "select" с этими 2 атрибутами, а справа от этого "select" текст, который обновляется с помощью ссылочного номера (если вы выберете поле "100 единиц", текст обновится с указанием номера этого атрибута, и если вы выберете 200 единиц, поле с номером ссылки будет заменено другим номером ссылки, но НИКОГДА вы не увидите оба номера ссылок на одном и том же).
То, что я хочу, это показать список этих атрибутов и ссылок вместо "выбрать", мне нужно, чтобы отображать атрибуты и ссылки одновременно.
Теперь это мой код (в product.tpl):
<select style="float: left; margin-right: 15px; height: 23px; padding:0px; padding-bottom: 0px;" 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}supplier_reference
</select>
{if isset($FIELD_productShowReference) && $FIELD_productShowReference || !isset($FIELD_productShowReference)}
<p style="padding-top: 3px;" id="product_reference"{if empty($product->reference) || !$product->reference} style="display: none;"{/if}>
<label class="texto-referencia" style="float: left; font-size: 15px; margin-right: -5px;">{l s='Ref:'}</label>
<span class="editable num-referencia" itemprop="sku" style="font-size: 15px;">{if !isset($groups)}{$product->reference|escape:'html':'UTF-8'}{/if}</span>
</p>
{/if}
1 ответ
Попробуйте с:
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<input type="radio" name="{$groupName}" value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} checked="checked"{/if}
{/foreach}
{if isset($FIELD_productShowReference) && $FIELD_productShowReference || !isset($FIELD_productShowReference)}
<p style="padding-top: 3px;" id="product_reference"{if empty($product->reference) || !$product->reference} style="display: none;"{/if}>
<label class="texto-referencia" style="float: left; font-size: 15px; margin-right: -5px;">{l s='Ref:'}</label>
<span class="editable num-referencia" itemprop="sku" style="font-size: 15px;">{if !isset($groups)}{$product->reference|escape:'html':'UTF-8'}{/if}</span>
</p>
{/if}