2015-06-17 145 views
1

您好,我正在嘗試爲prestashop的產品功能添加自定義鏈接。Prestashop將超鏈接或圖像添加到產品功能

這裏是我的嘗試:

編輯/classes/FeatureValue.php

//郎領域

'value' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' 
    => true, 'size' => 255), 

這個

//郎領域

'value' => array('type' => self::TYPE_NOTHING, 'lang' => true, 'validate' => 'isAnything', 'required' 
    => true, 'size' => 255), 

而且這個文件:/themes/<your theme folder>/product.tpl

來源:

{foreach from=$features item=feature} 
        <tr class="{cycle values="odd,even"}"> 
         {if isset($feature.value)} 
         <td>{$feature.name|escape:'html':'UTF-8'}</td> 
         <td>{$feature.value|escape:'html':'UTF-8'}</td> 
         {/if} 
        </tr> 
        {/foreach} 

要這樣:

{foreach from=$features item=feature} 
        <tr class="{cycle values="odd,even"}"> 
         {if isset($feature.value)} 
         <td>{$feature.name|escape:'html':'UTF-8'}</td> 
         <td>{$feature.value|escape:'UTF-8'}</td> 
         {/if} 
        </tr> 
        {/foreach} 

並且此文件:admin1234/themes/default/template/controllers/products/features.tpl

改變了這個:

<textarea class="custom_{$available_feature.id_feature}_ALL textarea-autosize" name="custom_{$available_feature.id_feature}_ALL" 
           cols="40" style='background-color:#CCF' rows="1" onkeyup="{foreach from=$languages key=k item=language}$('.custom_{$available_feature.id_feature}_{$language.id_lang}').val($(this).val());{/foreach}" >{$available_feature.val[1].value|escape:'html':'UTF-8'|default:""}</textarea> 

要這樣:

<textarea class="custom_{$available_feature.id_feature}_ALL textarea-autosize" name="custom_{$available_feature.id_feature}_ALL" 
           cols="40" style='background-color:#CCF' rows="1" onkeyup="{foreach from=$languages key=k item=language}$('.custom_{$available_feature.id_feature}_{$language.id_lang}').val($(this).val());{/foreach}" >{$available_feature.val[1].value|escape:'UTF-8'|default:""}</textarea> 

的問題是,當我的值添加到自定義字段後,我點擊保存它消失,它不插入數據庫。 但是,如果我將超鏈接添加到定義的功能,那麼它被保存在數據庫中,我可以使用它。 但是,因爲我想添加多個超鏈接/高度讓我們說我不能讓100個預定義的組合。

如果我不清楚,我很抱歉,如果您需要更多信息,請讓我知道。 的Prestashop版本:1.6.0.11

回答

1

Edite
類/ Product.php

查找

Add new feature to product 

和2行上找到

$row = array('id_feature_value' => (int)$id_value, 'id_lang' => (int)$lang, 'value' => pSQL($cust)); 

變化與

$row = array('id_feature_value' => (int)$id_value, 'id_lang' => (int)$lang, 'value' => $cust); 

我剛剛刪除了 以及其他所有對您自己的更改均爲True。在1.6版本中進行此更改自定義html工作正常!
剛剛清除緩存和罰款。 。 。

一些reasone檢查

/override/classes/ 

,如果你看到Product.php和FeatureValue.php做變化對他們來說太

相關問題