simplify product category handling
This commit is contained in:
@ -12,7 +12,7 @@ import {
|
||||
formatGqlForJSON,
|
||||
} from "./shopifyApi"
|
||||
import * as shopify from 'shopify-admin-api-typings'
|
||||
import { getCellRangeByColumnName, getRowByColumnValue } from "./sheetUtils"
|
||||
import { getCellRangeByColumnName, getRowByColumnValue, vlookupByColumns } from "./sheetUtils"
|
||||
import { Config } from "./config"
|
||||
|
||||
|
||||
@ -114,6 +114,10 @@ export class Product {
|
||||
)
|
||||
}
|
||||
|
||||
ShopifyCategory(): string {
|
||||
return vlookupByColumns("values", "product_type", this.category, "shopify_category")
|
||||
}
|
||||
|
||||
ToShopifyProductSet() {
|
||||
let sps = new ShopifyProductSetInput()
|
||||
//TODO: map category IDs
|
||||
@ -125,6 +129,7 @@ export class Product {
|
||||
sps.status = this.shopify_status
|
||||
}
|
||||
sps.productType = this.product_type
|
||||
sps.category = this.ShopifyCategory()
|
||||
sps.tags = this.tags
|
||||
sps.title = this.title
|
||||
sps.descriptionHtml = this.description
|
||||
|
||||
Reference in New Issue
Block a user