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

Bugfix/thumbnail images of products in view order #3273

Merged
merged 12 commits into from
Aug 26, 2019
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Collaborator

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


### Fixed
- Wrong meta description attribute by page overwrite - @przspa (#3091)
- The SSR Cms console errors fixed + `magento-2-cms` module removed - @pkarw (#3155)
Expand Down
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/cs-CZ.csv
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@
"to account","na účet"
"Are you sure you would like to remove this item from the shopping cart?","Opravdu chcete tuto položku odebrat z nákupního košíku?"
"You need to be logged in to see this page","Pro zobrazení této stránky musíte být přihlášeni"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/de-DE.csv
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@
"You need to be logged in to see this page","Sie müssen angemeldet sein, um diese Seite anzuzeigen"
"Quantity must be above 0","Die Menge muss größer als 0 sein"
"Error: Error while adding products","Error: Fehler beim hinzufügen der Produkte"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/en-US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@
"Unexpected authorization error. Check your Network conection.","Unexpected authorization error. Check your Network conection."
"Columns","Columns"
"You are going to pay for this order upon delivery.","You are going to pay for this order upon delivery."
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/es-ES.csv
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
"Unhandled error, wrong response format!","¡Error no controlado, formato de respuesta incorrecto!"
"Are you sure you would like to remove this item from the shopping cart?","¿Está seguro de que desea eliminar este artículo de la cesta de la compra?"
"You need to be logged in to see this page","Necesitas iniciar sesión para ver esta página"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/fr-FR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@
"Must be greater than 0","Doit être supérieur à 0"
"Are you sure you would like to remove this item from the shopping cart?","Etes-vous sûr de vouloir supprimer cet objet de votre panier ?"
"You need to be logged in to see this page","Vous devez être connecté pour voir cette page"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/it-IT.csv
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@
"password","password"
"Are you sure you would like to remove this item from the shopping cart?","Sei sicuro di voler rimuovere questo articolo dal carrello?"
"You need to be logged in to see this page","Devi essere loggato per vedere questa pagina"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/jp-JP.csv
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,4 @@
"You will receive Push notification after coming back online. You can confirm the order by clicking on it","オンラインになるとプッシュ通知が送られ、そこから注文の確認ができます。"
"Zipcode","郵便番号"
"Zip-code","郵便番号"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/nl-NL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ Error with response - bad content-type!,Error with response - bad content-type!
"Unhandled error, wrong response format!","Unhandled error, wrong response format!"
"Are you sure you would like to remove this item from the shopping cart?","Weet u zeker dat u dit artikel uit uw mandje wilt verwijderen?"
"You need to be logged in to see this page","U moet ingelogd zijn om deze pagina te bekijken"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/pl-PL.csv
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@
"Must be greater than 0","Musi być większa niż 0"
"Are you sure you would like to remove this item from the shopping cart?","Czy na pewno chcesz usunąć ten produkt z koszyka?"
"You need to be logged in to see this page","Musisz być zalogowany, aby zobaczyć tę stronę"
"Thumbnail","Miniaturka"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/pt-BR.csv
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
"OK","OK"
"Are you sure you would like to remove this item from the shopping cart?","Tem certeza de que deseja remover este item do carrinho de compras?"
"You need to be logged in to see this page","Você precisa estar logado para ver esta página"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/pt-PT.csv
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
"OK","OK"
"Are you sure you would like to remove this item from the shopping cart?","Tem a certeza de que deseja remover este item do Cesto de Compras?"
"You need to be logged in to see this page","Precisa de iniciar sessão para ver esta página"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/ru-RU.csv
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@
"Unhandled error, wrong response format!","Необработанная ошибка, неверный формат ответа!"
"Are you sure you would like to remove this item from the shopping cart?","Вы уверены, что хотите удалить этот товар из корзины?"
"You need to be logged in to see this page","Вы должны войти в систему, чтобы увидеть эту страницу"
"Thumbnail","Thumbnail"
1 change: 1 addition & 0 deletions core/i18n/resource/i18n/zh-cn.csv
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@
"Please configure product bundle options and fix the validation errors","请配置商品属性选项并修复验证错误"
"Processing order...","订单处理中..."
"You need to be logged in to see this page","您需要登录才能查看此页面"
"Thumbnail","Thumbnail"
38 changes: 32 additions & 6 deletions src/themes/default/components/core/blocks/MyAccount/MyOrder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
<th class="serif lh20">
{{ $t('Subtotal') }}
</th>
<th class="serif lh20">
{{ $t('Thumbnail') }}
</th>
</tr>
</thead>
<tbody>
Expand All @@ -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)">
Copy link
Collaborator

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

</td>
</tr>
</tbody>
<tfoot>
<tr class="brdr-top-1 brdr-cl-bg-secondary">
<td colspan="4" class="align-right">
<td colspan="5" class="align-right">
{{ $t('Subtotal') }}
</td>
<td>{{ order.subtotal | price }}</td>
</tr>
<tr>
<td colspan="4" class="align-right">
<td colspan="5" class="align-right">
{{ $t('Shipping') }}
</td>
<td>{{ order.shipping_amount | price }}</td>
</tr>
<tr>
<td colspan="4" class="align-right">
<td colspan="5" class="align-right">
{{ $t('Tax') }}
</td>
<td>{{ order.tax_amount + order.discount_tax_compensation_amount | price }}</td>
</tr>
<tr v-if="order.discount_amount">
<td colspan="4" class="align-right">
<td colspan="5" class="align-right">
{{ $t('Discount') }}
</td>
<td>{{ order.discount_amount | price }}</td>
</tr>
<tr>
<td colspan="4" class="align-right">
<td colspan="5" class="align-right">
{{ $t('Grand total') }}
</td>
<td>{{ order.grand_total | price }}</td>
Expand Down Expand Up @@ -139,13 +145,33 @@
<script>
import MyOrder from '@vue-storefront/core/compatibility/components/blocks/MyAccount/MyOrder'
import ReturnIcon from 'theme/components/core/blocks/Header/ReturnIcon'
import { getThumbnailPath } from '@vue-storefront/core/helpers'
import { mapActions } from 'vuex'

export default {
mixins: [MyOrder],
components: {
ReturnIcon
},
data () {
return {
itemThumbnail: []
}
},
methods: {
...mapActions({
getProduct: 'product/single'
}),
getProductThumbnail (productSku) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
getProductThumbnail (productSku) {
async getProductThumbnail (productSku) {

if (this.itemThumbnail[productSku] === undefined || this.itemThumbnail[productSku] === null) {
Copy link
Collaborator

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

Suggested change
if (this.itemThumbnail[productSku] === undefined || this.itemThumbnail[productSku] === null) {
if (!this.itemThumbnail[productSku]) {

this.getProduct({ options: { sku: productSku }, setCurrentProduct: false, setCurrentCategoryPath: false, selectDefaultVariant: false, skipCache: true })
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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 })

.then(product => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
.then(product => {

this.itemThumbnail[productSku] = getThumbnailPath(product.image, 80, 80)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
this.itemThumbnail[productSku] = getThumbnailPath(product.image, 80, 80)
this.itemThumbnail[productSku] = getThumbnailPath(product.image, 80, 80)

})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
})

}
return this.itemThumbnail[productSku]
}
}

}
</script>

Expand Down