2014-11-03 77 views
1

好傢伙即時通訊新來的Prestashop。 我想增加貨幣符號的大小。的Prestashop貨幣規模

我寫了一個模塊覆蓋Tools.php和tools.js並將其放置在主題modules目錄。 文件結構是如下

Mymodule\ 
-->mymodule.php 
-->override 
----->classes 
-------->Tools.php 
----->js 
-------->tools.js 

我只是從那裏各自的文件夾複製兩個文件,並添加以下代碼

在Tools.php我只是之前之前如果($ no_utf8加入這行代碼)

$c_char = '<span>'.$c_char.'</span>'; 

在tools.js我加入這行代碼之前如果(currencyBlank> 0)

currencySign = '<span>' + currencySign + '</span>'; 

感謝您的時間

與問候 AB

回答

0

在覆蓋/班/ Tools.php文件:

public static function displayPrice(...) 
{ 
    $price = paret::displayPrice(...); 
    // use regex to seperate number from currency sign 
    return $price.'<small>'.$sign.'</small>'; 
} 

要覆蓋tools.js formatCUrreny,你需要插入腳本塊或每個頁面上的文件有:

var fnDefaultFormatCurrency = window.formatCurrency; 
window.formatCurrency = function(price, currencyFormat, currencySign, currencyBlank){ 

    var priceStr = fnDefaultFormatCurrency(price, currencyFormat, currencySign, currencyBlank), 

    // use regex here again 

    priceFinal = price +' <small>' + sing+ '</small>'; 

    return priceFinal; 
} 

我實際上需要做出更小的東西,所以我用small但你可以使用別的東西。注意:您將不得不更換.text().html()在AJAX功能來正確顯示HTML

+0

你好抱歉這麼晚纔回復。我應該在哪裏將.text()改爲.html()你可以具體。並感謝您的回覆.. – 2014-11-10 04:22:26

+0

嘗試插入兩個覆蓋首先,chaging text()到html()將是一個以後的問題。基本上,如果你通過20.00 $與.text區段(),它會顯示該文本可見HTML(逃脫)。 – gskema 2014-11-10 06:23:36