在表格中显示产品属性Prestashop
问题描述:
使用prestashop。在表格中显示产品属性Prestashop
我有一个产品,我需要的表格形式的这样http://www.solopress.com/leaflet-printing/bond-leaflet.html
所以它两端有纸张尺寸顶部显示这些设置的属性和各行的纸的数量。
在我的后端我有属性数量为250/500等等等等和尺寸A4/A5/A6等
有没有什么办法可以拉从下拉菜单的属性,并列出它们作为桌子的价格是一个添加到购物车按钮?
任何有用的代码或输入位都会很好。
非常感谢!
答
这绝对不是一个答案,但应该让你对问题本身负责。
您的文本不太清楚,但我会假设您并不是说您创建了新的属性值,并将它们分配在组合标记下。
您必须在product.tpl文件中创建特定的表结构(如需要),并通过smarty forach循环显示具体的attrbitues。
默认情况下,属性有三种组类型:select,color,radio。您可以添加新的属性,但数据库本身没有改动(不知道您是否可以通过管理面板添加它们),组类型将保持不变。
这里是product.tpl文件中的代码,可以帮助你
{foreach from=$groups key=id_attribute_group item=group}
{if $group.attributes|@count}
<fieldset class="attribute_fieldset span5">
<div id="attribute_label_container">
<label class="attribute_label" for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} : </label>
</div>
{assign var="groupName" value="group_$id_attribute_group"}
<div class="attribute_list">
{if ($group.group_type == 'select')}
<select name="{$groupName}" id="group_{$id_attribute_group|intval}" class="attribute_select" onchange="findCombination();getProductAttribute();">
{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:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}</option>
{/foreach}
</select>
{elseif ($group.group_type == 'color')}
<ul id="color_to_pick_list" class="clearfix">
{assign var="default_colorpicker" value=""}
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li{if $group.default == $id_attribute} class="selected"{/if}>
<a id="color_{$id_attribute|intval}" class="color_pick{if ($group.default == $id_attribute)} selected{/if}" style="background: {$colors.$id_attribute.value};" title="{$colors.$id_attribute.name}" onclick="colorPickerClick(this);getProductAttribute();">
{if file_exists($col_img_dir|cat:$id_attribute|cat:'.jpg')}
<img src="{$img_col_dir}{$id_attribute}.jpg" alt="{$colors.$id_attribute.name}" width="20" height="20" />
{/if}
</a>
</li>
{if ($group.default == $id_attribute)}
{$default_colorpicker = $id_attribute}
{/if}
{/foreach}
</ul>
<input type="hidden" class="color_pick_hidden" name="{$groupName}" value="{$default_colorpicker}" />
{elseif ($group.group_type == 'radio')}
<ul>
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li>
<input type="radio" class="attribute_radio" name="{$groupName}" value="{$id_attribute}" {if ($group.default == $id_attribute)} checked="checked"{/if} onclick="findCombination();getProductAttribute();" />
<span>{$group_attribute|escape:'htmlall':'UTF-8'}</span>
</li>
{/foreach}
</ul>
{/if}
</div>
</fieldset>
{/if}
{/foreach}
这将在列表中显示的结果,你可以看到。要使其显示在表格结构中,只需编辑正确的group_type IF内容即可。
我希望它能帮助你一点。
BR's