【发布时间】:2014-03-25 14:06:19
【问题描述】:
我需要在我的产品页面(在 prestashop 中)的属性之间添加我自己的行。在我的例子中,在“大小”之后是一个属性标签,group_5“大小”-> 在该属性之后添加类似:“在我们的指南中查找您的大小。”
添加此代码:
<p class="find">Find your size in our guide <a href="htttp://bijutaniki.com/#">here</a></p>
最终的样子应该是这样的:
在 product.tpl 中看起来像:
<div class="product_attributes">
{if isset($groups)}
<!-- attributes -->
<div id="attributes">
<div class="clear"></div>
{foreach from=$groups key=id_attribute_group item=group}
{if $group.attributes|@count}
<fieldset class="attribute_fieldset">
<label class="attribute_label" for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} : </label>
{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" /><br />
{/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}
</div>
{/if}
【问题讨论】:
-
您的问题是什么?你知道把它放在哪里,你知道该放什么..
-
如果您想要它放在控制台中的位置,那么几乎在底部,
</fieldset>下方就是您放置它的位置。 -
没有。如果我把它放在那里,每个属性之后都会显示新代码。我可以在这里看到它:bijutaniki.com/prysteni/8-prysten-na-nastroenieto.html我只想在大小之后显示此代码(保加利亚语为размер)。
-
然后在
{if}语句之间尝试{if ($group.group_type == 'select')}。但是,这将对所有下拉属性执行此操作。所以如果你有更多,你需要创建另一个 IF 来检查size -
我在一些产品上有更多的下拉属性。所以我需要为 group_5 添加其他“如果”(在我的情况下是大小)如何正确添加它 - 请原谅我这个愚蠢的问题?
标签: php html smarty prestashop prestashop-1.6