Skip to content

Commit

Permalink
Build v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jcollings committed Nov 14, 2023
1 parent 9cee669 commit 46a85b2
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Requires Import WP: 2.5.0

**Version: 2.2.1**
**Version: 2.3.0**

![WooCommerce Product Importer](./assets/iwp-addon-woocommerce.png)

Expand Down Expand Up @@ -52,6 +52,10 @@ The WooCommerce Product Importer Addon can currently only be installed by downlo

## Changelog

### 2.3.0

- ADD - Add Product fields to ImportWP new Permission field Interface.

### 2.2.1

- ADD - Add filter `iwp/wc_ignore_empty_variable_attributes` to exclude empty terms when importing variable products.
Expand Down
86 changes: 86 additions & 0 deletions class/Importer/Template/ProductTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -1424,4 +1424,90 @@ public function display_record_info($message, $id, $data)

return $output;
}


public function get_permission_fields($importer_model)
{
$permission_fields = parent::get_permission_fields($importer_model);

$permission_fields['woocommerce'] = [

'product_type' => 'Product Type',
'_virtual' => 'Virtual',
'_downloadable' => 'Downloadable',
'_visibility' => 'Catalog visibility',
'_product_url' => 'Product URL',
'_button_text' => 'Product URL Button Text',
'tax_status' => 'Tax Status',
'tax_class' => 'Tax Class',

// advanced
'_purchase_note' => 'Purchase note',
'_download_limit' => 'Download Limit',
'_download_expiry' => 'Download Expiry',
];

$permission_fields['woocommerce_price'] = [

// Price
'_regular_price' => 'Regular Price',
'_sale_price' => 'Sale Price',
'_sale_price_dates_to' => 'Sale Price To',
'_sale_price_dates_from' => 'Sale Price From',
];

$permission_fields['woocommerce_inventory'] = [

// inventory
'_sku' => 'Product SKU',
'_stock_status' => 'Stock status',
'_manage_stock' => 'Manage Stock',
'_stock' => 'Stock quantity',
'_backorders' => 'Allow back-orders',
'_low_stock_amount' => 'Low stock threshold',
'_sold_individually' => 'Sold individually',
];

$permission_fields['woocommerce_shipping'] = [

// shipping
'_weight' => 'Weight',
'_length' => 'Length',
'_width' => 'Width',
'_height' => 'Height',
'shipping_class' => 'Shipping Class',
];

$field_map = $importer_model->getMap();
if (isset($field_map['attributes._index']) && $field_map['attributes._index'] > 0) {
$permission_fields['product_attributes'] = [];
for ($i = 0; $i < $field_map['attributes._index']; $i++) {
$permission_fields['product_attributes']['product_attributes.' . $i] = 'Attributes Row ' . ($i + 1);
}
}

$field_map = $importer_model->getMap();
if (isset($field_map['downloads._index']) && $field_map['downloads._index'] > 0) {
$permission_fields['product_downloads'] = [];
for ($i = 0; $i < $field_map['downloads._index']; $i++) {
$permission_fields['product_downloads']['product_downloads.' . $i] = 'Product Downloads Row ' . ($i + 1);
}
}

$field_map = $importer_model->getMap();
if (isset($field_map['product_gallery._index']) && $field_map['product_gallery._index'] > 0) {
$permission_fields['product_gallery'] = [];
for ($i = 0; $i < $field_map['product_gallery._index']; $i++) {
$permission_fields['product_gallery']['product_gallery.' . $i] = 'Product Gallery Row ' . ($i + 1);
}
}

$permission_fields['woocommerce_related_products'] = [
'product_upsell' => 'Product Upsells',
'product_crosssell' => 'Product Cross-sells',
'product_grouped' => 'Product Grouped',
];

return $permission_fields;
}
}
2 changes: 1 addition & 1 deletion woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Plugin URI: https://www.importwp.com
* Description: Allow Import WP to import WooCommerce Products.
* Author: James Collings <[email protected]>
* Version: 2.2.1
* Version: 2.3.0
* Author URI: https://www.importwp.com
* Network: True
*/
Expand Down

0 comments on commit 46a85b2

Please sign in to comment.