【问题标题】:Show product image instead of product name on the "recently viewed" block在“最近查看”块上显示产品图片而不是产品名称
【发布时间】:2014-12-25 09:52:16
【问题描述】:

我正在使用 CS-Cart 4.1.x

我为“design\themes\basic\templates\blocks\products\products_text_links.tpl”块创建了一个覆盖

我在默认文件中看到的代码是:

{** block-description:text_links **}

<{if $block.properties.item_number == "Y"}ol{else}ul{/if} class="bullets-list">

{foreach from=$items item="product"}
{assign var="obj_id" value="`$block.block_id`000`$product.product_id`"}
{if $product}
    <li>
        <a href="{"products.view?product_id=`$product.product_id`"|fn_url}">{$product.product nofilter}</a>
    </li>
{/if}
{/foreach}

</{if $block.properties.item_number == "Y"}ol{else}ul{/if}>

我需要做的只是用正确的代码替换以下行以显示产品的默认图像而不是其名称:

{$product.product nofilter}

有什么想法吗?

谢谢

【问题讨论】:

  • 我不知道 Smarty 或 CS-Cart.. 但是,我在这里找不到任何 标签来显示图像...您没有提供任何图像标签,所以我认为它是问题为什么你不能查看图像.. 对不起,如果我的回答是错误的.. 祝你有美好的一天,圣诞快乐.. :-)
  • @annampriyatam 对,但这是我以后可以添加的内容。我只需要知道返回图像链接的属性/代码。无论如何,谢谢,圣诞快乐。
  • 启用 smarty 调试(使用 {debug})并查看 products 数组的样子。在那里,您应该看到在哪里可以找到图像的 URL。看看这个文档:docs.cs-cart.com/4.1.x/api/entities/products.html#main-pair

标签: php smarty cs-cart


【解决方案1】:

试试:

{foreach from=$items item="product"}
    {if $product}
        {assign var="obj_id" value="`$block.block_id`000`$product.product_id`"}
        {include file="common/image.tpl" image_width=$block.properties.thumbnail_width image_height=$block.properties.thumbnail_height obj_id=$obj_id images=$product.main_pair href="products.view?product_id=`$product.product_id`"|fn_url}
    {/if}
{/foreach}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-11-04
    • 1970-01-01
    • 2020-01-03
    • 1970-01-01
    相关资源
    最近更新 更多