CS-Cart 产品过滤器块的新模板

CS-Cart new template for Product Filters block

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

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

templates\blocks\product_filters

并将其放入:

templates\addons\my_changes\blocks\product_filters

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

{** block-description:example **}

此基本过程适用于其他块,但不适用于此产品过滤器。模板列表中唯一可用的选项是 'Original' 和 'Horizontal filters'.

我需要做什么特别的事情才能显示我的新模板吗?

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

通常模式包含一个目录的路径,该目录包含一个块可以使用的所有模板,就像为 "products" 块所做的那样:

'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" 插件已安装并启用。

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