Prestashop 1.7点击其他属性时,属性如何变化?
How can the attribute change when other attribute click in Prestashop 1.7?
我是 prestashop 的初学者。单击属性时,我将更改其他属性。
比如我店里有一款汽车产品,关于汽车的宽度有“2m”、“3m”、“4m”三个属性。
这辆车的价格是 500 美元。 “2m”属性将汽车产品的价格提高到 2+USD。 “3m”属性将汽车产品的价格提高到 3+USD。 “4m”属性将汽车产品的价格提高到 4+USD。
现在,如果我点击“3m”属性,汽车的总价将为503USD,“2m”和“3m”属性的价格不变。我想更改另一个属性的价格。例如,当我点击“3m”属性时,“2m”和“3m”属性的价格应该改为“-1”和“+1”。
最后,我想更改其他属性的价格除了我点击的属性。我可以在 Prestashop 管理页面上完成这些项目吗?我在那里找不到线索。所以我开始在我的 FTP 服务器中编写 PHP 或 tpl 代码。我不知道我必须在控制器或tpl文件中写入。我打算在 tpl 文件中编写代码。那么实施它是正确的吗?
代码下方。
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="input-container" title="{$group_attribute.name} - {$group.name}">
<input class="input-radio attri" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}" {if $group_attribute.selected} checked="checked"{/if}/>
<span class="radio-label">{$group_attribute.name}</span>
{if isset($ahpvarsaver) && $ahpvarsaver && $group_attribute.price > 0}
{if $product.discount_type === 'percentage'}
{$ta=$product.discount_percentage/100}
{$tas=str_replace("-","",$ta)}
{$tass=str_replace("%","",$tas)}
<span style="text-align:center;display:none" class="iprice {$ta} {$tas} {$tass}" con="{$group_attribute.price}"> <center>
{$foo=$group_attribute.price-$group_attribute.price*$tass}
{$num=number_format((float)$foo, 2, '.', '')}
{l s='+%1$s' sprintf=[Tools::displayPrice($num)]}
</center>
</span>
{else}
<span style="text-align:center;" class="iprice " con="{$group_attribute.price}"><center>
{l s='+%1$s' sprintf=[Tools::displayPrice($group_attribute.price)]}
</center></span>
{/if}
{/if}
<span class="st-input-loading"><i class="fto-spin5 animate-spin"></i></span>
</li>
{/foreach}
{*/foreach*}
Please answer my question in more detail. Thanks.
你可以使用prestashop的"Combinations"功能
- 新建/编辑产品
- 在右侧您会看到 组合 select ** 组合产品 **
- 单击组合 选项卡
- 创建 2 米、3 米和 4 米的组合
- 您可以更改每个组合的价格
希望对您有所帮助!
我是 prestashop 的初学者。单击属性时,我将更改其他属性。
比如我店里有一款汽车产品,关于汽车的宽度有“2m”、“3m”、“4m”三个属性。
这辆车的价格是 500 美元。 “2m”属性将汽车产品的价格提高到 2+USD。 “3m”属性将汽车产品的价格提高到 3+USD。 “4m”属性将汽车产品的价格提高到 4+USD。
现在,如果我点击“3m”属性,汽车的总价将为503USD,“2m”和“3m”属性的价格不变。我想更改另一个属性的价格。例如,当我点击“3m”属性时,“2m”和“3m”属性的价格应该改为“-1”和“+1”。
最后,我想更改其他属性的价格除了我点击的属性。我可以在 Prestashop 管理页面上完成这些项目吗?我在那里找不到线索。所以我开始在我的 FTP 服务器中编写 PHP 或 tpl 代码。我不知道我必须在控制器或tpl文件中写入。我打算在 tpl 文件中编写代码。那么实施它是正确的吗?
代码下方。
{foreach from=$group.attributes key=id_attribute item=group_attribute}
<li class="input-container" title="{$group_attribute.name} - {$group.name}">
<input class="input-radio attri" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}" {if $group_attribute.selected} checked="checked"{/if}/>
<span class="radio-label">{$group_attribute.name}</span>
{if isset($ahpvarsaver) && $ahpvarsaver && $group_attribute.price > 0}
{if $product.discount_type === 'percentage'}
{$ta=$product.discount_percentage/100}
{$tas=str_replace("-","",$ta)}
{$tass=str_replace("%","",$tas)}
<span style="text-align:center;display:none" class="iprice {$ta} {$tas} {$tass}" con="{$group_attribute.price}"> <center>
{$foo=$group_attribute.price-$group_attribute.price*$tass}
{$num=number_format((float)$foo, 2, '.', '')}
{l s='+%1$s' sprintf=[Tools::displayPrice($num)]}
</center>
</span>
{else}
<span style="text-align:center;" class="iprice " con="{$group_attribute.price}"><center>
{l s='+%1$s' sprintf=[Tools::displayPrice($group_attribute.price)]}
</center></span>
{/if}
{/if}
<span class="st-input-loading"><i class="fto-spin5 animate-spin"></i></span>
</li>
{/foreach}
{*/foreach*}
Please answer my question in more detail. Thanks.
你可以使用prestashop的"Combinations"功能
- 新建/编辑产品
- 在右侧您会看到 组合 select ** 组合产品 **
- 单击组合 选项卡
- 创建 2 米、3 米和 4 米的组合
- 您可以更改每个组合的价格
希望对您有所帮助!