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

标签 php html css prestashop

我在商店的每个产品中添加了组合。这种组合是“包装”并具有 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}

最佳答案

尝试:

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

关于php - Prestashop:显示产品的所有属性引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38240458/

相关文章:

html - 根据媒体宽度显示div的滚动条

jquery - 当我使用 sDom 从数据表的工具栏中删除元素时,我也失去了背景颜色

php - 当其中一个条件不成立时如何避免在 php 中出现通知

php - 如何在 laravel eloquent 中为左连接表添加别名

javascript - 如何在同一页面上的多个按钮上打开一个 Bootstrap 模式?

javascript - jQuery Masonry 未正确对齐或填充网格中的图像

jquery - 当设备屏幕较小时移除 div 元素的边框

javascript - 测试客户端是否支持 css prop。重复后代码中断

php - 在 Laravel 中进行了多次日期验证

php - SOAP 调用中的数组(字符串?)参数