Skip to content

Commit

Permalink
Error Check: trim whitespace on type column
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Sides committed Nov 26, 2020
1 parent 50d40e9 commit ab9718f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"name": "pyxl/fillauer-product-importer",
"description": "WordPress plugin for importing spreadsheet products as WP posts",
"type": "wordpress-plugin",
"version": "1.8.1"
"version": "1.8.2"
}
11 changes: 9 additions & 2 deletions dist/scripts/client.js

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions dist/scripts/products.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fillauer-product-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Fillauer Product Importer
* Description: Import a CSV file to update products on the database
* Version: 1.8.1
* Version: 1.8.2
*/


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "product-importer",
"version": "1.8.1",
"version": "1.8.2",
"description": "Parse CSV for importing products",
"license": "(ISC OR GPL-3.0)",
"repository": "https://bitbucket.org/pyxlinc/pyxl",
Expand Down
7 changes: 7 additions & 0 deletions src/scripts/products.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ function buildProductObjs(attrRow, rows) {
product.warranty.list = product[f.warrantyList] ? product[f.warrantyList]
.split('\n').map(line => line.trim()) : [];

/////////////////
// Trim whitespace from crucial columns
// type only defined for parent products
if (product[f.type]) {
product[f.type] = product[f.type].trim();
}

// Gallery
product.gallery = product[f.image] ? product[f.image]
.split(',').map(item => item.trim()) : ['1005'];
Expand Down

0 comments on commit ab9718f

Please sign in to comment.