-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Bugfix/thumbnail images of products in view order #3273
Bugfix/thumbnail images of products in view order #3273
Conversation
@patzick please review |
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.
Welcome @obsceniczny in our community :)
Thanks for this feature, nice start!
Things to jump more into:
- this is feature so branch should be crated from develop and merged back to develop -> ReleaseCycle
- instead of promises it is cleaner to use async/await; i've left you suggestions for method
- in case of problems with loading product etc; we should show an placeholder until proper image is ready. Please get familiar with ProductImage component
Let me know if anything is unclear! :)
CHANGELOG.md
Outdated
@@ -36,6 +36,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
|
|||
## [1.10.0-rc.2] - UNRELEASED | |||
|
|||
### Added | |||
- Added product image in order summary - @obsceniczny (#2544) |
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.
this needs to be moved into 1.11 changelog
...mapActions({ | ||
getProduct: 'product/single' | ||
}), | ||
getProductThumbnail (productSku) { |
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.
getProductThumbnail (productSku) { | |
async getProductThumbnail (productSku) { |
getProduct: 'product/single' | ||
}), | ||
getProductThumbnail (productSku) { | ||
if (this.itemThumbnail[productSku] === undefined || this.itemThumbnail[productSku] === null) { |
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.
it is the same as this, but more readable
if (this.itemThumbnail[productSku] === undefined || this.itemThumbnail[productSku] === null) { | |
if (!this.itemThumbnail[productSku]) { |
}), | ||
getProductThumbnail (productSku) { | ||
if (this.itemThumbnail[productSku] === undefined || this.itemThumbnail[productSku] === null) { | ||
this.getProduct({ options: { sku: productSku }, setCurrentProduct: false, setCurrentCategoryPath: false, selectDefaultVariant: false, skipCache: true }) |
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.
this.getProduct({ options: { sku: productSku }, setCurrentProduct: false, setCurrentCategoryPath: false, selectDefaultVariant: false, skipCache: true }) | |
const product = await this.getProduct({ options: { sku: productSku }, setCurrentProduct: false, setCurrentCategoryPath: false, selectDefaultVariant: false }) |
getProductThumbnail (productSku) { | ||
if (this.itemThumbnail[productSku] === undefined || this.itemThumbnail[productSku] === null) { | ||
this.getProduct({ options: { sku: productSku }, setCurrentProduct: false, setCurrentCategoryPath: false, selectDefaultVariant: false, skipCache: true }) | ||
.then(product => { |
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.
.then(product => { |
this.getProduct({ options: { sku: productSku }, setCurrentProduct: false, setCurrentCategoryPath: false, selectDefaultVariant: false, skipCache: true }) | ||
.then(product => { | ||
this.itemThumbnail[productSku] = getThumbnailPath(product.image, 80, 80) | ||
}) |
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 (this.itemThumbnail[productSku] === undefined || this.itemThumbnail[productSku] === null) { | ||
this.getProduct({ options: { sku: productSku }, setCurrentProduct: false, setCurrentCategoryPath: false, selectDefaultVariant: false, skipCache: true }) | ||
.then(product => { | ||
this.itemThumbnail[productSku] = getThumbnailPath(product.image, 80, 80) |
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.
this.itemThumbnail[productSku] = getThumbnailPath(product.image, 80, 80) | |
this.itemThumbnail[productSku] = getThumbnailPath(product.image, 80, 80) |
@@ -63,35 +66,38 @@ | |||
<td class="fs-medium lh25" :data-th="$t('Subtotal')"> | |||
{{ item.row_total_incl_tax | price }} | |||
</td> | |||
<td class="fs-medium lh25"> | |||
<img :src="getProductThumbnail(item.sku)"> |
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.
i would be nice to use ProductImage component here, to show placeholders until proper product image is loaded
@patzick could You look? |
Thanks @obsceniczny, i need to checkout this branch and test if there is placeholder before actual image is loaded. Overall looks good now, i will get back with this soon :) |
…ithub.com:obsceniczny/vue-storefront into bugfix/thumbnail-images-of-products-in-view-order
@patzick I fixed linting causing Travis failing |
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.
getProduct: 'product/single' | ||
}) | ||
}, | ||
beforeMount () { |
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.
i'd do that on mounted, so there is no way to have problems with SSR
beforeMount () { | |
mounted () { |
}) | ||
}, | ||
beforeMount () { | ||
this.skipGrouped(this.order.items).forEach(async item => { |
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.
could you also with this PR change skipGrouped
method to computed singleOrderItems
or something like this? It should really be a computed property not a method, and then here (and in other places) it would just be this.singleOrderItems.find(...
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.
I don't really see what do you mean by using find. We process a whole array here, we're not aiming at getting a single element, could you elaborate? As for computed property I completely agree.
}, | ||
beforeMount () { | ||
this.skipGrouped(this.order.items).forEach(async item => { | ||
if (this.itemThumbnail[item.sku] === undefined || this.itemThumbnail[item.sku] === null) { |
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.
it's the same as
if (this.itemThumbnail[item.sku] === undefined || this.itemThumbnail[item.sku] === null) { | |
if (this.itemThumbnail[item.sku]) { |
@obsceniczny I just wanted to kindly ask you about the progress with this ticket? Can we apply the changes sugessted by @patzick in order to merge this in? |
@pkarw I have some uncommited changes and I will do my best to end this until weekend |
@obsceniczny is it ready for re-review? :) |
Yes, it is ;) |
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.
Thanks, @obsceniczny, nice work! :)
Related issues
closes #2544
Short description and why it's useful
Screenshots of visual changes before/after (if there are any)
Which environment this relates to
Check your case. In case of any doubts please read about Release Cycle
develop
branch and want to merge it back todevelop
release
branch and want to merge it back torelease
hotfix
ormaster
branch and want to merge it back tohotfix
Upgrade Notes and Changelog
IMPORTANT NOTICE - Remember to update
CHANGELOG.md
with description of your changeContribution and currently important rules acceptance