misc fixes

*  updateShopifyProductHandler acts on all selected rows
*  updateProductToShopify checks SKU more quickly
*  defaults are always set products
This commit is contained in:
Ben Miller
2024-11-19 21:49:41 -07:00
parent ce0c233dd3
commit 6c7092bc5e
3 changed files with 27 additions and 14 deletions

View File

@ -3,6 +3,7 @@ import { fillProductFromTemplate } from "./fillProductFromTemplate"
import { createMissingPhotoFolders } from "./createMissingPhotoFolders"
import { matchProductToShopify, updateProductToShopify } from "./match"
import { reinstallTriggers } from "./triggers"
import { toastAndLog } from "./sheetUtils"
export function initMenu() {
let ui = SpreadsheetApp.getUi()
@ -48,8 +49,19 @@ export function updateShopifyProductHandler() {
console.log("skipping edit on sheet " + sheet.getName())
return
}
let row = SpreadsheetApp.getCurrentCell().getRow()
updateProductToShopify(row)
let selectedRanges = SpreadsheetApp.getActiveRangeList().getRanges()
if (selectedRanges == null || selectedRanges.length == 0) {
toastAndLog("Select ranges to be updated")
return
}
for (let i = 0; i < selectedRanges.length; i++) {
let range = selectedRanges[i]
let firstRow = range.getRow()
let lastRow = range.getLastRow()
for (let row = firstRow; row <= lastRow; row++) {
updateProductToShopify(row)
}
}
}
export function reauthorizeScript() {