类别图像未在prestashop中显示

时间:2012-01-02 13:31:41

标签: php prestashop

您好我使用此代码显示具有相应图像的类别。我正在使用prestashop 1.4.4

<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。

2 个答案:

答案 0 :(得分:1)

我认为这就是你需要的

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

答案 1 :(得分:0)

您好,这可以帮助您

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