- ottimizzato il caricamento del sito
- ottimizzato il caricamento del catalogo.
This commit is contained in:
@@ -108,24 +108,24 @@ function getRecordProductEmpty(): IProduct {
|
||||
bookableAvailableQty: 0,
|
||||
minBuyQty: 1,
|
||||
minStepQty: 1,
|
||||
maxBookableSinglePersQty: 0,
|
||||
// maxBookableSinglePersQty: 0,
|
||||
|
||||
stockQty: 0,
|
||||
stockBloccatiQty: 0,
|
||||
bookedQtyOrdered: 0,
|
||||
bookedQtyConfirmed: 0,
|
||||
// stockBloccatiQty: 0,
|
||||
// bookedQtyOrdered: 0,
|
||||
// bookedQtyConfirmed: 0,
|
||||
|
||||
qtyToReachForGas: 0,
|
||||
// qtyToReachForGas: 0,
|
||||
|
||||
maxbookableGASQty: 0,
|
||||
bookedGASQtyOrdered: 0,
|
||||
bookedGASQtyConfirmed: 0,
|
||||
bookableGASBloccatiQty: 0,
|
||||
// maxbookableGASQty: 0,
|
||||
// bookedGASQtyOrdered: 0,
|
||||
// bookedGASQtyConfirmed: 0,
|
||||
// bookableGASBloccatiQty: 0,
|
||||
|
||||
canBeShipped: false,
|
||||
QuantitaOrdinateInAttesa: 0,
|
||||
QuantitaPrenotateInAttesa: 0,
|
||||
canBeBuyOnline: false,
|
||||
// canBeShipped: false,
|
||||
// QuantitaOrdinateInAttesa: 0,
|
||||
// QuantitaPrenotateInAttesa: 0,
|
||||
// canBeBuyOnline: false,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -978,19 +978,22 @@ export const useProducts = defineStore('Products', {
|
||||
return ris;
|
||||
},
|
||||
|
||||
async loadProductById(id: string) {
|
||||
async loadProductById(id: string, forzacaricamento?: boolean) {
|
||||
const userStore = useUserStore();
|
||||
const globalStore = useGlobalStore();
|
||||
|
||||
//if (!globalStore.site.confpages.enableEcommerce)
|
||||
// return null
|
||||
|
||||
// if (this.userActive._id === '') {
|
||||
// return new Types.AxiosError(0, null, 0, '')
|
||||
// }
|
||||
|
||||
let ris = null;
|
||||
|
||||
let myprod = null;
|
||||
|
||||
if (this.products && !forzacaricamento) {
|
||||
// cerca su this.products
|
||||
myprod = this.products.find((prod: IProduct) => prod._id === id);
|
||||
if (myprod) {
|
||||
return myprod
|
||||
}
|
||||
}
|
||||
|
||||
ris = await Api.SendReq('/products/id/' + id, 'GET', null)
|
||||
.then((res) => {
|
||||
console.log('product', res.data.product);
|
||||
@@ -1932,9 +1935,9 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
arr.push({ label: mylabel, value: myelem._id });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return arr
|
||||
return arr;
|
||||
},
|
||||
getOptCatalogoPrintTemplate() {
|
||||
// Ottieni l'array delle pagine che in cataloghi sono dimensioni_def.isTemplate
|
||||
@@ -1958,9 +1961,9 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
arr.push({ label: mylabel, value: myelem._id });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return arr
|
||||
return arr;
|
||||
},
|
||||
|
||||
getSchedeOpt(arrschede: ISchedaSingola[], tag?: string): any[] {
|
||||
@@ -2159,6 +2162,14 @@ export const useProducts = defineStore('Products', {
|
||||
});
|
||||
},
|
||||
|
||||
updateProductsByArray: (state: IProductsState) => (arrrec: IProduct[]) => {
|
||||
if (arrrec && arrrec.length > 0) {
|
||||
// update products array from this array
|
||||
const myarr = state.products.filter((rec) => !arrrec.find((newrec) => newrec._id === rec._id));
|
||||
state.products = myarr.concat(arrrec);
|
||||
}
|
||||
},
|
||||
|
||||
getPathByPage(idpag: string) {
|
||||
let linkpage = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user