River Island Deactivation Script

River Island Deactivation Script

We need to make a custom script and based on the variation group to end and close items in certain cases.

Sample File:

PartnerProductDeactivationFeed_20230607122036 (1).csv

The file format will be .csv with comma (,) delimiter.

For each channel/account we will have a dedicated column and based on the header we should be able to map for which account in Hemi they refer.

In order to make this flexible and scalable we want to use the Account > Default Language field in Hemi.

In Account > Default Language we will expect the same value as the column name which will allow us to filter the accounts and map the columns.

There are couple of steps which we have to make once we have mapped the correct column header.

  1. We should get each row ‘product id’ field (the second column) from the file and map it to our Product Account > Variation Group

  2. If there is a match and the value for the mapped column and row is “deactivate“ we want for all variants (Product Accounts) which are part of that variation group to set:

Product Account > End Item = 1

Product Account > Closed = 1.

  1. If there is a match and but there is no value or different from “deactivate“ we do nothing.

We want to use FTP Credentials table from where we want to select the FTP and the paths.

The FTP Credential > Type should be “River Island Deactivation Script“ and we want to have two paths.

”Pick from” - specify from which folder to pick the file on the FPT.

”Move to Success” - specify where to move the file after successful import on the FTP.

”Move to Error” - specify where to move the file after error on the FTP.

We want to pick the files one by one despite the file names, if for some reason an error occur we want to print it in the terminal and move the file into the Error folder.

Validations which we should have:

  • Pick only files with .csv extension
  • Pick files one by one
  • If we have a fatal error for some reason or error when reading the file we want to move it to error and continue with the next one
Is this article helpful?
0 0 0