Skip to content
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

Merged
merged 55 commits into from
Aug 10, 2021
Merged

Integration + Product + Category #17

merged 55 commits into from
Aug 10, 2021

Conversation

Baroshem
Copy link
Contributor

@Baroshem Baroshem commented Aug 4, 2021

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
image

Product details
image

@atlantis-vsf
Copy link

Error: This repo is not allowlisted for Atlantis.

@Baroshem Baroshem self-assigned this Aug 4, 2021
@Baroshem Baroshem requested a review from rglepper August 4, 2021 17:01
Copy link
Collaborator

@michaelbromley michaelbromley left a 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
Copy link
Collaborator

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
Copy link
Collaborator

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 {
Copy link
Collaborator

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 {
Copy link
Collaborator

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.

@Baroshem
Copy link
Contributor Author

Baroshem commented Aug 8, 2021

Currently added category page. The only thing left is to implement remaining getters. We have a category page listing products that also have correct links to product page. Unfortunately I faced a problem with displaying product prices on category page when using search query with groupByProduct option. It does not return any price. I asked Michael for the possible sollutions to that problem.
image

@Baroshem
Copy link
Contributor Author

Baroshem commented Aug 9, 2021

Displaying sorting options and filters
image
image

@Baroshem
Copy link
Contributor Author

Baroshem commented Aug 9, 2021

Also, fixed problem with displaying prices in search query thanks to @michaelbromley
image

@Baroshem
Copy link
Contributor Author

Category page is now working correctly.
image

@Baroshem Baroshem changed the title [WIP] Integration + Product + Category Integration + Product + Category Aug 10, 2021
push:
branches:
- main
- develop
Copy link

@Mateuszpietrusinski Mateuszpietrusinski Aug 10, 2021

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

Suggested change
- develop

Copy link

@Mateuszpietrusinski Mateuszpietrusinski left a 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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

Suggested change
- develop

}

const getProduct = async (context: Context, params: ProductParams, customQuery?: CustomQuery): Promise<ApolloQueryResult<ProductData>> => {

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>({

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';

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

@Baroshem Baroshem merged commit beefc2d into main Aug 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants