简体   繁体   English

bigcommerce 在产品展示页面上显示产品的类别

[英]bigcommerce display a product's categories on product display page

Looking to display all the categories that the specific product is in, on it's product display page.希望在其产品展示页面上显示特定产品所在的所有类别。 (in code for all products of course) (当然在所有产品的代码中)

trying to get stencil's code for displaying like:试图获取模板的代码显示如下:

each top level category and then the subcategories within it.每个顶级类别,然后是其中的子类别。 I have tried code for categories, but not seeming to work on product page.我已经尝试过类别代码,但似乎在产品页面上不起作用。

You can list out the categories that a product is in on the PDP using product.category .您可以使用product.category列出产品在 PDP 上的类别。 However, since this is an array, you will probably want to loop through it and give it some formatting.但是,由于这是一个数组,您可能希望遍历它并为其设置一些格式。 Here is an example:下面是一个例子:

<ul>
  {{#each product.category}}
    <li>{{this}}</li>
  {{/each}}
</ul>

Reference: https://developer.bigcommerce.com/theme-objects/product参考: https : //developer.bigcommerce.com/theme-objects/product

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM