Reputation: 84
Following the examples on the stencil documentation https://stencil.bigcommerce.com/docs/customizing-javascript
{{inject 'themeImageSizes' theme_images}}
Is added to the template, product.html and
console.log(this.context.themeImageSizes);
Is added to the product.js file.
However the console is logging an empty array. Where is or where should theme_images be defined?
Upvotes: 0
Views: 73
Reputation: 1
I'm pretty sure theme_images should be defined in config.json, but I think the Stencil docs may have the wrong reference here.
If you look at the YAML at the top of product.html, there are references there to values in config.json:
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}}
The corresponding values in config.json are settings.productpage_videos_count
, settings.productpage_reviews_count
, settings.productpage_related_products_count
, and settings.productpage_similar_by_views_count
.
So, my guess is that to reference the image sizes you should use this:
{{inject 'themeImageSizes' theme_settings._images}}
or maybe
{{inject 'themeImageSizes' theme_settings_images}}
However, I haven't been able to test that, so you might need to experiment. (I would have tested it but when I make changes to any file in assets/js the changes don't show up on any served pages from my dev server).
Upvotes: 0