Skip to content

Commit

Permalink
Merge pull request #3038 from michasik/bugfix/#2987
Browse files Browse the repository at this point in the history
Bugfix/#2987
  • Loading branch information
pkarw committed Jun 24, 2019
2 parents c1e646e + 2a1fe4d commit b6a94da
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 32 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.11.0-rc.1] - UNRELEASED

### Added
-
-

### Fixed
-
- Fixed product link in wishlist and microcart - @michasik (#2987)

### Changed / Improved
-
-

## [1.10.0-rc.1] - 2019.06.19

Expand Down
5 changes: 2 additions & 3 deletions core/lib/multistore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface LocalizedRoute {
path?: string,
name?: string,
hash?: string,
params?: object,
params?: { [key: string]: unknown },
fullPath?: string,
host?: string
}
Expand Down Expand Up @@ -160,9 +160,8 @@ export function localizedDispatcherRoute (routeObj: LocalizedRoute | string, sto

export function localizedRoute (routeObj: LocalizedRoute | string | RouteConfig | RawLocation, storeCode: string): any {
if (routeObj && (routeObj as LocalizedRoute).fullPath && config.seo.useUrlDispatcher) {
return localizedDispatcherRoute(Object.assign({}, routeObj, { params: null }) as LocalizedRoute, storeCode)
return localizedDispatcherRoute(Object.assign({}, routeObj) as LocalizedRoute, storeCode)
}

if (storeCode && routeObj && config.defaultStoreCode !== storeCode && config.storeViews[storeCode].appendStoreCode) {
if (typeof routeObj === 'object') {
if (routeObj.name) {
Expand Down
5 changes: 3 additions & 2 deletions core/modules/url/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,14 @@ export function formatProductLink (
url_path?: string,
type_id: string,
slug: string,
configurable_children: []
options?: [],
configurable_children?: []
},
storeCode
): string | LocalizedRoute {
if (config.seo.useUrlDispatcher && product.url_path) {
let routeData: LocalizedRoute;
if (product.configurable_children && product.configurable_children.length > 0) {
if ((product.options && product.options.length > 0) || (product.configurable_children && product.configurable_children.length > 0)) {
routeData = {
fullPath: product.url_path,
params: { childSku: product.sku }
Expand Down
14 changes: 6 additions & 8 deletions src/themes/default/components/core/blocks/Microcart/Product.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,7 @@
<div>
<router-link
class="serif h4 name"
:to="localizedRoute({
name: product.type_id + '-product',
params: {
parentSku: product.parentSku ? product.parentSku : product.sku,
slug: product.slug,
childSku: product.sku
}
})"
:to="productLink"
data-testid="productLink"
@click.native="$store.commit('ui/setMicrocart', false)"
>
Expand Down Expand Up @@ -93,6 +86,8 @@
<script>
import config from 'config'
import Product from '@vue-storefront/core/compatibility/components/blocks/Microcart/Product'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import { formatProductLink } from '@vue-storefront/core/modules/url/helpers'
import ProductImage from 'theme/components/core/ProductImage'
import RemoveButton from './RemoveButton'
Expand All @@ -115,6 +110,9 @@ export default {
loading: this.thumbnail,
src: this.thumbnail
}
},
productLink () {
return formatProductLink(this.product, currentStoreView().storeCode)
}
},
data () {
Expand Down
26 changes: 10 additions & 16 deletions src/themes/default/components/core/blocks/Wishlist/Product.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
<template>
<li class="row pr55 py20">
<div class="image" @click="closeWishlist">
<router-link :to="localizedRoute({
name: product.type_id + '-product',
fullPath: product.url_path,
params: { parentSku: product.parentSku ? product.parentSku : product.sku, slug: product.slug, childSku: product.sku }
})"
>
<product-image :image="image" />
<router-link :to="productLink">
<img v-lazy="thumbnail">
</router-link>
</div>
<div class="col-xs between-xs flex pl40 py15">
<div @click="closeWishlist">
<router-link :to="localizedRoute({
name: product.type_id + '-product',
fullPath: product.url_path,
params: { parentSku: product.parentSku ? product.parentSku : product.sku, slug: product.slug, childSku: product.sku }
})"
>
<router-link :to="productLink">
{{ product.name | htmlDecode }}
</router-link>
<div class="h6 cl-bg-tertiary pt5 sku">
Expand Down Expand Up @@ -45,16 +35,20 @@

<script>
import Product from '@vue-storefront/core/compatibility/components/blocks/Wishlist/Product'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'
import { formatProductLink } from '@vue-storefront/core/modules/url/helpers'
import RemoveButton from './RemoveButton'
import ProductImage from 'theme/components/core/ProductImage'
export default {
components: {
RemoveButton,
ProductImage
RemoveButton
},
mixins: [Product],
computed: {
productLink () {
return formatProductLink(this.product, currentStoreView().storeCode)
},
image () {
return {
loading: this.thumbnail,
Expand Down

0 comments on commit b6a94da

Please sign in to comment.