【问题标题】:CS-Cart new template for Product Filters block产品过滤器块的 CS-Cart 新模板
【发布时间】:2016-12-04 01:40:23
【问题描述】:

我想为产品过滤器块添加一个新的模板选项。

到目前为止,我已经从以下位置复制了现有的 original.tpl:

templates\blocks\product_filters

并将其放入:

templates\addons\my_changes\blocks\product_filters

然后我将文件重命名为:example.tpl,并将文件的第一行编辑为:

{** block-description:example **}

此基本过程适用于其他块,但不适用于此产品过滤器之一。模板列表中唯一可用的选项是“原始”和“水平过滤器”。

要让我的新模板显示出来,我需要做些什么特别的事情吗?

【问题讨论】:

    标签: smarty cs-cart


    【解决方案1】:

    可供块使用的模板在架构中定义,该架构位于“app/schemas/block_manager/blocks.php”文件中。

    通常模式包含一个目录的路径,该目录包含一个块可以使用的所有模板,就像对“产品”块所做的那样:

    'templates' => 'blocks/products',
    

    这使得块管理器搜索模板位于design/themes/[theme name]/templates/blocks/products 目录。

    不幸的是,由于某些原因,“product_filters”块的模式与其他块模式相比不一致 - 它包含要使用的具体模板的列表:

    'templates' => array(
        'blocks/product_filters/original.tpl' => array(),
        'blocks/product_filters/selected_filters.tpl' => array(),
        'blocks/product_filters/horizontal_filters.tpl' => array(),
    ),
    

    因此,在确定可用于块的模板列表时,不会执行目录扫描。

    这就是您使用的方法适用于其他块但不适用于“product_filters”的原因。

    你的解决方案很简单——你应该创建一个“app/addons/my_changes/schemas/block_manager/blocks.post.php”文件,内容如下:

    <?php
    $schema['product_filters']['templates'] = 'blocks/product_filters';
    
    return $schema;
    

    之后请清除缓存并确保“my_changes”插件已安装并启用。

    感谢您指出这个问题,我们将在即将发布的版本中修复它。

    【讨论】:

    • 感谢您提供此信息!还有一件事-我实际上正在使用主页产品过滤器块,它似乎与标准列表有不同的列表。我需要为此添加另一个架构文件吗?
    • @user500665 您只需在上面给出的代码示例中将“product_filters”替换为“product_filters_home”即可。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多