Prestashop不按语言翻译产品

时间:2014-03-31 14:22:36

标签: smarty prestashop

我修改了一下category-list.tpl,让它看起来像我想要的那样。

当我切换到不同语言时会出现问题,因为它会更改类别名称而不会更改产品名称。

CODE:

{if isset($products)}
    <!-- Products list -->
    <div class="wrapper" itemscope itemtype="http://schema.org/EducationEvent">
          <ul class="accordion">
                        <li class="nav-dropdown">
                            <input type="radio" name="accordion" id="{$subcategory.name}" />
                            <label for="{$subcategory.name}">
                            <span class="subcat"><h1>{$subcategory.name}</h1></span>
                            <span class="descsubcat">{$subcategory.description|truncate:250:'...'}</span>
                            <br />
                            </label>
                    <div class="cursos">
                    {foreach from=$products item=product name=products}
                    {if $products != ''}
                    <div class="float_left">
                    <div itemprop="name" class="titcurs"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name}"><h2>{$product.name|escape:'htmlall':'UTF-8'}</a></h2></div>
                    <div itemprop="description"><p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}" >{$product.description_short|strip_tags:'UTF-8'|truncate:600:'...'}</a></p></div>
                    </div>
                    {/if}
                    {/foreach}
            </li>
        </ul>
        </div>
        {/if}

忽略第一个代码的某些部分。这是显示产品的原因:

{foreach from=$products item=product name=products}
                    {if $products != ''}
                    <div class="float_left">
                    <div itemprop="name" class="titcurs"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name}"><h2>{$product.name|escape:'htmlall':'UTF-8'}</a></h2></div>
                    <div itemprop="description"><p class="product_desc"><a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.description_short|strip_tags:'UTF-8'|truncate:360:'...'}" >{$product.description_short|strip_tags:'UTF-8'|truncate:600:'...'}</a></p></div>
                    </div>
                    {/if}
                    {/foreach}

重点是什么?为什么要翻译类别而不是产品?

提前致谢

1 个答案:

答案 0 :(得分:0)

解决了它。

在Category.tpl上,我有一行包含以下参数:

{include file="./product-list-cat.tpl" products=$subcategory_object->getProducts('1','1','100')}

并将其替换为:

{include file="./product-list-cat.tpl" products=$subcategory_object->getProducts($cart->id_lang,'1','100')}

仅修改getProducts('1','1','100') getProducts($cart->id_lang,'1','100') ,因此它使产品显示为多语言。