0

我在商店的每种产品中添加了组合。这种组合是“包装”,有 2 个属性:100 单位盒和 200 单位盒。每个属性都有一个参考编号。

在产品页面中,显示具有这 2 个属性的“选择”,并且此“选择”右侧的文本会随参考编号更新(如果您选择 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}
4

1 回答 1

0

尝试:

{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}
于 2016-07-07T10:27:38.247 回答