@lancom/shared 0.0.360 → 0.0.361
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -180,7 +180,7 @@ export function generateCategoryPath(cat) {
|
|
|
180
180
|
return baseLink;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
export function generateProductLink(product, color, toEditor = false) {
|
|
183
|
+
export function generateProductLink(product, color, toEditor = false, size) {
|
|
184
184
|
const baseLink = `/${product.brand?.alias}/${product.productType?.alias}/${product.alias}`;
|
|
185
185
|
let link = toEditor ? `${baseLink}/editor` : baseLink;
|
|
186
186
|
if (product.useTaxonomyUrl) {
|
|
@@ -190,7 +190,14 @@ export function generateProductLink(product, color, toEditor = false) {
|
|
|
190
190
|
link = toEditor ? `${categoryBaseLink}.html` : `${categoryBaseLink}/info.html`;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
const query = [];
|
|
194
|
+
if (color) {
|
|
195
|
+
query.push(`color=${color.alias || color}`);
|
|
196
|
+
}
|
|
197
|
+
if (size) {
|
|
198
|
+
query.push(`size=${size.shortName || size}`);
|
|
199
|
+
}
|
|
200
|
+
return `${link}${query.length > 0 ? `?${query.join('&')}` : ''}`;
|
|
194
201
|
}
|
|
195
202
|
|
|
196
203
|
export function getProductColorImages(product, color, skipDefault = false) {
|
package/mixins/product-view.js
CHANGED
|
@@ -249,7 +249,6 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
249
249
|
},
|
|
250
250
|
jsonld() {
|
|
251
251
|
const { name, aggregateRating, reviews, brand, SKU } = this.product;
|
|
252
|
-
const url = `https://${this.shop.url}/${this.product.brand.alias}/${this.product.productType.alias}/${this.product.alias}`;
|
|
253
252
|
let brandAdditionalProductsRichSnippet = {};
|
|
254
253
|
try {
|
|
255
254
|
brandAdditionalProductsRichSnippet = JSON.parse(this.product.brand.additionalProductsRichSnippet);
|
|
@@ -262,6 +261,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
262
261
|
description: description,
|
|
263
262
|
name,
|
|
264
263
|
hasVariant: this.productDetails?.simpleProducts.map(sp => {
|
|
264
|
+
const url = `https://${this.shop.url}${generateProductLink(this.product, sp.color, this.isEditor, sp.size)}`;
|
|
265
265
|
const spMaxPrice = (sp.pricing || []).reduce((price, pricing) => Math.max(price, pricing.price), 0);
|
|
266
266
|
const maxPrice = this.printsPrice ? spMaxPrice + this.printsPrice : spMaxPrice;
|
|
267
267
|
const availability = sp.quantityStock > 0 ? 'InStock' : 'OutOfStock';
|
|
@@ -295,8 +295,10 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
|
|
|
295
295
|
'@type': 'http://schema.org/QuantitativeValue',
|
|
296
296
|
value: this.product.sameDayDispatch ? 1 : 0
|
|
297
297
|
};
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
if (sp.quantityStock > 0) {
|
|
299
|
+
offer.shippingDetails = { "@id": "#shipping_policy" };
|
|
300
|
+
offer.hasMerchantReturnPolicy = { "@id": "#return_policy" };
|
|
301
|
+
}
|
|
300
302
|
}
|
|
301
303
|
|
|
302
304
|
const galleryImages = this.product.images?.filter(i => !(i.types || []).includes('designer') && i.color === sp.color?._id) || [];
|