Prestashop:显示产品的所有属性引用


Prestashop: show all attribute references of a product

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

在产品页面中,显示具有此 2 个属性的"选择",以及此"选择"右侧的文本,该文本使用参考编号进行更新(如果您选择 100 单位框,则文本将使用此属性的 de 参考编号更新,如果您选择 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}

尝试:

{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}