Aggiornamento cataloghi...
This commit is contained in:
@@ -129,6 +129,17 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
},
|
||||
|
||||
getArrayidArgomentoByArridCatProds: (state: IProductsState) => (arridCatProds: string[]): string[] => {
|
||||
const myarr: string[] = []
|
||||
for (const idCatProd of arridCatProds) {
|
||||
const catprod = state.catprods.find((rec: ICatProd) => rec._id === idCatProd)
|
||||
if (catprod && catprod.idArgomento && !myarr.includes(catprod.idArgomento.toString())) {
|
||||
myarr.push(catprod.idArgomento.toString())
|
||||
}
|
||||
}
|
||||
return myarr
|
||||
},
|
||||
|
||||
getCatProdsByGas: (state: IProductsState) => (idGasOrdine: string): ICatProd[] => {
|
||||
let arrcat = state.catprods_gas
|
||||
|
||||
@@ -163,7 +174,7 @@ export const useProducts = defineStore('Products', {
|
||||
}
|
||||
if (myarrcat) {
|
||||
if (mystr)
|
||||
mystr = ' - '
|
||||
mystr += ' - '
|
||||
mystr += myarrcat.name
|
||||
}
|
||||
}
|
||||
@@ -547,13 +558,13 @@ export const useProducts = defineStore('Products', {
|
||||
this.products = [...arrprod]
|
||||
},*/
|
||||
|
||||
async getProductById(id: string): Promise<IProduct> {
|
||||
async getProductById(id: string, forza?: boolean): Promise<IProduct> {
|
||||
let prod = null
|
||||
try {
|
||||
if (!id) {
|
||||
return null
|
||||
}
|
||||
if (!this.products) {
|
||||
if (!this.products || forza) {
|
||||
// Se non lo carico all'avvio, allora fai la chiamata al server
|
||||
prod = await this.loadProductById(id)
|
||||
} else {
|
||||
@@ -574,8 +585,8 @@ export const useProducts = defineStore('Products', {
|
||||
|
||||
//console.log('loadProducts')
|
||||
|
||||
if (!globalStore.site.confpages.enableEcommerce)
|
||||
return null
|
||||
// if (!globalStore.site.confpages.enableEcommerce)
|
||||
// return null
|
||||
|
||||
// console.log('getProducts', 'userid=', this.userActive._id)
|
||||
|
||||
@@ -711,8 +722,8 @@ export const useProducts = defineStore('Products', {
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
|
||||
if (!globalStore.site.confpages.enableEcommerce)
|
||||
return null
|
||||
//if (!globalStore.site.confpages.enableEcommerce)
|
||||
// return null
|
||||
|
||||
// if (this.userActive._id === '') {
|
||||
// return new Types.AxiosError(0, null, 0, '')
|
||||
@@ -1384,23 +1395,23 @@ export const useProducts = defineStore('Products', {
|
||||
const long_descr = myproduct.productInfo.description || '';
|
||||
const date_pub = tools.getstrDateShort(myproduct.productInfo.date_pub) || '';
|
||||
const fatLast3M = myproduct.productInfo.fatLast3M! || 0;
|
||||
const fatLast6M = myproduct.productInfo.fatLast6M! || 0;
|
||||
const vLast3M = myproduct.productInfo.vLast3M! || 0;
|
||||
const vLast6M = myproduct.productInfo.vLast6M! || 0;
|
||||
const ranking_globale = myproduct.productInfo.rank3M! || 0;
|
||||
const ranking = myproduct.indiceRanking! || 0;
|
||||
const venduti = myproduct.productInfo.totVen! || 0;
|
||||
const fatturati = myproduct.productInfo.totFat! || 0;
|
||||
|
||||
const linkvenduti = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-ordini-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">' + venduti + '</a>'
|
||||
const linkfatturati = '<a href="http://vps-88271abb.vps.ovh.net/apimacro/public/view-fatturati-by-idarticolo/' + myproduct.productInfo.sku + '" target="_blank">' + fatturati + '</a>'
|
||||
const debugstr = this.getkeyValStr('Pubblicato il', date_pub) +
|
||||
this.getkeyValStr('Rank', ranking) +
|
||||
this.getkeyValStr('Rank3M', myproduct.productInfo.rank3M) +
|
||||
this.getkeyValStr('Venduti', linkvenduti) +
|
||||
this.getkeyValStr('vLast3M', vLast3M) +
|
||||
this.getkeyValStr('vLast6M', vLast6M) +
|
||||
this.getkeyValStr('Fatturati', linkfatturati) +
|
||||
this.getkeyValStr('fatLast3M', fatLast3M)
|
||||
this.getkeyValStr('fatLast3M', fatLast3M) +
|
||||
this.getkeyValStr('fatLast6M', fatLast6M)
|
||||
|
||||
const truncatedDescription = description.length > maxDescriptionLength
|
||||
? description.substring(0, description.lastIndexOf(' ', maxDescriptionLength)) + '...'
|
||||
@@ -1467,7 +1478,6 @@ export const useProducts = defineStore('Products', {
|
||||
'{argomento}': categoria || '',
|
||||
'{date_pub}': date_pub || '',
|
||||
'{ranking_globale}': ranking_globale || '',
|
||||
'{ranking}': ranking || '',
|
||||
'{venduti}': venduti || '',
|
||||
'{formato}': formato || '',
|
||||
'{collana_title}': collana ? collana.title || '' : '',
|
||||
|
||||
Reference in New Issue
Block a user