Display one colour option on Shopify product page - colors

I'm trying to display only one colour variant of my product at any time when one is selected.
I can get it to work when I manually assign an image to each of the product colours, but when I upload a new .CSV, this is overwritten. Since there are going to be hundreds of products on this store, this isn't a viable solution.
Any help would be greatly appreciated. Thank you.
Link to .CSV
https://docs.google.com/spreadsheets/d/1trq0X3MjR-n2THFnT8gYYlwKscnQavCeeZ8L-ifYaHw/edit?usp=sharing
Link to Product page
https://tomgarrad.myshopify.com/products/lightweight-trainers?variant=37878137356461

Use the Shopify API instead of uploading from a spreadsheet. It allows you to do a lot of things, the following code would upload a product:
POST /admin/api/2021-01/products.json
{
"product": {
"title": "Lightweight Trainers",
"body_html": "<strong>Great trainers!</strong>", #Description
"vendor": "Tom", #The name of the products vendor
"product_type": "Trainer",
"variants": [
{
"option1": "Blue",
"price": "10.00",
"sku": "123" #code
},
{
"option2": "Red",
"price": "10.00",
"sku": "123"
}
],
"images": [
{
"attachment": "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==\n"
}
]
}
}
The image attachment is base64 encoded so keep that in mind when uploading images. Shopify has a very detailed documentation of their API and it's easy to setup. Hopefully this will work for you.

Related

List Template for FB using Bot framework node.js V4

Can anyone please help me to include list view in Facebook Channel using Bot framework? I saw examples as shown here List template. I don't know whether this is the exact way in which we need to give the attachments. Also I didn't know the equivalent for sourceEvent method in Bot framework v4. Another useful link is as follows FB Messenger Message Template. See the image given below. I need to put the link for the image and once we click the link it should open another page also the image should be clickable image as in the example for C# Clickable HeroCard images using tap property. Both functionality should work. I tried using HeroCard (but the url that needs to open-up had CORS origin issue. I tried using Adaptive card but it is not supported in Facebook as of now. So, I thought to use List Template for Facebook. Is there anyway to achieve this?
You can send Facebook List Templates through the Microsoft BotFramework by adding the Facebook attachment to the activity's channel data. The list template type doesn't seem to be supported, but you can set the type to generic and add multiple elements to the attachment to get the same result. See the example below.
await turnContext.sendActivity({
channelData: {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [
{
"title": "Three Strategies for Finding Snow",
"subtitle": "How do you plan a ski trip to ensure the best conditions? You can think about a resort’s track record, or which have the best snow-making machines. Or you can gamble.",
"image_url": "https://static01.nyt.com/images/2019/02/10/travel/03update-snowfall2/03update-snowfall2-jumbo.jpg?quality=90&auto=webp",
"default_action": {
"type": "web_url",
"url": "https://www.nytimes.com/2019/02/08/travel/ski-resort-snow-conditions.html",
"messenger_extensions": false,
"webview_height_ratio": "tall"
},
"buttons": [{
"type":"element_share"
}]
},
{
"title": "Viewing the Northern Lights: ‘It’s Almost Like Heavenly Visual Music’",
"subtitle": "Seeing the aurora borealis has become a must-do item for camera-toting tourists from Alaska to Greenland to Scandinavia. On a trip to northern Sweden, the sight proved elusive, if ultimately rewarding.",
"image_url": "https://static01.nyt.com/images/2019/02/17/travel/17Northern-Lights1/17Northern-Lights1-superJumbo.jpg?quality=90&auto=webp",
"default_action": {
"type": "web_url",
"url": "https://www.nytimes.com/2019/02/11/travel/northern-lights-tourism-in-sweden.html",
"messenger_extensions": false,
"webview_height_ratio": "tall"
},
"buttons": [{
"type":"element_share"
}]
},
{
"title": "Five Places to Visit in New Orleans",
"subtitle": "Big Freedia’s rap music is a part of the ether of modern New Orleans. So what better authentic travel guide to the city that so many tourists love to visit?",
"image_url": "https://static01.nyt.com/images/2019/02/17/travel/17NewOrleans-5Places6/17NewOrleans-5Places6-jumbo.jpg?quality=90&auto=webp",
"default_action": {
"type": "web_url",
"url": "https://www.nytimes.com/2019/02/12/travel/big-freedia-five-places-to-eat-and-visit-in-new-orleans.html",
"messenger_extensions": false,
"webview_height_ratio": "tall"
},
"buttons": [{
"type":"element_share"
}]
}]
}
}
}
});
Hope this helps!

Solution to identify "Similar Product Images"?

I want to build a cloud based solution in which I would give a pool of images; and then ask for "find similar image to a particular image from this pool of images" !! Pool of images can be like "all t-shirt" images. Hence, similar images mean "t-shirt with similar design/color/sleeves" etc.
Tagging solution won't work as they are at very high level.
AWS Rekognition gives "facial similarities" .. but not "product similarities" .. it does not work like for images of dresses..
I am open to use any cloud providers; but all are providing "tags" of the image which won't help me.
One solution could be that I use some ML framework like MXNet/Tensorflow, create my own models, train them and then use.. But is there any other ready made solution on any of cloud providers ?
ibm-bluemix has an api to find similar images https://www.ibm.com/watson/developercloud/visual-recognition/api/v3/#find_similar
Using the Azure Cognitive Services (Computer Vision to be more precise) you can get categories, tags, a caption and even more info for images. Processing all your images would provide tags for your image pool. And that enables you to get similar images based on (multiple) identical tags.
This feature returns information about visual content found in an image. Use tagging, descriptions, and domain-specific models to identify content and label it with confidence. Apply the adult/racy settings to enable automated restriction of adult content. Identify image types and color schemes in pictures.
An example of (part of) a result of the Computer Vision API:
Description{
"Tags": [
"train",
"platform",
"station",
"building",
"indoor",
"subway",
"track",
"walking",
"waiting",
"pulling",
"board",
"people",
"man",
"luggage",
"standing",
"holding",
"large",
"woman",
"yellow",
"suitcase"
],
"Captions": [
{
"Text": "people waiting at a train station",
"Confidence": 0.8331026
}
]
}
Tags[
{
"Name": "train",
"Confidence": 0.9975446
},
{
"Name": "platform",
"Confidence": 0.995543063
},
{
"Name": "station",
"Confidence": 0.9798007
},
{
"Name": "indoor",
"Confidence": 0.927719653
},
{
"Name": "subway",
"Confidence": 0.838939846
},
{
"Name": "pulling",
"Confidence": 0.431715637
}
]
You could also use the Bing Image Search API (https://azure.microsoft.com/en-us/services/cognitive-services/bing-image-search-api/) which allows you to do an image search based on specified criteria within your solution...
You could use a combination of things here. Use an image tagging service aws rekognition, or any of those listed above) then create some training data with like images, and upload that into something like aws machine learning. This is a bit similar to what has been brought up earlier, however I am trying to elucidate that while tagging might not be the end all be all of your solution, it will likely play a role as a first to step to a more complex process.
pls check the site http://cloudsight.ai/api, and try the demo. the sample result would be
{
"token": "BBKA0lW9O-B2eamXUysdXA",
"url": "http://assets.cloudsight.ai/uploads/image_request/image/314/314978/314978186/79379_86cb4e2611d6b0a3287a926a1ca1fe51_image1_zoom.jpg",
"ttl": 54,
"status": "completed",
"name": "men's red and black checkered button-up shirt"
}
{
"token": "bjX7nWGs0toajIDwyvXxlw",
"url": "http://assets.cloudsight.ai/uploads/image_request/image/314/314987/314987168/11.jpg",
"ttl": 54,
"status": "completed",
"name": "blue, gray and navy blue stripe crew-neck T-shirt"
}

Is there a way to get all tags related to a photo using Unsplash API?

I understand that I can search by tag so I can find all photos that have been tagged to contain the term "dog" for example, but is there a way to get the photo and all its related tags (dog,puppy,backyard,etc.)?
If you use the endpoint GET /photos/:id you are able to retrieve the categories of the photo.
"categories": [
{
"id": 4,
"title": "Nature",
"photo_count": 24783,
"links": {
"self": "https://api.unsplash.com/categories/4",
"photos": "https://api.unsplash.com/categories/4/photos"
}
},
// and so on
],

Drupal 7 Search Autocomplete module never loads "suggestions"

I am attempting to use the module Search Autocomplete 7.x-4.0-alpha2.
I have added a form in the "search_autocomplete" configuration section.
It is enabled.
I created a view that returns taxonomy in json format.
Here is an example of the json output from the json view
[{
"value": "aquaculture",
"fields": {
"name_i18n": "aquaculture"
},
"group": {
"group_id": "aquaculture",
"group_name": "aquaculture"
}
}, {
"value": "climate change",
"fields": {
"name_i18n": "climate change"
},
"group": {
"group_id": "climatechange",
"group_name": "climate change"
}
}, {
"value": "coastal development",
"fields": {
"name_i18n": "coastal development"
},
"group": {
"group_id": "coastaldevelopment",
"group_name": "coastal development"
}
}, {
"value": "deforestation",
"fields": {
"name_i18n": "deforestation"
},
"group": {
"group_id": "deforestation",
"group_name": "deforestation"
}
}, {
"value": "extinction",
"fields": {
"name_i18n": "extinction"
},
"group": {
"group_id": "extinction",
"group_name": "extinction"
}
}]
I set the Suggestion Source to be the view. I used the autocomplete feature of it so I know that my "search autocomplete" suggestion source is configured right. The id selector of a form in a different view (not the json taxonomy one) is used. The permissions for the module are correct.
Now, when I load my view that has the search api form I see a little blue circle icon that is circling to the right of the search api form field. It is circling the whole time and no suggestions are ever populated in the search text box.
I know I have the right form configured because if I set a different form id for the "searchautocomplete" configuration and reload the view page, the circling blue circle is missing.
Does anyone have any idea what might be wrong?
UPDATE: I was going to my modules page and saw this error (i wasn't changing anything on the modules page, just going there) and saw the error on the top of the modules page regarding the Search Autocomplete module
Update: I changed the Search Autocomplete configuration section to not point to my json view but point to an outside url, http://google.com. Of course this is not a valid json endpoint, but I wanted to see if I could see it at least attempt to get it's json data from google.com. Watching through firebug has shown that it doesn't even attempt to go to google.com for it's json data. I think something similar is happening with my json views (it's just not even going there for the data).
That was probably due to a bug in the alpha-version? When you configure the JSON Endpoint by using the Views UI, you should see a list of items in the "preview"-section underneath. The items that are listed there should be the ones that appear as suggestions in the search.

Insert a card that can be directly responded to

update !important: The API has changed a lot, this question shouldn't be taken into consideration anymore
I am trying to use the REST api (via Node.js API) to create cards that the user can respond to and create an interaction in this way.
Reading the docs the creator attribute is not really specified anywhere, so I have no idea how to insert that.
Also this video doesn't help. Nor this guide =)
I believe there is an URL I should set as callback somehow? I'd like to know how to get these responses, please.
update
This is the card I am sending.
{
bundleId: 'veryuniqueBundle',
id: 'veryuniqueBundle:reply',
text: "want to hear moar?",
menuItems: [
{action: "REPLY"}
]
}
that's the response I get:
{
"collection": "timeline",
"itemId": "119c4dc8-c0ce-4a83-aa76-41aab4e8dbe1",
"operation": "INSERT",
"verifyToken": "42",
"userToken": "id:520ef63cde31145deb000001",
"userActions": [
{
"type": "REPLY"
}
]
}
The problem is, I can't see what the user responded (an text) and the reference to the original card id (or bundle) that was responded to. How can I get those
Cards do not provide a direct callback. Instead, when a user selects a menu item it causes the card to be updated with their menu selection. This change subsequently triggers a notification ping to your timeline subscription.
Follow these steps to detect a menu item selection:
Subscribe to notifications for changes in the timeline collection
{
"collection": "timeline",
"userToken": "awesome_kitty",
"verifyToken": "random_hash_to_verify_referer",
}
Insert a timeline card with a custom menu item
{
"text": "Hello world",
"menuItems": [
{
"action": "CUSTOM",
"id": "complete"
"values": [{
"displayName": "Complete",
"iconUrl": "http://example.com/icons/complete.png"
}]
}
]
}
Select the item on Glass
Receive the notification on your subscription URL
{
"collection": "timeline",
"itemId": "3hidvm0xez6r8_dacdb3103b8b604_h8rpllg",
"operation": "UPDATE",
"userToken": "harold_penguin",
"userActions": [
{
"type": "CUSTOM",
"payload": "PING"
}
]
}
Do cool stuff in your code
???
Profit

Resources