#Extending batch job: What I'm missing?

17 messages · Page 1 of 1 (latest)

fathom walrus
#

HI all, basically what I want to achieve is adding custom fields into the product and make the import csv in admin still work:

Steps done:

  • Added the custom fields into the product model [ok]
  • Created and done the migration [OK]
  • Extended the loaders array defaultAdminProductField[ok]
  • Extended the AdminPostProductsReq and AdminPostProductsProductReq and Overridden the validators [ok]
  • Tested that the product import still was working also with the csv template ( the one with Sales Channels is wrong on the docs , I fixed it)

Now the steps that I've done but I'm not sure

  • Created under strategies/batch-job/product/types another column-definition.ts where I've added the new custom fields (img 1 )
  • Created under strategies/batch-job/product/import.ts new file where I copy pasted basically the same code of the core file commenting the lines that were giving me error (ts 2612) and one for the iFileService (img2)
  • When uploading the csv I have this error: An error occurred while processing batch.created: Error: The csv file parsing failed due to: Unable to treat column Product Year from the csv file. No target column found in the provided schema.

Any help is appreciated :))

fathom walrus
#

Anyone? 🙂

fathom walrus
#

little bump

spark totem
#

Not sure mate, what's the issue

fathom walrus
#

I cannot make work the import csv from admin after adding custom fields basically 🙂

#

I extended the batch job but I don't know what's missing or what's wrong

rugged hatch
#

I cannot find the batch job strategy in your directoy, no sure the types file will even be loaded as it is not a strategy class. You would need to extend the current import and initialise the csv parser with the updated column definition. Or move you current column definition mutation into a loader instead

fathom walrus
#

hi @rugged hatch thanks for answering me, yesterday @brazen geyser was so kind to take a look at it and we were trying to do stuff, I reverted the changes to how I was stuck, do you mind take a look? With Riqwan we tried to do the second solution taht you proposed, (img below) I didn't have any luck with it

fathom walrus
#

@brazen geyser found the solution, I'll explain the steps ASAP! thanks!

alpine shoal
#

@fathom walrus looks like you were able to resolve your concern? Do you mind sharing this as I also need to do the same thing.

fathom walrus
#

So basically the problem was related to the fact that the loaders were not loading them properly

#

line 5

#

and the folder custom loaders in src/custom-loaders

tame bramble
#

how about if I extend the metadata of product @fathom walrus

fathom walrus
#

The metadata is already extended by definition