-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration + Product + Category #17
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just left a few comments about the usage of the API. Happy to answer any Qs via Slack to help get this project done!
currencyCode | ||
} | ||
featuredAsset { | ||
source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the preview
property any time you get an Asset - the source
is the source binary and might be very large, whereas preview
is constrained to a sensible file size.
slug | ||
featuredAsset { | ||
id | ||
name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you need to actually display the collection image, get the preview
property.
filters { | ||
code | ||
} | ||
translations { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally you don't need to fetch the translations
field, as the correct translated values (name, slug, description) are automatically populated into the Collection type at runtime by Vendure, based on the current context (i.e. the current channel's default language, or the current language as specified by the languageCode query param.
slug | ||
description | ||
} | ||
productVariants { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the intention is to list all the variants in a collection, I recommend using the search
query with the corresponding collectionId
or collectionSlug
input argument. This is a much more efficient way to get that data.
Also, fixed problem with displaying prices in search query thanks to @michaelbromley |
push: | ||
branches: | ||
- main | ||
- develop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK you have only main branch so this is unnecessary
- develop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to do some iteration on smaller things, but even, for now, it's a huge improvement for this integration, great work.
pull_request: | ||
branches: | ||
- main | ||
- develop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
- develop |
} | ||
|
||
const getProduct = async (context: Context, params: ProductParams, customQuery?: CustomQuery): Promise<ApolloQueryResult<ProductData>> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO better returning type will be Promise<ProductData>
); | ||
|
||
try { | ||
const request = await (context.client as ApolloClient<any>).query<ProductData>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to achieve the above over here you need to destructor request.
product?.images[0] || | ||
"https://s3-eu-west-1.amazonaws.com/commercetools-maximilian/products/081223_1_large.jpg"; | ||
function getItemImage(item: CartItem): string { | ||
return 'https://s3-eu-west-1.amazonaws.com/commercetools-maximilian/products/081223_1_large.jpg'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add todo cuz now is hardcodeded
Closes #16
Closes #1
Closes #3
Closes #4
Closes #5
Closes #2
I have created a connection between local Vendure server created with a command
npx @vendure/create my-app
and developed basic getCategory functionality and full getProduct functionality. This is Work in Progress Pull Request because I have to finish getCategory functionality, write unit tests and add docs. I also updated the repo to the latest boilerplate state (that's why there is so many changes).Product Page

Product details
