2012-01-02 127 views
1

嗨,我用這個代碼來顯示類別與相應的圖像。我使用的Prestashop 1.4.4類別圖像未顯示在prestashop

<ul>    
{foreach from=$blockCategTree.children item=child name=blockCategTree} 
{if $smarty.foreach.blockCategTree.last} 
{include file="$branche_tpl_path" node=$child last='true'} 
{else} 
{include file="$branche_tpl_path" node=$child} 
{/if} 
<img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" />   
{/foreach}  
</ul> 

通過觀察使用Firebug src屬性,它顯示了像這個 - /prestashop/img/c/-category.jpg

,我想這樣的路徑以顯示圖像 - 「/prestashop/img/c/6-category.jpg」 這裏6是圖像ID。我如何使用代碼獲取上面的url。

回答

0

H1可以這樣能夠幫助你

<a href="{$link->getCategoryLink($subcategory.id_category, $subcategory.link_rewrite)|escape:'htmlall':'UTF-8'}" title="{$subcategory.name|escape:'htmlall':'UTF-8'}" class="img"> 
1

我覺得這是你所需要的

<img src="{$link->getCatImageLink($subcategory.link_rewrite, $subcategory.id_category,'category_default')|escape:'htmlall':'UTF-8'}" alt="" width="{$mediumSize.width}" height="{$mediumSize.height}" />