admin管理员组文章数量:1122846
In relation to the Big Commerce documentation thanks to this question/answer, I have the following in templates/pages/product.html
:
---
product:
videos:
limit: {{theme_settings.productpage_videos_count}}
reviews:
limit: {{theme_settings.productpage_reviews_count}}
related_products:
limit: {{theme_settings.productpage_related_products_count}}
similar_by_views:
limit: {{theme_settings.productpage_similar_by_views_count}}
gql: "query productById($productId: Int!) {
site {
product(entityId: $productId) {
variants(first: 25) {
edges {
node {
sku
}
}
}
}
}
}"
---
{{#partial "page"}}
{{> components/common/breadcrumbs breadcrumbs=breadcrumbs}}
{{#each product.shipping_messages}}
{{> components/common/alert-info message}}
{{/each}}
<ul class="tester-gql">
<li>{{#if gql}}GQL 1 exists!{{else}}No GQL 1{{/if}}</li> <!-- data called as per documentation -->
<li>{{#if product.gql}}GQL 2 exists!{{else}}No GQL 2{{/if}}</li> <!-- logical data call as per piping of 'related_products' attribute -->
<li>{{#if product.related_products}}Related Products exists!{{else}}No Related Products{{/if}}</li> <!-- to test the output of a default product attribute -->
</ul>
<div itemscope itemtype=";>
{{> components/products/product-view schema=true }}
{{{region name="product_below_content"}}}
{{> components/products/tabs}}
</div>
{{/partial}}
{{> layout/base}}
But I cannot see the gql
data (in tester-gql
), i.e. when loaded I get:
<ul class="tester-gql">
<li>No GQL 1</li>
<li>No GQL 2</li>
<li>Related Products exists!</li>
</ul>
So we can see that Related Products
is there but not gql
. Does anyone have any ideas why this could be?
In relation to the Big Commerce documentation thanks to this question/answer, I have the following in templates/pages/product.html
:
---
product:
videos:
limit: {{theme_settings.productpage_videos_count}}
reviews:
limit: {{theme_settings.productpage_reviews_count}}
related_products:
limit: {{theme_settings.productpage_related_products_count}}
similar_by_views:
limit: {{theme_settings.productpage_similar_by_views_count}}
gql: "query productById($productId: Int!) {
site {
product(entityId: $productId) {
variants(first: 25) {
edges {
node {
sku
}
}
}
}
}
}"
---
{{#partial "page"}}
{{> components/common/breadcrumbs breadcrumbs=breadcrumbs}}
{{#each product.shipping_messages}}
{{> components/common/alert-info message}}
{{/each}}
<ul class="tester-gql">
<li>{{#if gql}}GQL 1 exists!{{else}}No GQL 1{{/if}}</li> <!-- data called as per documentation -->
<li>{{#if product.gql}}GQL 2 exists!{{else}}No GQL 2{{/if}}</li> <!-- logical data call as per piping of 'related_products' attribute -->
<li>{{#if product.related_products}}Related Products exists!{{else}}No Related Products{{/if}}</li> <!-- to test the output of a default product attribute -->
</ul>
<div itemscope itemtype="http://schema.org/Product">
{{> components/products/product-view schema=true }}
{{{region name="product_below_content"}}}
{{> components/products/tabs}}
</div>
{{/partial}}
{{> layout/base}}
But I cannot see the gql
data (in tester-gql
), i.e. when loaded I get:
<ul class="tester-gql">
<li>No GQL 1</li>
<li>No GQL 2</li>
<li>Related Products exists!</li>
</ul>
So we can see that Related Products
is there but not gql
. Does anyone have any ideas why this could be?
1 Answer
Reset to default 1gql is a top-level object. You need to un-indent it.
---
product:
videos:
limit: {{theme_settings.productpage_videos_count}}
reviews:
limit: {{theme_settings.productpage_reviews_count}}
related_products:
limit: {{theme_settings.productpage_related_products_count}}
similar_by_views:
limit: {{theme_settings.productpage_similar_by_views_count}}
gql: "query productById($productId: Int!) {
site {
product(entityId: $productId) {
variants(first: 25) {
edges {
node {
sku
}
}
}
}
}
}"
---
本文标签: handlebarsjsDisplay Product Variant Option data in Big Commerce theme filesStack Overflow
版权声明:本文标题:handlebars.js - Display Product Variant Option data in Big Commerce theme files - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736308281a1933606.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论