Since the CSV data does not always come in the right format and you might like to change or add values, we have inserted a hook for this.
Override CSV-line
This function is called before the CSV line is written to the database. You can edit the values as desired and re-write them back into the array. Adding values does not work.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
function atkp_modify_csv_before_db_write_callback( $data ) { $shopid = $data['ShopId']; $productNumber = $data['ProductNumber']; $productTitle = $data['ProductTitle']; $productEAN = $data['ProductEAN']; $productISBN= $data['ProductISBN']; $productDescription = $data['ProductDescription']; $productFeatures= $data['ProductFeatures']; $productPrice= $data['ProductPrice']; $productLink= $data['ProductLink']; $productImage= $data['ProductImage']; $productSmallImage= $data['ProductSmallImage']; $productAvailability= $data['ProductAvailability']; $productShippingCosts= $data['ProductShippingCosts']; $productManufacturer= $data['ProductManufacturer']; $productBrand= $data['ProductBrand']; $productText1= $data['ProductText1']; $productText2= $data['ProductText2']; $productText3= $data['ProductText3']; $productText4= $data['ProductText4']; $lineNumber= $data['LineNumber']; $importDate= $data['ImportDate']; return $data; } add_filter( 'atkp_modify_csv_before_db_write', 'atkp_modify_csv_before_db_write_callback'); |
Parameter | Description |
data | The Array with the values. The array corresponds to a data record. |
Return value | The overridden values. |
Tip: Use a plugin like My Custom Functions or a child theme to build your hooks!