How to add image through image_picker in shopify? - shopify

I am trying to add image in shopify through image-picker but it is giving error in the code, here's my code.
{ "id": "image",
"type": "image_picker"
},

Related

How to add default URL in Sections Schema

I have been trying to create a schema for a dynamic section, and use some predefined default URL for some pages but liquid cannot accept it. This is the schema code:
{% schema %}
{
"name": "My New Section",
"class": "homepage-section",
"tag": "section",
"settings": [
{
"type": "text",
"id": "section-heading",
"label": "Section Heading",
"default": "Default Heading",
"info": "Meaningful copy in 25 characters or less."
},
{
"type": "url",
"id": "link-1",
"label": "Link URL 1",
"default": "/collections/mycollection"
}
],
"presets": [
{
"name": "My New Section",
"category": "My Sections"
}
]
}
{% endschema %}
So, for the "type": "url" I try to define the default collection "default": "collections/mycollection" and this is the error message when I try to save the file:
This file contains the following errors: Error: Invalid schema:
setting with id="link" default must be a string or datasource access
path
I tried some different options without success:
"default": "https://testing.myshopify.com/"
"default": "https://testing.myshopify.com/"
"default": "collections/mycollection"
"default": "collections/mycollection"
Please, let me know if there is anyway to handle it.
You need to read the documentation regarding the special input type provided by Shopify called URL
According to the documentation, you can only set these 2 URLs by default:
/collections
/collections/all
This is because these are two URLs that are present after the store creates automatically, one is set for all collections list pages and once for all products pages. so Shopify knows these two's have already existed.
So these are two default values that you accept into URL fields into the Shopify schema.

How can I add product to shopify store from another website?

I want add products to Shopify store form another website (maybe) using API. I not finding the request URL for do it. Please help me make it. I Writing this website with PHP (Laravel framework)
To create new product you can use the Product REST API
Example:
POST /admin/api/2020-07/products.json
{
"product": {
"title": "Burton Custom Freestyle 151",
"body_html": "<strong>Good snowboard!</strong>",
"vendor": "Burton",
"product_type": "Snowboard",
"metafields": [
{
"key": "new",
"value": "newvalue",
"value_type": "string",
"namespace": "global"
}
]
}
}
Pay attention that for such type operation you will need to have the write_products scope

How to make a BigCommerce widget compatible with PageBuilder

I'm following the tutorial here https://developer.bigcommerce.com/api-docs/storefront/widgets/widgets-tutorial
I made the widget template by performing a post request to https://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widget-templates with this in the body
{
"name": "Header Images",
"template": "{{#each images}}<a href='{{image_url}}'><img src={{image_source}} style='width:33.3%'/></a>{{/each}}"
}
The response was successful.
I then performed a post request to https://api.bigcommerce.com/stores/81mdugvyu5/v3/content/widgets
with this in the body
{
"name": "Header Images",
"widget_configuration": {
"images": [
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/1280x1280/products/91/309/thekinfolktablecover_1024x1024__80715.1456436719.jpg?c=2&imbypass=on"
},
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/1280x1280/products/109/361/kinfolkessentialissue_1024x1024__22507.1456436715.jpg?c=2&imbypass=on"
},
{
"image_url": "https://google.com",
"image_source": "https://cdn11.bigcommerce.com/s-n0i50vy/images/stencil/500x659/products/85/282/livingwithplants_grande__26452.1456436666.jpg?c=2&imbypass=on"
}
]
},
"widget_template_uuid": "7c5f05c2-2361-45a3-bb99-89554dd145ee"
}
The response was successful.
My custom widget does then appear in page builder but when I try to add it I receive this error
This widget is not supported by Page Builder. Please consult our developer documentation for more information on how to make your
widget compatible with Page Builder
When I visit the developer documentation it links to on how to make it compatible with Page Builder I don't see any mention of Page Builder.
Is there any way to find out how to make the tutorial widget compatible with Page Builder?
#Mikhail was correct. I was able to add it as a widget accessible by page builder by specifying a schema in the body of my widget-templates post request. After sending another request with the schema added like this:
{
"name": "Header Images",
"template": "{{#each images}}<a href='{{image_url}}'><img src={{image_source}} style='width:33.3%'/></a>{{/each}}",
"schema": [
{
"type": "tab",
"label": "Content",
"sections": []
}
]
}
It worked.
You can find more information about schema settings for page builder here https://developer.bigcommerce.com/stencil-docs/page-builder/page-builder-overview
and you can find a list of the items available in your schema here https://developer.bigcommerce.com/stencil-docs/page-builder/schema-settings

How to Get Twitch Video Thumbnail URL?

Video-sharing websites such as Youtube has a endpoint for video thumbnails
Example: http://img.youtube.com/vi/youtube_id/default.jpg
where youtube_id = the id of the video
So I can just do
<img src="http://img.youtube.com/vi/youtube_id/default.jpg">
with no problem
Does twitch have something like this as well?
Update 2018
Twitch requires you to use its API so you can get access to video thumbnails. Apparently, this is because the URL of the thumbnails may change
Here is a simple guide how to get access to a twitch video thumbnail
You have to get access to Twitch dev API - to do this you need to register an account at https://glass.twitch.tv
After registering an account you must then create an App from your twitch dev dashboard
After creating the App, you will be given a Client ID to be used for that app - note that the app is the one which will be using the twitch API (for example, your website)
You can now pass the client_id as a query string parameter to https://api.twitch.tv/kraken/videos/106400740?client_id=xxxxxxx where 106400740 is the video id (note that 'kraken' here is constant - not sure of the origin behind its name) - note that the request will return a JSON object which contains an error message if you do not include a client_id
The request will return a JSON object which looks something like:
{
"title": "Door 5 vs Tilted Gamers",
"description": "COOL Games: Killing Spree first match # Mineski. Grove, Los Ba\u00f1os",
"description_html": "COOL Games: Killing Spree first match # Mineski. Grove, Los Ba\u00f1os<br>",
"broadcast_id": 1,
"broadcast_type": "upload",
"status": "recorded",
"language": "en",
"tag_list": "",
"views": 4,
"created_at": "2017-11-08T03:13:12Z",
"published_at": "2017-11-08T04:33:37Z",
"url": "https:\/\/www.twitch.tv\/videos\/188543310",
"_id": "v188543310",
"recorded_at": "2017-11-08T03:13:12Z",
"game": "Dota 2",
"length": 2436,
"preview": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000000-320x240.jpg",
"animated_preview_url": "https:\/\/vod-storyboards.twitch.tv\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/storyboards\/188543310-strip-0.jpg",
"thumbnails": [
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000000-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000006-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000012-320x240.jpg"
},
{
"type": "generated",
"url": "https:\/\/static-cdn.jtvnw.net\/s3_vods\/esportsdotcool\/188543310\/3534ab8c-bf7d-4c8a-b502-c406825bf75f\/thumb\/index-0000000018-320x240.jpg"
}
],
"fps": {
"144p30": 29.999544341896,
"360p30": 29.999544341896,
"480p30": 29.999544341896
},
"resolutions": {
"144p30": "256x144",
"360p30": "640x360",
"480p30": "852x480"
},
"channel": {
"name": "esportsdotcool",
"display_name": "esportsdotcool"
},
"_links": {
"self": "https:\/\/api.twitch.tv\/kraken\/videos\/v188543310",
"channel": "https:\/\/api.twitch.tv\/kraken\/channels\/esportsdotcool"
}
}
Under the thumbnails array you can find the url to the video.
PS: As you can see, the thumbnails array has length of 4 - at this point I think this is because of the different sizes of the image that the author of the video can put up

Map is shown without buildings

I'm looking for rendering 3D Buildings extrusion in a React-Native app using github /mapbox/react-native-mapbox-gl
I created a custom map in MapBox Studio,added the following line into the style.json and uploaded the map in Mapbox Studio
{
"id": "buildings",
"type": "fill-extrusion",
"source": "composite",
"source-layer": "building",
"minzoom": 15,
"filter": [
"all",
[
"==",
"extrude",
"true"
],
[
">",
"height",
1
]
],
"paint": {
"fill-extrusion-color": "hsl(206, 7%, 61%)",
"fill-extrusion-height": {
"type": "identity",
"property": "height"
},
"fill-extrusion-base": {
"type": "identity",
"property": "min_height"
},
"fill-extrusion-opacity": 1,
"fill-extrusion-translate-anchor": "viewport"
}
}
The buildings are rendered as expected in mapbox-studio but when I go back in my React-Native App the map is shown but without the buildings.
Do you guys have any idea about how to display buildings in 3D with the react-native-mapbox-gl sdk ?
Thanks.
Screenshot of mapbox studio
Screenshot of the React-Native Map
Compatibility fix for this issue:
Add a new layer for your custom map in Mapbox Studio
Source: Mapbox Streets V7 (building)
Type: Fill extrusion
Edit style
Click on Height and then Edit JSON (in the bottom of the panel)
Then, paste the following code:
{
"type": "identity",
"property": "height"
}
Paste and publish your style and use as a MapBox style for your map in React-Native