2

我想在我的主页模板中定义一个特色类别 ID 列表。是否可以在前端定义自定义变量?我似乎无法让它工作:

templates/pages/home.html这是我的自定义变量中的默认前置内容,featured_categories最后:

---
products:
    new:
        limit: {{theme_settings.homepage_new_products_count}}
    featured:
        limit: {{theme_settings.homepage_featured_products_count}}
    top_sellers:
        limit: {{theme_settings.homepage_top_products_count}}
carousel: {{theme_settings.homepage_show_carousel}}
blog:
    recent_posts:
      limit: {{theme_settings.homepage_blog_posts_count}}
featured_categories: 'testing'
---

然后,在模板中,这一行不产生任何输出:

{{featured_categories}}

为什么这不输出值testing?最终,我想featured_categories成为一个类别 ID 的数组。这可以使用前端物质吗?

4

1 回答 1

1

无法声明自定义的前端变量,因为这些变量必须由 BigCommerce 在框架中确定。您可以自己导入把手并定义一个变量,但出于安全原因,它将执行客户端而不是服务器端。

于 2016-03-02T20:07:26.903 回答