Version Description
- bug fix: grant incorrect downloadable product permissions
- bug fix: update attributes with non utf-8 characters
Download this release
Release Info
Developer | soflyy |
Plugin | Import Products from any XML or CSV to WooCommerce |
Version | 1.4.2 |
Comparing to | |
See all releases |
Code changes from version 1.4.1 to 1.4.2
- actions/admin_head.php +8 -0
- actions/admin_notices.php +19 -10
- actions/pmxi_after_post_import.php +8 -0
- actions/pmxi_after_xml_import.php +98 -33
- actions/pmxi_before_xml_import.php +6 -2
- actions/pmxi_confirm_data_to_import.php +13 -0
- actions/pmxi_do_not_update_existing.php +34 -0
- actions/pmxi_extend_options_main.php +10 -5
- actions/pmxi_missing_post.php +40 -0
- actions/pmxi_options_tab.php +15 -8
- actions/pmxi_reimport.php +91 -73
- actions/pmxi_reimport_options_after_taxonomies.php +14 -14
- classes/config.php +5 -5
- classes/helper.php +15 -10
- classes/updater.php +462 -0
- config/options.php +1 -1
- controllers/admin/import.php +54 -1
- controllers/controller/admin.php +25 -25
- filters/pmxi_article_data.php +20 -2
- filters/pmxi_custom_field.php +10 -4
- filters/pmxi_custom_field_to_delete.php +33 -15
- filters/pmxi_custom_field_to_update.php +33 -13
- filters/pmxi_custom_types.php +48 -35
- filters/pmxi_options_validation.php +57 -0
- filters/pmxi_unique_key.php +8 -4
- filters/pmxi_visible_confirm_sections.php +18 -0
- filters/pmxi_visible_options_sections.php +18 -0
- filters/pmxi_visible_template_sections.php +18 -0
- filters/wp_all_import_existing_meta_keys.php +16 -7
- filters/wp_all_import_is_post_to_delete.php +38 -0
- helpers/pmwi_adjust_price.php +15 -55
- helpers/pmwi_prepare_price.php +16 -60
- i18n/languages/wpai_woocommerce_addon_plugin-ja.mo +0 -0
- i18n/languages/wpai_woocommerce_addon_plugin-ja.po +0 -0
- libraries/XmlImportWooCommerce.php +82 -0
- libraries/XmlImportWooCommerceInterface.php +24 -0
- libraries/XmlImportWooCommerceProduct.php +81 -0
- libraries/XmlImportWooCommerceService.php +519 -0
- libraries/XmlImportWooCommerceShopOrder.php +81 -0
- libraries/actions/Actions.php +54 -0
- libraries/actions/OrderActions.php +135 -0
- libraries/actions/ProductsActions.php +58 -0
- libraries/helpers/ImporterOptions.php +48 -0
- libraries/helpers/ParserOptions.php +60 -0
- libraries/importer/ImportBase.php +171 -0
- libraries/importer/ImportBaseInterface.php +67 -0
- libraries/importer/Importer.php +16 -0
- libraries/importer/ImporterIndex.php +60 -0
- libraries/importer/ImporterIndexInterface.php +26 -0
- libraries/importer/ImporterInterface.php +27 -0
- libraries/importer/ProductsImporter.php +197 -0
- libraries/importer/products/ImportProduct.php +735 -0
- libraries/importer/products/ImportProductBase.php +259 -0
- libraries/importer/products/ImportSimpleProduct.php +27 -0
- libraries/parser/Parser.php +222 -0
- libraries/parser/ParserFactory.php +38 -0
- libraries/parser/ParserInterface.php +38 -0
- libraries/parser/ProductsParser.php +118 -0
- libraries/parser/ProductsParserBase.php +442 -0
- libraries/services/XmlImportWooPriceService.php +114 -0
- libraries/services/XmlImportWooServiceBase.php +53 -0
- libraries/services/XmlImportWooTaxonomyService.php +141 -0
- models/import/record.php +145 -1708
- plugin.php +127 -11
- readme.txt +22 -22
- static/css/admin.css +181 -29
- static/img/add.png +0 -0
- static/img/drag.png +0 -0
- static/js/admin.js +210 -66
- views/admin/import/confirm.php +89 -0
- views/admin/import/options.php +1 -0
- views/admin/import/options/_reimport_options.php +192 -0
- views/admin/import/options/_reimport_template.php +147 -0
- views/admin/import/product/_tabs/_advanced.php +116 -0
- views/admin/import/product/_tabs/_attributes.php +432 -0
- views/admin/import/product/_tabs/_general.php +287 -0
- views/admin/import/product/_tabs/_inventory.php +127 -0
- views/admin/import/product/_tabs/_linked_product.php +105 -0
- views/admin/import/product/_tabs/_options.php +35 -0
- views/admin/import/product/_tabs/_shipping.php +60 -0
- views/admin/import/product/_tabs/_variations.php +879 -0
- views/admin/import/product/index.php +123 -0
- views/admin/import/shop_order/_tabs/_order_billing.php +255 -0
- views/admin/import/shop_order/_tabs/_order_item_coupons.php +127 -0
- views/admin/import/shop_order/_tabs/_order_item_fees.php +100 -0
- views/admin/import/shop_order/_tabs/_order_item_products.php +598 -0
- views/admin/import/shop_order/_tabs/_order_item_refunds.php +106 -0
- views/admin/import/shop_order/_tabs/_order_item_shipping.php +158 -0
- views/admin/import/shop_order/_tabs/_order_item_taxes.php +173 -0
- views/admin/import/shop_order/_tabs/_order_payment.php +46 -0
- views/admin/import/shop_order/_tabs/_order_shipping.php +114 -0
- views/admin/import/shop_order/_tabs/_order_total.php +19 -0
- views/admin/import/shop_order/index.php +15 -0
- views/admin/import/shop_order/order_bs_section.php +55 -0
- views/admin/import/shop_order/order_details_section.php +50 -0
- views/admin/import/shop_order/order_items_section.php +87 -0
- views/admin/import/shop_order/order_notes_section.php +210 -0
actions/admin_head.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function pmwi_admin_head(){
|
3 |
+
?>
|
4 |
+
<script type="text/javascript">
|
5 |
+
var woo_addon_free_edition = '<?php echo PMWI_EDITION; ?>';
|
6 |
+
</script>
|
7 |
+
<?php
|
8 |
+
}
|
actions/admin_notices.php
CHANGED
@@ -7,13 +7,13 @@ function pmwi_admin_notices() {
|
|
7 |
?>
|
8 |
<div class="error"><p>
|
9 |
<?php printf(
|
10 |
-
__('<b>%s Plugin</b>: WooCommerce must be installed.',
|
11 |
PMWI_Plugin::getInstance()->getName()
|
12 |
) ?>
|
13 |
</p></div>
|
14 |
<?php
|
15 |
|
16 |
-
deactivate_plugins( PMWI_ROOT_DIR . '/
|
17 |
|
18 |
}
|
19 |
|
@@ -21,42 +21,51 @@ function pmwi_admin_notices() {
|
|
21 |
?>
|
22 |
<div class="error"><p>
|
23 |
<?php printf(
|
24 |
-
__('<b>%s Plugin</b>: WP All Import must be installed. Free edition of WP All Import at <a href="http://wordpress.org/plugins/wp-all-import/" target="_blank">http://wordpress.org/plugins/wp-all-import/</a> and the paid edition at <a href="http://www.wpallimport.com
|
25 |
PMWI_Plugin::getInstance()->getName()
|
26 |
) ?>
|
27 |
</p></div>
|
28 |
<?php
|
29 |
|
30 |
-
deactivate_plugins( PMWI_ROOT_DIR . '/
|
31 |
|
32 |
}
|
33 |
-
|
34 |
-
if ( class_exists( 'PMXI_Plugin' ) and ( (version_compare(PMXI_VERSION, '4.0.0-beta1') < 0 ) and PMXI_EDITION == 'paid' or version_compare(PMXI_VERSION, '3.2.8') < 0 and PMXI_EDITION == 'free') ) {
|
35 |
?>
|
36 |
<div class="error"><p>
|
37 |
<?php printf(
|
38 |
-
__('<b>%s Plugin</b>: Please update your WP All Import to the latest version',
|
39 |
PMWI_Plugin::getInstance()->getName()
|
40 |
) ?>
|
41 |
</p></div>
|
42 |
<?php
|
43 |
|
44 |
-
deactivate_plugins( PMWI_ROOT_DIR . '/
|
45 |
}
|
46 |
|
47 |
if ( class_exists( 'Woocommerce' ) and defined('WOOCOMMERCE_VERSION') and version_compare(WOOCOMMERCE_VERSION, '2.1') <= 0 ) {
|
48 |
?>
|
49 |
<div class="error"><p>
|
50 |
<?php printf(
|
51 |
-
__('<b>%s Plugin</b>: Please update your WooCommerce to the latest version',
|
52 |
PMWI_Plugin::getInstance()->getName()
|
53 |
) ?>
|
54 |
</p></div>
|
55 |
<?php
|
56 |
|
57 |
-
deactivate_plugins( PMWI_ROOT_DIR . '/
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
$input = new PMWI_Input();
|
61 |
$messages = $input->get('PMWI_nt', array());
|
62 |
if ($messages) {
|
7 |
?>
|
8 |
<div class="error"><p>
|
9 |
<?php printf(
|
10 |
+
__('<b>%s Plugin</b>: WooCommerce must be installed.', PMWI_Plugin::TEXT_DOMAIN),
|
11 |
PMWI_Plugin::getInstance()->getName()
|
12 |
) ?>
|
13 |
</p></div>
|
14 |
<?php
|
15 |
|
16 |
+
deactivate_plugins( PMWI_ROOT_DIR . '/wpai-woocommerce-add-on.php');
|
17 |
|
18 |
}
|
19 |
|
21 |
?>
|
22 |
<div class="error"><p>
|
23 |
<?php printf(
|
24 |
+
__('<b>%s Plugin</b>: WP All Import must be installed. Free edition of WP All Import at <a href="http://wordpress.org/plugins/wp-all-import/" target="_blank">http://wordpress.org/plugins/wp-all-import/</a> and the paid edition at <a href="http://www.wpallimport.com/?utm_source=import-wooco-products-addon-free&utm_medium=install-notice&utm_campaign=upgrade-to-pro">http://www.wpallimport.com/</a>', PMWI_Plugin::TEXT_DOMAIN),
|
25 |
PMWI_Plugin::getInstance()->getName()
|
26 |
) ?>
|
27 |
</p></div>
|
28 |
<?php
|
29 |
|
30 |
+
deactivate_plugins( PMWI_ROOT_DIR . '/wpai-woocommerce-add-on.php');
|
31 |
|
32 |
}
|
33 |
+
if ( class_exists( 'PMXI_Plugin' ) and ( version_compare(PMXI_VERSION, '4.1.4 RC5') < 0 and PMXI_EDITION == 'paid' or version_compare(PMXI_VERSION, '3.2.7') <= 0 and PMXI_EDITION == 'free') ) {
|
|
|
34 |
?>
|
35 |
<div class="error"><p>
|
36 |
<?php printf(
|
37 |
+
__('<b>%s Plugin</b>: Please update your WP All Import to the latest version', PMWI_Plugin::TEXT_DOMAIN),
|
38 |
PMWI_Plugin::getInstance()->getName()
|
39 |
) ?>
|
40 |
</p></div>
|
41 |
<?php
|
42 |
|
43 |
+
deactivate_plugins( PMWI_ROOT_DIR . '/wpai-woocommerce-add-on.php');
|
44 |
}
|
45 |
|
46 |
if ( class_exists( 'Woocommerce' ) and defined('WOOCOMMERCE_VERSION') and version_compare(WOOCOMMERCE_VERSION, '2.1') <= 0 ) {
|
47 |
?>
|
48 |
<div class="error"><p>
|
49 |
<?php printf(
|
50 |
+
__('<b>%s Plugin</b>: Please update your WooCommerce to the latest version', PMWI_Plugin::TEXT_DOMAIN),
|
51 |
PMWI_Plugin::getInstance()->getName()
|
52 |
) ?>
|
53 |
</p></div>
|
54 |
<?php
|
55 |
|
56 |
+
deactivate_plugins( PMWI_ROOT_DIR . '/wpai-woocommerce-add-on.php');
|
57 |
}
|
58 |
|
59 |
+
$deactivation_notice = get_option('pmwi_free_deactivation_notice', false);
|
60 |
+
if ($deactivation_notice) {
|
61 |
+
?>
|
62 |
+
<div class="error"><p>
|
63 |
+
<?php printf(__('Pro version activated. Please de-activate and remove the free version of the WooCommerce add-on.', 'wpai_woocommerce_addon_plugin')); ?>
|
64 |
+
</p></div>
|
65 |
+
<?php
|
66 |
+
delete_option('pmwi_free_deactivation_notice');
|
67 |
+
}
|
68 |
+
|
69 |
$input = new PMWI_Input();
|
70 |
$messages = $input->get('PMWI_nt', array());
|
71 |
if ($messages) {
|
actions/pmxi_after_post_import.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @param $import_id
|
5 |
+
*/
|
6 |
+
function pmwi_pmxi_after_post_import($import_id) {
|
7 |
+
remove_all_actions('shutdown');
|
8 |
+
}
|
actions/pmxi_after_xml_import.php
CHANGED
@@ -1,42 +1,107 @@
|
|
1 |
<?php
|
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 |
-
|
27 |
-
|
28 |
-
|
29 |
-
'
|
30 |
-
'
|
31 |
-
)
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
}
|
36 |
}
|
37 |
-
delete_option('wp_all_import_products_maybe_to_delete_' . $import_id);
|
38 |
}
|
39 |
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* @param $importID
|
5 |
+
*
|
6 |
+
* @throws \Exception
|
7 |
+
*/
|
8 |
+
function pmwi_pmxi_after_xml_import($importID) {
|
9 |
+
$import = new PMXI_Import_Record();
|
10 |
+
$import->getById($importID);
|
11 |
|
12 |
+
if (!$import->isEmpty() and in_array($import->options['custom_type'], array(
|
13 |
+
'product',
|
14 |
+
'product_variation'
|
15 |
+
))
|
16 |
+
) {
|
17 |
+
// Sync parent products with variations.
|
18 |
+
$productStack = get_option('wp_all_import_product_stack_' . $importID, array());
|
19 |
+
foreach ($productStack as $parentProductID) {
|
20 |
+
$parentProductType = get_post_type($parentProductID);
|
21 |
+
if ( $parentProductType != 'product_variation') {
|
22 |
+
XmlImportWooCommerceService::getInstance()
|
23 |
+
->syncVariableProductData($parentProductID);
|
24 |
+
}
|
25 |
}
|
26 |
+
delete_option('wp_all_import_product_stack_' . $importID);
|
27 |
+
// Re-count WooCommerce Terms.
|
28 |
+
$recount_terms_after_import = TRUE;
|
29 |
+
$recount_terms_after_import = apply_filters('wp_all_import_recount_terms_after_import', $recount_terms_after_import, $importID);
|
30 |
+
if ($recount_terms_after_import) {
|
31 |
+
// Re-count categories & tags terms after import process is complete.
|
32 |
+
if (($import->options['create_new_records'] && $import->options['is_keep_former_posts'] == 'yes')
|
33 |
+
|| ($import->options['is_keep_former_posts'] == 'no' && ($import->options['update_all_data'] == 'yes' || $import->options['is_update_categories']))) {
|
34 |
+
$product_cats = get_terms('product_cat', array(
|
35 |
+
'hide_empty' => FALSE,
|
36 |
+
'fields' => 'id=>parent'
|
37 |
+
));
|
38 |
+
_wc_term_recount($product_cats, get_taxonomy('product_cat'), TRUE, FALSE);
|
39 |
+
$product_tags = get_terms('product_tag', array(
|
40 |
+
'hide_empty' => FALSE,
|
41 |
+
'fields' => 'id=>parent'
|
42 |
+
));
|
43 |
+
_wc_term_recount($product_tags, get_taxonomy('product_tag'), TRUE, FALSE);
|
44 |
+
}
|
45 |
+
// Re-count attribute terms after import process is complete.
|
46 |
+
if (($import->options['create_new_records'] && $import->options['is_keep_former_posts'] == 'yes')
|
47 |
+
|| ($import->options['is_keep_former_posts'] == 'no' && ($import->options['update_all_data'] == 'yes' || $import->options['is_update_attributes']))) {
|
48 |
+
$attributes = wc_get_attribute_taxonomies();
|
49 |
+
foreach ((array) $attributes as $attribute) {
|
50 |
+
$term_ids = get_terms(
|
51 |
+
[
|
52 |
+
'taxonomy' => wc_attribute_taxonomy_name($attribute->attribute_name),
|
53 |
+
'hide_empty' => FALSE,
|
54 |
+
'fields' => 'ids',
|
55 |
+
]
|
56 |
+
);
|
57 |
+
if (!empty($term_ids)) {
|
58 |
+
wp_update_term_count_now($term_ids, wc_attribute_taxonomy_name($attribute->attribute_name));
|
59 |
+
}
|
60 |
+
}
|
61 |
+
}
|
62 |
+
// Re-count shipping terms after import process is complete.
|
63 |
+
if (($import->options['create_new_records'] && $import->options['is_keep_former_posts'] == 'yes')
|
64 |
+
|| ($import->options['is_keep_former_posts'] == 'no' && ($import->options['update_all_data'] == 'yes' || $import->options['is_update_custom_fields']))) {
|
65 |
+
$shipping_terms = get_terms(
|
66 |
+
[
|
67 |
+
'taxonomy' => 'product_shipping_class',
|
68 |
+
'hide_empty' => FALSE,
|
69 |
+
'fields' => 'ids',
|
70 |
+
]
|
71 |
+
);
|
72 |
+
if (!empty($shipping_terms)) {
|
73 |
+
wp_update_term_count_now($shipping_terms, 'product_shipping_class');
|
74 |
}
|
75 |
}
|
|
|
76 |
}
|
77 |
|
78 |
+
// Delete Missing Products.
|
79 |
+
$maybe_to_delete = get_option('wp_all_import_products_maybe_to_delete_' . $importID);
|
80 |
+
if (!empty($maybe_to_delete)) {
|
81 |
+
foreach ($maybe_to_delete as $pid) {
|
82 |
+
$children = get_posts(array(
|
83 |
+
'post_parent' => $pid,
|
84 |
+
'posts_per_page' => -1,
|
85 |
+
'post_type' => 'product_variation',
|
86 |
+
'fields' => 'ids',
|
87 |
+
'orderby' => 'ID',
|
88 |
+
'order' => 'ASC',
|
89 |
+
'post_status' => array(
|
90 |
+
'draft',
|
91 |
+
'publish',
|
92 |
+
'trash',
|
93 |
+
'pending',
|
94 |
+
'future',
|
95 |
+
'private'
|
96 |
+
)
|
97 |
+
));
|
98 |
+
|
99 |
+
if (empty($children)) {
|
100 |
+
wp_delete_post($pid, TRUE);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
delete_option('wp_all_import_products_maybe_to_delete_' . $importID);
|
104 |
+
}
|
105 |
+
delete_option('wp_all_import_not_linked_products_' . $importID);
|
106 |
+
}
|
107 |
}
|
actions/pmxi_before_xml_import.php
CHANGED
@@ -1,8 +1,12 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
4 |
delete_option('wp_all_import_' . $import_id . '_parent_product');
|
5 |
delete_option('wp_all_import_not_linked_products_' . $import_id);
|
6 |
delete_option('wp_all_import_previously_updated_order_' . $import_id);
|
7 |
delete_option('wp_all_import_products_maybe_to_delete_' . $import_id);
|
|
|
8 |
}
|
1 |
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @param $import_id
|
5 |
+
*/
|
6 |
+
function pmwi_pmxi_before_xml_import($import_id ) {
|
7 |
delete_option('wp_all_import_' . $import_id . '_parent_product');
|
8 |
delete_option('wp_all_import_not_linked_products_' . $import_id);
|
9 |
delete_option('wp_all_import_previously_updated_order_' . $import_id);
|
10 |
delete_option('wp_all_import_products_maybe_to_delete_' . $import_id);
|
11 |
+
delete_option('wp_all_import_product_stack_' . $import_id);
|
12 |
}
|
actions/pmxi_confirm_data_to_import.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @param $isWizard
|
5 |
+
* @param $post
|
6 |
+
*/
|
7 |
+
function pmwi_pmxi_confirm_data_to_import($isWizard, $post ) {
|
8 |
+
// render order's view only for bundle and import with WP All Import featured
|
9 |
+
if ( $post['custom_type'] == 'shop_order' && class_exists('WooCommerce') ) {
|
10 |
+
$pmwi_controller = new PMWI_Admin_Import();
|
11 |
+
$pmwi_controller->confirm( $isWizard, $post );
|
12 |
+
}
|
13 |
+
}
|
actions/pmxi_do_not_update_existing.php
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @param $post_to_update_id
|
5 |
+
* @param $import_id
|
6 |
+
* @param $iteration
|
7 |
+
*
|
8 |
+
* @throws \Exception
|
9 |
+
*/
|
10 |
+
function pmwi_pmxi_do_not_update_existing($post_to_update_id, $import_id, $iteration) {
|
11 |
+
|
12 |
+
$args = array(
|
13 |
+
'post_type' => 'product_variation',
|
14 |
+
'meta_query' => array(
|
15 |
+
array(
|
16 |
+
'key' => '_sku',
|
17 |
+
'value' => get_post_meta($post_to_update_id, '_sku', true),
|
18 |
+
)
|
19 |
+
)
|
20 |
+
);
|
21 |
+
$query = new WP_Query( $args );
|
22 |
+
if ( $query->have_posts() ){
|
23 |
+
$duplicate_id = $query->post->ID;
|
24 |
+
if ($duplicate_id) {
|
25 |
+
$postRecord = new PMXI_Post_Record();
|
26 |
+
$postRecord->clear();
|
27 |
+
$postRecord->getBy(array(
|
28 |
+
'post_id' => $duplicate_id,
|
29 |
+
'import_id' => $import_id
|
30 |
+
));
|
31 |
+
if ( ! $postRecord->isEmpty() ) $postRecord->set(array('iteration' => $iteration))->update();
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
actions/pmxi_extend_options_main.php
CHANGED
@@ -1,10 +1,15 @@
|
|
1 |
<?php
|
2 |
-
function pmwi_pmxi_extend_options_main($entry, $post = array()){
|
3 |
-
|
4 |
-
if ($entry != 'product' and empty($post['is_override_post_type'])) return;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
$woo_controller = new PMWI_Admin_Import();
|
7 |
$woo_controller->index($post);
|
8 |
-
|
9 |
}
|
10 |
-
?>
|
1 |
<?php
|
|
|
|
|
|
|
2 |
|
3 |
+
/**
|
4 |
+
* @param $entry
|
5 |
+
* @param array $post
|
6 |
+
*
|
7 |
+
* @return bool
|
8 |
+
*/
|
9 |
+
function pmwi_pmxi_extend_options_main($entry, $post = array()) {
|
10 |
+
if ( ! in_array($entry, array('product', 'shop_order')) and empty($post['is_override_post_type'])) {
|
11 |
+
return FALSE;
|
12 |
+
}
|
13 |
$woo_controller = new PMWI_Admin_Import();
|
14 |
$woo_controller->index($post);
|
|
|
15 |
}
|
|
actions/pmxi_missing_post.php
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @param $pid
|
4 |
+
*/
|
5 |
+
function pmwi_pmxi_missing_post($pid) {
|
6 |
+
// Variations should be set to 'private' instead of 'draft'
|
7 |
+
// when using 'Instead of deletion, change post status to Draft'.
|
8 |
+
if ('product_variation' == get_post_type($pid)) {
|
9 |
+
$variation = new WC_Product_Variation($pid);
|
10 |
+
$variation->set_status('private');
|
11 |
+
$attributes = $variation->get_attributes();
|
12 |
+
if (!empty($attributes)) {
|
13 |
+
$parentAttributes = get_post_meta($variation->get_parent_id(), '_product_attributes', true);
|
14 |
+
foreach ($attributes as $attributeName => $attribute_value) {
|
15 |
+
if (isset($parentAttributes[$attributeName])) {
|
16 |
+
$values = explode("|", $parentAttributes[$attributeName]['value']);
|
17 |
+
if ($parentAttributes[$attributeName]['is_taxonomy']) {
|
18 |
+
$attribute = get_term_by("slug", $attribute_value, $attributeName);
|
19 |
+
if ($attribute && !is_wp_error($attribute)) {
|
20 |
+
$values[] = $attribute->term_taxonomy_id;
|
21 |
+
}
|
22 |
+
}
|
23 |
+
else {
|
24 |
+
$values[] = $attribute_value;
|
25 |
+
}
|
26 |
+
$values = array_unique($values);
|
27 |
+
$parentAttributes[$attributeName]['value'] = implode("|", $values);
|
28 |
+
}
|
29 |
+
}
|
30 |
+
update_post_meta($variation->get_parent_id(), '_product_attributes', $parentAttributes);
|
31 |
+
}
|
32 |
+
$variation->save();
|
33 |
+
// Add parent product to sync circle after import completed.
|
34 |
+
$productStack = get_option('wp_all_import_product_stack_' . XmlImportWooCommerceService::getInstance()->getImport()->id, array());
|
35 |
+
if (!in_array($variation->get_parent_id(), $productStack)) {
|
36 |
+
$productStack[] = $variation->get_parent_id();
|
37 |
+
update_option('wp_all_import_product_stack_' . XmlImportWooCommerceService::getInstance()->getImport()->id, $productStack);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
}
|
actions/pmxi_options_tab.php
CHANGED
@@ -1,10 +1,17 @@
|
|
1 |
-
<?php
|
2 |
-
function pmwi_pmxi_options_tab( $isWizard, $post )
|
3 |
-
{
|
4 |
-
if ( $post['custom_type'] == 'product' && class_exists('WooCommerce') ):
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
}
|
1 |
+
<?php
|
|
|
|
|
|
|
2 |
|
3 |
+
/**
|
4 |
+
* @param $isWizard
|
5 |
+
* @param $post
|
6 |
+
*/
|
7 |
+
function pmwi_pmxi_options_tab($isWizard, $post) {
|
8 |
+
// Render order's view only for bundle and import with WP All Import featured.
|
9 |
+
if ( $post['custom_type'] == 'shop_order' && class_exists('WooCommerce') ) {
|
10 |
+
$pmwi_controller = new PMWI_Admin_Import();
|
11 |
+
$pmwi_controller->options( $isWizard, $post );
|
12 |
+
}
|
13 |
+
if ( $post['custom_type'] == 'product' && class_exists('WooCommerce') ) {
|
14 |
+
wp_enqueue_script('pmwi-admin-options-script', PMWI_ROOT_URL . '/static/js/admin-options.js', array('jquery'), PMWI_VERSION);
|
15 |
+
wp_enqueue_style('pmwi-admin-options-style', PMWI_ROOT_URL . '/static/css/admin-options.css', array(), PMWI_VERSION);
|
16 |
+
}
|
17 |
}
|
actions/pmxi_reimport.php
CHANGED
@@ -1,84 +1,102 @@
|
|
1 |
<?php
|
2 |
-
function pmwi_pmxi_reimport($post_type, $post){
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
$
|
7 |
-
|
8 |
-
|
9 |
-
if (!empty($post_taxonomies)):
|
10 |
-
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or strpos($ctx->name, "pa_") === false) continue;
|
11 |
-
$all_existing_attributes[] = $ctx->name;
|
12 |
-
endforeach;
|
13 |
-
endif;
|
14 |
-
if (!empty($existing_attributes)):
|
15 |
-
foreach ($existing_attributes as $key => $attr) {
|
16 |
-
$all_existing_attributes[] = $attr;
|
17 |
-
}
|
18 |
-
endif;
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
<div class="input">
|
29 |
-
<input type="hidden" name="attributes_list" value="0" />
|
30 |
-
<input type="hidden" name="is_update_advanced_options" value="0" />
|
31 |
-
<input type="checkbox" id="is_update_advanced_options_<?php echo $post_type; ?>" name="is_update_advanced_options" value="1" <?php echo $post['is_update_advanced_options'] ? 'checked="checked"': '' ?> class="switcher"/>
|
32 |
-
<label for="is_update_advanced_options_<?php echo $post_type; ?>"><?php _e('Advanced WooCommerce Options', 'wpai_woocommerce_addon_plugin') ?></label>
|
33 |
-
<div class="switcher-target-is_update_advanced_options_<?php echo $post_type; ?>" style="padding-left:17px;">
|
34 |
<div class="input">
|
35 |
-
<input type="hidden" name="
|
36 |
-
<input type="checkbox" id="
|
37 |
-
<label for="
|
38 |
-
</div>
|
39 |
-
<div class="input">
|
40 |
-
<input type="hidden" name="is_update_featured_status" value="0" />
|
41 |
-
<input type="checkbox" id="is_update_featured_status_<?php echo $post_type; ?>" name="is_update_featured_status" value="1" <?php echo $post['is_update_featured_status'] ? 'checked="checked"': '' ?> class="switcher"/>
|
42 |
-
<label for="is_update_featured_status_<?php echo $post_type; ?>"><?php _e('Update Featured Status', 'wpai_woocommerce_addon_plugin') ?></label>
|
43 |
-
</div>
|
44 |
-
</div>
|
45 |
-
<div class="wp_all_import_woocommerce_deprecated_fields_notice_template">
|
46 |
-
<?php _e('As of WooCommerce 3.0 this data is no longer stored as a custom field - use the advanced options above.', 'wpai_woocommerce_addon_plugin'); ?>
|
47 |
-
</div>
|
48 |
-
<div class="wp_all_import_woocommerce_stock_status_notice_template">
|
49 |
-
<?php _e('As of WooCommerce 3.0 stock status is automatically updated when stock is updated.', 'wpai_woocommerce_addon_plugin'); ?>
|
50 |
-
</div>
|
51 |
-
</div>
|
52 |
-
<?php endif; ?>
|
53 |
-
<div class="input">
|
54 |
-
<input type="hidden" name="attributes_list" value="0" />
|
55 |
-
<input type="hidden" name="is_update_attributes" value="0" />
|
56 |
-
<input type="checkbox" id="is_update_attributes_<?php echo $post_type; ?>" name="is_update_attributes" value="1" <?php echo $post['is_update_attributes'] ? 'checked="checked"': '' ?> class="switcher"/>
|
57 |
-
<label for="is_update_attributes_<?php echo $post_type; ?>"><?php _e('Attributes', 'wpai_woocommerce_addon_plugin') ?></label>
|
58 |
-
<div class="switcher-target-is_update_attributes_<?php echo $post_type; ?>" style="padding-left:17px;">
|
59 |
-
<div class="input">
|
60 |
-
<input type="radio" id="update_attributes_logic_full_update_<?php echo $post_type; ?>" name="update_attributes_logic" value="full_update" <?php echo ( "full_update" == $post['update_attributes_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
61 |
-
<label for="update_attributes_logic_full_update_<?php echo $post_type; ?>"><?php _e('Update all Attributes', 'wpai_woocommerce_addon_plugin') ?></label>
|
62 |
</div>
|
|
|
|
|
63 |
<div class="input">
|
64 |
-
<input type="
|
65 |
-
<
|
66 |
-
<
|
67 |
-
|
68 |
-
|
69 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
</div>
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
<
|
75 |
-
|
76 |
-
|
77 |
-
<span class="hidden choosen_values"><?php if (!empty($all_existing_attributes)) echo implode(',', $all_existing_attributes);?></span>
|
78 |
-
<input class="choosen_input" value="<?php if (!empty($post['attributes_list']) and "all_except" == $post['update_attributes_logic']) echo implode(',', $post['attributes_list']); ?>" type="hidden" name="attributes_except_list"/>
|
79 |
</div>
|
80 |
</div>
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
|
|
2 |
|
3 |
+
/**
|
4 |
+
* @param $post_type
|
5 |
+
* @param $post
|
6 |
+
*/
|
7 |
+
function pmwi_pmxi_reimport($post_type, $post) {
|
8 |
|
9 |
+
if ( ! in_array($post_type, array('product')) and empty($post['is_override_post_type']) or ! class_exists('WooCommerce')) {
|
10 |
+
return FALSE;
|
11 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
switch ($post_type) {
|
14 |
+
case 'product':
|
15 |
+
$all_existing_attributes = array();
|
16 |
+
$hide_taxonomies = array('product_type');
|
17 |
+
$post_taxonomies = array_diff_key(get_taxonomies_by_object_type(array($post_type), 'object'), array_flip($hide_taxonomies));
|
18 |
+
if (!empty($post_taxonomies)):
|
19 |
+
foreach ($post_taxonomies as $ctx): if ("" == $ctx->labels->name or strpos($ctx->name, "pa_") === false) continue;
|
20 |
+
$all_existing_attributes[] = $ctx->name;
|
21 |
+
endforeach;
|
22 |
+
endif;
|
23 |
+
if (!empty($existing_attributes)):
|
24 |
+
foreach ($existing_attributes as $key => $attr) {
|
25 |
+
$all_existing_attributes[] = $attr;
|
26 |
+
}
|
27 |
+
endif;
|
28 |
|
29 |
+
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
<div class="input">
|
31 |
+
<input type="hidden" name="is_update_product_type" value="0" />
|
32 |
+
<input type="checkbox" id="is_update_product_type_<?php echo $post_type; ?>" name="is_update_product_type" value="1" <?php echo $post['is_update_product_type'] ? 'checked="checked"': '' ?> class="switcher"/>
|
33 |
+
<label for="is_update_product_type_<?php echo $post_type; ?>"><?php _e('Product Type', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
</div>
|
35 |
+
|
36 |
+
<?php if ( PMXI_EDITION == 'paid' && version_compare(PMXI_VERSION, '4.4.9-beta-1.7') < 0 || PMXI_EDITION == 'free' && version_compare(PMXI_VERSION, '3.4.5') < 0 ): ?>
|
37 |
<div class="input">
|
38 |
+
<input type="hidden" name="attributes_list" value="0" />
|
39 |
+
<input type="hidden" name="is_update_advanced_options" value="0" />
|
40 |
+
<input type="checkbox" id="is_update_advanced_options_<?php echo $post_type; ?>" name="is_update_advanced_options" value="1" <?php echo $post['is_update_advanced_options'] ? 'checked="checked"': '' ?> class="switcher"/>
|
41 |
+
<label for="is_update_advanced_options_<?php echo $post_type; ?>"><?php _e('Advanced WooCommerce Options', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
42 |
+
<div class="switcher-target-is_update_advanced_options_<?php echo $post_type; ?>" style="padding-left:17px;">
|
43 |
+
<div class="input">
|
44 |
+
<input type="hidden" name="is_update_catalog_visibility" value="0" />
|
45 |
+
<input type="checkbox" id="is_update_catalog_visibility_<?php echo $post_type; ?>" name="is_update_catalog_visibility" value="1" <?php echo $post['is_update_catalog_visibility'] ? 'checked="checked"': '' ?> class="switcher"/>
|
46 |
+
<label for="is_update_catalog_visibility_<?php echo $post_type; ?>"><?php _e('Update Catalog Visibility', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
47 |
+
</div>
|
48 |
+
<div class="input">
|
49 |
+
<input type="hidden" name="is_update_featured_status" value="0" />
|
50 |
+
<input type="checkbox" id="is_update_featured_status_<?php echo $post_type; ?>" name="is_update_featured_status" value="1" <?php echo $post['is_update_featured_status'] ? 'checked="checked"': '' ?> class="switcher"/>
|
51 |
+
<label for="is_update_featured_status_<?php echo $post_type; ?>"><?php _e('Update Featured Status', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
52 |
+
</div>
|
53 |
</div>
|
54 |
+
<div class="wp_all_import_woocommerce_deprecated_fields_notice_template">
|
55 |
+
<?php _e('As of WooCommerce 3.0 this data is no longer stored as a custom field - use the advanced options above.', PMWI_Plugin::TEXT_DOMAIN); ?>
|
56 |
+
</div>
|
57 |
+
<div class="wp_all_import_woocommerce_stock_status_notice_template">
|
58 |
+
<?php _e('As of WooCommerce 3.0 stock status is automatically updated when stock is updated.', PMWI_Plugin::TEXT_DOMAIN); ?>
|
|
|
|
|
|
|
59 |
</div>
|
60 |
</div>
|
61 |
+
<?php endif; ?>
|
62 |
+
<div class="input">
|
63 |
+
<input type="hidden" name="attributes_list" value="0" />
|
64 |
+
<input type="hidden" name="is_update_attributes" value="0" />
|
65 |
+
<input type="checkbox" id="is_update_attributes_<?php echo $post_type; ?>" name="is_update_attributes" value="1" <?php echo $post['is_update_attributes'] ? 'checked="checked"': '' ?> class="switcher"/>
|
66 |
+
<label for="is_update_attributes_<?php echo $post_type; ?>"><?php _e('Attributes', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
67 |
+
<div class="switcher-target-is_update_attributes_<?php echo $post_type; ?>" style="padding-left:17px;">
|
68 |
+
<div class="input">
|
69 |
+
<input type="radio" id="update_attributes_logic_full_update_<?php echo $post_type; ?>" name="update_attributes_logic" value="full_update" <?php echo ( "full_update" == $post['update_attributes_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
70 |
+
<label for="update_attributes_logic_full_update_<?php echo $post_type; ?>"><?php _e('Update all Attributes', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
71 |
+
</div>
|
72 |
+
<div class="input">
|
73 |
+
<input type="radio" id="update_attributes_logic_only_<?php echo $post_type; ?>" name="update_attributes_logic" value="only" <?php echo ( "only" == $post['update_attributes_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
74 |
+
<label for="update_attributes_logic_only_<?php echo $post_type; ?>"><?php _e('Update only these Attributes, leave the rest alone', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
75 |
+
<div class="switcher-target-update_attributes_logic_only_<?php echo $post_type; ?> pmxi_choosen" style="padding-left:17px;">
|
76 |
+
|
77 |
+
<span class="hidden choosen_values"><?php if (!empty($all_existing_attributes)) echo implode(',', $all_existing_attributes);?></span>
|
78 |
+
<input class="choosen_input" value="<?php if (!empty($post['attributes_list']) and "only" == $post['update_attributes_logic']) echo implode(',', $post['attributes_list']); ?>" type="hidden" name="attributes_only_list"/>
|
79 |
+
</div>
|
80 |
+
</div>
|
81 |
+
<div class="input">
|
82 |
+
<input type="radio" id="update_attributes_logic_all_except_<?php echo $post_type; ?>" name="update_attributes_logic" value="all_except" <?php echo ( "all_except" == $post['update_attributes_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
83 |
+
<label for="update_attributes_logic_all_except_<?php echo $post_type; ?>"><?php _e('Leave these Attributes alone, update all other Attributes', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
84 |
+
<div class="switcher-target-update_attributes_logic_all_except_<?php echo $post_type; ?> pmxi_choosen" style="padding-left:17px;">
|
85 |
+
|
86 |
+
<span class="hidden choosen_values"><?php if (!empty($all_existing_attributes)) echo implode(',', $all_existing_attributes);?></span>
|
87 |
+
<input class="choosen_input" value="<?php if (!empty($post['attributes_list']) and "all_except" == $post['update_attributes_logic']) echo implode(',', $post['attributes_list']); ?>" type="hidden" name="attributes_except_list"/>
|
88 |
+
</div>
|
89 |
+
</div>
|
90 |
+
<div class="input">
|
91 |
+
<input type="radio" id="update_attributes_logic_add_new_<?php echo $post_type; ?>" name="update_attributes_logic" value="add_new" <?php echo ( "add_new" == $post['update_attributes_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
92 |
+
<label for="update_attributes_logic_add_new_<?php echo $post_type; ?>"><?php _e('Don\'t touch existing Attributes, add new Attributes', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
93 |
+
</div>
|
94 |
+
</div>
|
95 |
+
</div>
|
96 |
+
<?php
|
97 |
+
break;
|
98 |
+
default:
|
99 |
+
# code...
|
100 |
+
break;
|
101 |
+
}
|
102 |
+
}
|
actions/pmxi_reimport_options_after_taxonomies.php
CHANGED
@@ -1,46 +1,46 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
function pmwi_pmxi_reimport_options_after_taxonomies($post_type, $post){
|
4 |
|
5 |
-
if ( ! in_array($post_type, array('product')) and empty($post['is_override_post_type']) or ! class_exists('WooCommerce'))
|
|
|
|
|
6 |
|
7 |
-
switch ($post_type)
|
8 |
-
{
|
9 |
case 'product':
|
10 |
-
|
11 |
if ( version_compare(WOOCOMMERCE_VERSION, '3.0') >= 0 && ( PMXI_EDITION == 'paid' && version_compare(PMXI_VERSION, '4.4.9-beta-1.7') >= 0 || PMXI_EDITION == 'free' && version_compare(PMXI_VERSION, '3.4.5') >= 0 )):
|
12 |
-
|
13 |
?>
|
14 |
<div class="input">
|
15 |
<input type="hidden" name="attributes_list" value="0" />
|
16 |
<input type="hidden" name="is_update_advanced_options" value="0" />
|
17 |
<input type="checkbox" id="is_update_advanced_options_<?php echo $post_type; ?>" name="is_update_advanced_options" value="1" <?php echo $post['is_update_advanced_options'] ? 'checked="checked"': '' ?> class="switcher"/>
|
18 |
-
<label for="is_update_advanced_options_<?php echo $post_type; ?>"><?php _e('Advanced WooCommerce Options',
|
19 |
<div class="switcher-target-is_update_advanced_options_<?php echo $post_type; ?>" style="padding-left:17px;">
|
20 |
<div class="input">
|
21 |
<input type="hidden" name="is_update_catalog_visibility" value="0" />
|
22 |
<input type="checkbox" id="is_update_catalog_visibility_<?php echo $post_type; ?>" name="is_update_catalog_visibility" value="1" <?php echo $post['is_update_catalog_visibility'] ? 'checked="checked"': '' ?> class="switcher"/>
|
23 |
-
<label for="is_update_catalog_visibility_<?php echo $post_type; ?>"><?php _e('Update Catalog Visibility',
|
24 |
</div>
|
25 |
<div class="input">
|
26 |
<input type="hidden" name="is_update_featured_status" value="0" />
|
27 |
<input type="checkbox" id="is_update_featured_status_<?php echo $post_type; ?>" name="is_update_featured_status" value="1" <?php echo $post['is_update_featured_status'] ? 'checked="checked"': '' ?> class="switcher"/>
|
28 |
-
<label for="is_update_featured_status_<?php echo $post_type; ?>"><?php _e('Update Featured Status',
|
29 |
</div>
|
30 |
</div>
|
31 |
<div class="wp_all_import_woocommerce_deprecated_fields_notice_template">
|
32 |
-
<?php _e('As of WooCommerce 3.0 this data is no longer stored as a custom field - use the advanced options below.',
|
33 |
</div>
|
34 |
<div class="wp_all_import_woocommerce_stock_status_notice_template">
|
35 |
-
<?php _e('As of WooCommerce 3.0 stock status is automatically updated when stock is updated.',
|
36 |
</div>
|
37 |
</div>
|
38 |
<?php
|
39 |
-
|
40 |
endif;
|
41 |
-
|
42 |
-
break;
|
43 |
-
|
44 |
default:
|
45 |
# code...
|
46 |
break;
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* @param $post_type
|
5 |
+
* @param $post
|
6 |
+
*/
|
7 |
function pmwi_pmxi_reimport_options_after_taxonomies($post_type, $post){
|
8 |
|
9 |
+
if ( ! in_array($post_type, array('product')) and empty($post['is_override_post_type']) or ! class_exists('WooCommerce')) {
|
10 |
+
return FALSE;
|
11 |
+
}
|
12 |
|
13 |
+
switch ($post_type) {
|
|
|
14 |
case 'product':
|
|
|
15 |
if ( version_compare(WOOCOMMERCE_VERSION, '3.0') >= 0 && ( PMXI_EDITION == 'paid' && version_compare(PMXI_VERSION, '4.4.9-beta-1.7') >= 0 || PMXI_EDITION == 'free' && version_compare(PMXI_VERSION, '3.4.5') >= 0 )):
|
|
|
16 |
?>
|
17 |
<div class="input">
|
18 |
<input type="hidden" name="attributes_list" value="0" />
|
19 |
<input type="hidden" name="is_update_advanced_options" value="0" />
|
20 |
<input type="checkbox" id="is_update_advanced_options_<?php echo $post_type; ?>" name="is_update_advanced_options" value="1" <?php echo $post['is_update_advanced_options'] ? 'checked="checked"': '' ?> class="switcher"/>
|
21 |
+
<label for="is_update_advanced_options_<?php echo $post_type; ?>"><?php _e('Advanced WooCommerce Options', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
22 |
<div class="switcher-target-is_update_advanced_options_<?php echo $post_type; ?>" style="padding-left:17px;">
|
23 |
<div class="input">
|
24 |
<input type="hidden" name="is_update_catalog_visibility" value="0" />
|
25 |
<input type="checkbox" id="is_update_catalog_visibility_<?php echo $post_type; ?>" name="is_update_catalog_visibility" value="1" <?php echo $post['is_update_catalog_visibility'] ? 'checked="checked"': '' ?> class="switcher"/>
|
26 |
+
<label for="is_update_catalog_visibility_<?php echo $post_type; ?>"><?php _e('Update Catalog Visibility', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
27 |
</div>
|
28 |
<div class="input">
|
29 |
<input type="hidden" name="is_update_featured_status" value="0" />
|
30 |
<input type="checkbox" id="is_update_featured_status_<?php echo $post_type; ?>" name="is_update_featured_status" value="1" <?php echo $post['is_update_featured_status'] ? 'checked="checked"': '' ?> class="switcher"/>
|
31 |
+
<label for="is_update_featured_status_<?php echo $post_type; ?>"><?php _e('Update Featured Status', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
32 |
</div>
|
33 |
</div>
|
34 |
<div class="wp_all_import_woocommerce_deprecated_fields_notice_template">
|
35 |
+
<?php _e('As of WooCommerce 3.0 this data is no longer stored as a custom field - use the advanced options below.', PMWI_Plugin::TEXT_DOMAIN); ?>
|
36 |
</div>
|
37 |
<div class="wp_all_import_woocommerce_stock_status_notice_template">
|
38 |
+
<?php _e('As of WooCommerce 3.0 stock status is automatically updated when stock is updated.', PMWI_Plugin::TEXT_DOMAIN); ?>
|
39 |
</div>
|
40 |
</div>
|
41 |
<?php
|
|
|
42 |
endif;
|
43 |
+
break;
|
|
|
|
|
44 |
default:
|
45 |
# code...
|
46 |
break;
|
classes/config.php
CHANGED
@@ -34,9 +34,9 @@ class PMWI_Config implements IteratorAggregate {
|
|
34 |
* @return PMWI_Config
|
35 |
*/
|
36 |
public function loadFromFile($filePath, $section = NULL) {
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
$filePath = realpath($filePath);
|
41 |
if ($filePath and ! in_array($filePath, $this->loaded)) {
|
42 |
require $filePath;
|
@@ -44,8 +44,8 @@ class PMWI_Config implements IteratorAggregate {
|
|
44 |
$this->loaded[] = $filePath;
|
45 |
$this->config = array_merge($this->config, $config);
|
46 |
}
|
47 |
-
|
48 |
-
|
49 |
}
|
50 |
/**
|
51 |
* Return value of setting with specified name
|
34 |
* @return PMWI_Config
|
35 |
*/
|
36 |
public function loadFromFile($filePath, $section = NULL) {
|
37 |
+
if ( ! is_null($section)) {
|
38 |
+
$this->config[$section] = self::createFromFile($filePath);
|
39 |
+
} else {
|
40 |
$filePath = realpath($filePath);
|
41 |
if ($filePath and ! in_array($filePath, $this->loaded)) {
|
42 |
require $filePath;
|
44 |
$this->loaded[] = $filePath;
|
45 |
$this->config = array_merge($this->config, $config);
|
46 |
}
|
47 |
+
}
|
48 |
+
return $this;
|
49 |
}
|
50 |
/**
|
51 |
* Return value of setting with specified name
|
classes/helper.php
CHANGED
@@ -40,17 +40,13 @@ class PMWI_Helper {
|
|
40 |
public static function safe_glob($pattern, $flags=0) {
|
41 |
$split = explode('/', str_replace('\\', '/', $pattern));
|
42 |
$mask = array_pop($split);
|
43 |
-
$path = implode('/', $split);
|
44 |
-
|
45 |
-
if (($dir = @opendir($path)) !== false or ($dir = @opendir($path
|
46 |
$glob = array();
|
47 |
while(($file = readdir($dir)) !== false) {
|
48 |
-
// Recurse subdirectories (self::GLOB_RECURSE)
|
49 |
-
if (($flags & self::GLOB_RECURSE) && is_dir($path . '/' . $file) && ( ! in_array($file, array('.', '..')))) {
|
50 |
-
$glob = array_merge($glob, self::array_prepend(self::safe_glob($path . '/' . $file . '/' . $mask, $flags), ($flags & self::GLOB_PATH ? '' : $file . '/')));
|
51 |
-
}
|
52 |
// Match file mask
|
53 |
-
if (self::fnmatch($mask, $file)) {
|
54 |
if ((( ! ($flags & self::GLOB_ONLYDIR)) || is_dir("$path/$file"))
|
55 |
&& (( ! ($flags & self::GLOB_NODIR)) || ( ! is_dir($path . '/' . $file)))
|
56 |
&& (( ! ($flags & self::GLOB_NODOTS)) || ( ! in_array($file, array('.', '..'))))
|
@@ -59,11 +55,20 @@ class PMWI_Helper {
|
|
59 |
}
|
60 |
}
|
61 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
closedir($dir);
|
63 |
-
if ( ! ($flags & self::GLOB_NOSORT)) sort($glob);
|
64 |
return $glob;
|
65 |
} else {
|
66 |
-
return false;
|
67 |
}
|
68 |
}
|
69 |
|
40 |
public static function safe_glob($pattern, $flags=0) {
|
41 |
$split = explode('/', str_replace('\\', '/', $pattern));
|
42 |
$mask = array_pop($split);
|
43 |
+
$path = implode('/', $split);
|
44 |
+
|
45 |
+
if (($dir = @opendir($path . '/')) !== false or ($dir = @opendir($path)) !== false) {
|
46 |
$glob = array();
|
47 |
while(($file = readdir($dir)) !== false) {
|
|
|
|
|
|
|
|
|
48 |
// Match file mask
|
49 |
+
if (self::fnmatch($mask, $file, self::FNM_CASEFOLD)) {
|
50 |
if ((( ! ($flags & self::GLOB_ONLYDIR)) || is_dir("$path/$file"))
|
51 |
&& (( ! ($flags & self::GLOB_NODIR)) || ( ! is_dir($path . '/' . $file)))
|
52 |
&& (( ! ($flags & self::GLOB_NODOTS)) || ( ! in_array($file, array('.', '..'))))
|
55 |
}
|
56 |
}
|
57 |
}
|
58 |
+
closedir($dir);
|
59 |
+
if (($dir = @opendir($path . '/')) !== false or ($dir = @opendir($path)) !== false) {
|
60 |
+
while(($file = readdir($dir)) !== false) {
|
61 |
+
// Recurse subdirectories (self::GLOB_RECURSE)
|
62 |
+
if (($flags & self::GLOB_RECURSE) && is_dir($path . '/' . $file) && ( ! in_array($file, array('.', '..')))) {
|
63 |
+
$glob = array_merge($glob, self::array_prepend(self::safe_glob($path . '/' . $file . '/' . $mask, $flags), ($flags & self::GLOB_PATH ? '' : $file . '/')));
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
closedir($dir);
|
68 |
+
if ( ! ($flags & self::GLOB_NOSORT)) sort($glob);
|
69 |
return $glob;
|
70 |
} else {
|
71 |
+
return (strpos($pattern, "*") === false) ? array($pattern) : false;
|
72 |
}
|
73 |
}
|
74 |
|
classes/updater.php
ADDED
@@ -0,0 +1,462 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if( ! class_exists('PMWI_Updater') ) {
|
4 |
+
|
5 |
+
class PMWI_Updater {
|
6 |
+
private $api_url = '';
|
7 |
+
private $api_data = array();
|
8 |
+
private $name = '';
|
9 |
+
private $slug = '';
|
10 |
+
private $_plugin_file = '';
|
11 |
+
private $did_check = false;
|
12 |
+
private $version;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Class constructor.
|
16 |
+
*
|
17 |
+
* @uses plugin_basename()
|
18 |
+
* @uses hook()
|
19 |
+
*
|
20 |
+
* @param string $_api_url The URL pointing to the custom API endpoint.
|
21 |
+
* @param string $_plugin_file Path to the plugin file.
|
22 |
+
* @param array $_api_data Optional data to send with API calls.
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
26 |
+
$this->api_url = trailingslashit( $_api_url );
|
27 |
+
$this->api_data = urlencode_deep( $_api_data );
|
28 |
+
$this->name = plugin_basename( $_plugin_file );
|
29 |
+
$this->slug = basename( $_plugin_file, '.php');
|
30 |
+
$this->version = $_api_data['version'];
|
31 |
+
|
32 |
+
// Set up hooks.
|
33 |
+
$this->init();
|
34 |
+
add_action( 'admin_init', array( $this, 'show_changelog' ) );
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Set up WordPress filters to hook into WP's update process.
|
39 |
+
*
|
40 |
+
* @uses add_filter()
|
41 |
+
*
|
42 |
+
* @return void
|
43 |
+
*/
|
44 |
+
public function init() {
|
45 |
+
|
46 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 21 );
|
47 |
+
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
48 |
+
|
49 |
+
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
|
50 |
+
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Show row meta on the plugin screen.
|
55 |
+
*
|
56 |
+
* @param mixed $links Plugin Row Meta
|
57 |
+
* @param mixed $file Plugin Base file
|
58 |
+
* @return array
|
59 |
+
*/
|
60 |
+
public function plugin_row_meta( $links, $file ) {
|
61 |
+
if ( $file == $this->name ) {
|
62 |
+
$row_meta = array(
|
63 |
+
'changelog' => '<a href="' . admin_url( 'plugin-install.php?tab=plugin-information&plugin=wpai-woocommerce-add-on§ion=changelog&TB_iframe=true&width=600&height=800' ) . '" class="thickbox open-plugin-details-modal" title="' . esc_attr( __( 'View WP All Import - WooCommerce Add-On Pro Changelog', PMWI_Plugin::TEXT_DOMAIN ) ) . '">' . __( 'Changelog', PMWI_Plugin::TEXT_DOMAIN ) . '</a>',
|
64 |
+
);
|
65 |
+
|
66 |
+
return array_merge( $links, $row_meta );
|
67 |
+
}
|
68 |
+
|
69 |
+
return (array) $links;
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Check for Updates at the defined API endpoint and modify the update array.
|
74 |
+
*
|
75 |
+
* This function dives into the update API just when WordPress creates its update array,
|
76 |
+
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
77 |
+
* It is reassembled from parts of the native WordPress plugin update code.
|
78 |
+
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
79 |
+
*
|
80 |
+
* @uses api_request()
|
81 |
+
*
|
82 |
+
* @param array $_transient_data Update array build by WordPress.
|
83 |
+
* @return array Modified update array with custom plugin data.
|
84 |
+
*/
|
85 |
+
function check_update( $_transient_data ) {
|
86 |
+
|
87 |
+
global $pagenow;
|
88 |
+
global $wpdb;
|
89 |
+
|
90 |
+
if( ! is_object( $_transient_data ) ) {
|
91 |
+
$_transient_data = new stdClass;
|
92 |
+
}
|
93 |
+
|
94 |
+
if( 'plugins.php' == $pagenow && is_multisite() ) {
|
95 |
+
return $_transient_data;
|
96 |
+
}
|
97 |
+
|
98 |
+
if( empty( $_transient_data ) ) return $_transient_data;
|
99 |
+
|
100 |
+
if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
|
101 |
+
|
102 |
+
$cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
|
103 |
+
$version_info = get_transient( $cache_key );
|
104 |
+
|
105 |
+
if( false === $version_info ) {
|
106 |
+
|
107 |
+
$timeout = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $this->slug . '_timeout_' . $cache_key ) );
|
108 |
+
|
109 |
+
// Has to be get_row instead of get_var because of funkiness with 0, false, null values
|
110 |
+
if ( is_object( $timeout ) ) {
|
111 |
+
$value = $timeout->option_value;
|
112 |
+
// cache time is not expired
|
113 |
+
if ( $value >= strtotime("now") )
|
114 |
+
{
|
115 |
+
$cache_value = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $this->slug . '_' . $cache_key ) );
|
116 |
+
if ( is_object( $cache_value ) and ! empty($cache_value->option_value)) {
|
117 |
+
$version_info = maybe_unserialize($cache_value->option_value);
|
118 |
+
}
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
if( false === $version_info ) {
|
123 |
+
$version_info = $this->api_request( 'check_update', array( 'slug' => $this->slug ) );
|
124 |
+
$transient_result = set_transient( $cache_key, $version_info, 3600 );
|
125 |
+
|
126 |
+
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_' . $cache_key) );
|
127 |
+
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_timeout_' . $cache_key) );
|
128 |
+
|
129 |
+
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->options ( option_value, option_name, autoload ) VALUES ( %s, %s, 'no' )", maybe_serialize( $version_info ), $this->slug . '_' . $cache_key) );
|
130 |
+
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->options ( option_value, option_name ) VALUES ( %s, %s )", strtotime("+1 hour"), $this->slug . '_timeout_' . $cache_key) );
|
131 |
+
|
132 |
+
}
|
133 |
+
|
134 |
+
}
|
135 |
+
|
136 |
+
if( ! is_object( $version_info ) ) {
|
137 |
+
return $_transient_data;
|
138 |
+
}
|
139 |
+
|
140 |
+
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
141 |
+
|
142 |
+
$this->did_check = true;
|
143 |
+
|
144 |
+
if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
145 |
+
|
146 |
+
$_transient_data->response[ $this->name ] = $version_info;
|
147 |
+
|
148 |
+
}
|
149 |
+
|
150 |
+
$_transient_data->last_checked = time();
|
151 |
+
$_transient_data->checked[ $this->name ] = $this->version;
|
152 |
+
|
153 |
+
}
|
154 |
+
|
155 |
+
}
|
156 |
+
|
157 |
+
return $_transient_data;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
162 |
+
*
|
163 |
+
* @param string $file
|
164 |
+
* @param array $plugin
|
165 |
+
*/
|
166 |
+
public function show_update_notification( $file, $plugin ) {
|
167 |
+
|
168 |
+
if( ! current_user_can( 'update_plugins' ) ) {
|
169 |
+
return;
|
170 |
+
}
|
171 |
+
|
172 |
+
if( ! is_multisite() ) {
|
173 |
+
return;
|
174 |
+
}
|
175 |
+
|
176 |
+
if ( $this->name != $file ) {
|
177 |
+
return;
|
178 |
+
}
|
179 |
+
|
180 |
+
// Remove our filter on the site transient
|
181 |
+
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 21 );
|
182 |
+
|
183 |
+
$update_cache = get_site_transient( 'update_plugins' );
|
184 |
+
|
185 |
+
if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
186 |
+
|
187 |
+
global $wpdb;
|
188 |
+
|
189 |
+
$cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
|
190 |
+
$version_info = get_transient( $cache_key );
|
191 |
+
|
192 |
+
if( false === $version_info ) {
|
193 |
+
|
194 |
+
$timeout = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $this->slug . '_timeout_' . $cache_key ) );
|
195 |
+
|
196 |
+
// Has to be get_row instead of get_var because of funkiness with 0, false, null values
|
197 |
+
if ( is_object( $timeout ) ) {
|
198 |
+
$value = $timeout->option_value;
|
199 |
+
// cache time is not expired
|
200 |
+
if ( $value >= strtotime("now") )
|
201 |
+
{
|
202 |
+
$cache_value = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $this->slug . '_' . $cache_key ) );
|
203 |
+
if ( is_object( $cache_value ) and ! empty($cache_value->option_value)) {
|
204 |
+
$version_info = maybe_unserialize($cache_value->option_value);
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
if( false === $version_info ) {
|
210 |
+
|
211 |
+
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
212 |
+
|
213 |
+
$transient_result = set_transient( $cache_key, $version_info, 3600 );
|
214 |
+
|
215 |
+
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_' . $cache_key) );
|
216 |
+
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_timeout_' . $cache_key) );
|
217 |
+
|
218 |
+
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->options ( option_value, option_name, autoload ) VALUES ( %s, %s, 'no' )", maybe_serialize( $version_info ), $this->slug . '_' . $cache_key) );
|
219 |
+
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->options ( option_value, option_name ) VALUES ( %s, %s )", strtotime("+1 hour"), $this->slug . '_timeout_' . $cache_key) );
|
220 |
+
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
if( ! is_object( $version_info ) ) {
|
225 |
+
return;
|
226 |
+
}
|
227 |
+
|
228 |
+
if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
229 |
+
|
230 |
+
$update_cache->response[ $this->name ] = $version_info;
|
231 |
+
|
232 |
+
}
|
233 |
+
|
234 |
+
$update_cache->last_checked = time();
|
235 |
+
$update_cache->checked[ $this->name ] = $this->version;
|
236 |
+
|
237 |
+
set_site_transient( 'update_plugins', $update_cache );
|
238 |
+
|
239 |
+
} else {
|
240 |
+
|
241 |
+
$version_info = $update_cache->response[ $this->name ];
|
242 |
+
|
243 |
+
}
|
244 |
+
|
245 |
+
// Restore our filter
|
246 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 21 );
|
247 |
+
|
248 |
+
if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
249 |
+
|
250 |
+
// build a plugin list row, with update notification
|
251 |
+
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
|
252 |
+
echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
|
253 |
+
|
254 |
+
$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
|
255 |
+
|
256 |
+
if ( empty( $version_info->download_link ) ) {
|
257 |
+
printf(
|
258 |
+
__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
|
259 |
+
esc_html( $version_info->name ),
|
260 |
+
esc_url( $changelog_link ),
|
261 |
+
esc_html( $version_info->new_version )
|
262 |
+
);
|
263 |
+
} else {
|
264 |
+
printf(
|
265 |
+
__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
|
266 |
+
esc_html( $version_info->name ),
|
267 |
+
esc_url( $changelog_link ),
|
268 |
+
esc_html( $version_info->new_version ),
|
269 |
+
esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
|
270 |
+
);
|
271 |
+
}
|
272 |
+
|
273 |
+
echo '</div></td></tr>';
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Updates information on the "View version x.x details" page with custom data.
|
279 |
+
*
|
280 |
+
* @uses api_request()
|
281 |
+
*
|
282 |
+
* @param mixed $_data
|
283 |
+
* @param string $_action
|
284 |
+
* @param object $_args
|
285 |
+
* @return object $_data
|
286 |
+
*/
|
287 |
+
function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
288 |
+
|
289 |
+
|
290 |
+
if ( $_action != 'plugin_information' ) {
|
291 |
+
|
292 |
+
return $_data;
|
293 |
+
|
294 |
+
}
|
295 |
+
|
296 |
+
if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
|
297 |
+
|
298 |
+
return $_data;
|
299 |
+
|
300 |
+
}
|
301 |
+
|
302 |
+
global $wpdb;
|
303 |
+
|
304 |
+
$cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
|
305 |
+
$_data = get_transient( $cache_key );
|
306 |
+
|
307 |
+
if( false === $_data ) {
|
308 |
+
|
309 |
+
$timeout = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $this->slug . '_timeout_' . $cache_key ) );
|
310 |
+
|
311 |
+
// Has to be get_row instead of get_var because of funkiness with 0, false, null values
|
312 |
+
if ( is_object( $timeout ) ) {
|
313 |
+
$value = $timeout->option_value;
|
314 |
+
// cache time is not expired
|
315 |
+
if ( $value >= strtotime("now") )
|
316 |
+
{
|
317 |
+
$cache_value = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $this->slug . '_' . $cache_key ) );
|
318 |
+
if ( is_object( $cache_value ) and ! empty($cache_value->option_value)) {
|
319 |
+
$_data = maybe_unserialize($cache_value->option_value);
|
320 |
+
}
|
321 |
+
}
|
322 |
+
}
|
323 |
+
|
324 |
+
if( false === $_data ) {
|
325 |
+
$to_send = array(
|
326 |
+
'slug' => $this->slug,
|
327 |
+
'is_ssl' => is_ssl(),
|
328 |
+
'fields' => array(
|
329 |
+
'banners' => false, // These will be supported soon hopefully
|
330 |
+
'reviews' => false
|
331 |
+
)
|
332 |
+
);
|
333 |
+
|
334 |
+
$_data = $this->api_request( 'plugin_information', $to_send );
|
335 |
+
|
336 |
+
if ( false !== $_data ) {
|
337 |
+
|
338 |
+
$transient_result = set_transient( $cache_key, $_data, 3600 );
|
339 |
+
|
340 |
+
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_' . $cache_key) );
|
341 |
+
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->options WHERE option_name = %s", $this->slug . '_timeout_' . $cache_key) );
|
342 |
+
|
343 |
+
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->options ( option_value, option_name, autoload ) VALUES ( %s, %s, 'no' )", maybe_serialize( $_data ), $this->slug . '_' . $cache_key) );
|
344 |
+
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->options ( option_value, option_name ) VALUES ( %s, %s )", strtotime("+1 hour"), $this->slug . '_timeout_' . $cache_key) );
|
345 |
+
|
346 |
+
}
|
347 |
+
}
|
348 |
+
}
|
349 |
+
|
350 |
+
return $_data;
|
351 |
+
}
|
352 |
+
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Disable SSL verification in order to prevent download update failures
|
356 |
+
*
|
357 |
+
* @param array $args
|
358 |
+
* @param string $url
|
359 |
+
* @return object $array
|
360 |
+
*/
|
361 |
+
function http_request_args( $args, $url ) {
|
362 |
+
// If it is an https request and we are performing a package download, disable ssl verification
|
363 |
+
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
364 |
+
$args['sslverify'] = false;
|
365 |
+
}
|
366 |
+
return $args;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Calls the API and, if successfull, returns the object delivered by the API.
|
371 |
+
*
|
372 |
+
* @uses get_bloginfo()
|
373 |
+
* @uses wp_remote_post()
|
374 |
+
* @uses is_wp_error()
|
375 |
+
*
|
376 |
+
* @param string $_action The requested action.
|
377 |
+
* @param array $_data Parameters for the API action.
|
378 |
+
* @return false||object
|
379 |
+
*/
|
380 |
+
private function api_request( $_action, $_data ) {
|
381 |
+
|
382 |
+
global $wp_version;
|
383 |
+
|
384 |
+
$data = array_merge( $this->api_data, $_data );
|
385 |
+
|
386 |
+
if ( $data['slug'] != $this->slug )
|
387 |
+
return;
|
388 |
+
|
389 |
+
/*if ( empty( $data['license'] ) )
|
390 |
+
return;*/
|
391 |
+
|
392 |
+
if( $this->api_url == home_url() ) {
|
393 |
+
return false; // Don't allow a plugin to ping itself
|
394 |
+
}
|
395 |
+
|
396 |
+
$api_params = array(
|
397 |
+
'edd_action' => 'get_version',
|
398 |
+
'license' => false,
|
399 |
+
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
400 |
+
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
401 |
+
'slug' => $data['slug'],
|
402 |
+
'author' => $data['author'],
|
403 |
+
'url' => home_url(),
|
404 |
+
'version' => $this->version
|
405 |
+
);
|
406 |
+
|
407 |
+
// if ( defined('WP_DEBUG') and WP_DEBUG )
|
408 |
+
// {
|
409 |
+
// $uploads = wp_upload_dir();
|
410 |
+
// file_put_contents($uploads['basedir'] . "/log.txt", date("d-m-Y H:i:s") . ' - ' .json_encode($api_params) . "\n", FILE_APPEND);
|
411 |
+
// }
|
412 |
+
|
413 |
+
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
|
414 |
+
|
415 |
+
if ( ! is_wp_error( $request ) ) {
|
416 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
417 |
+
}
|
418 |
+
|
419 |
+
if ( $request && isset( $request->banners ) ) {
|
420 |
+
$request->banners = maybe_unserialize( $request->banners );
|
421 |
+
}
|
422 |
+
|
423 |
+
if ( $request && isset( $request->sections ) ) {
|
424 |
+
$request->sections = maybe_unserialize( $request->sections );
|
425 |
+
} else {
|
426 |
+
$request = false;
|
427 |
+
}
|
428 |
+
|
429 |
+
return $request;
|
430 |
+
}
|
431 |
+
|
432 |
+
public function show_changelog() {
|
433 |
+
|
434 |
+
|
435 |
+
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
436 |
+
return;
|
437 |
+
}
|
438 |
+
|
439 |
+
if( empty( $_REQUEST['plugin'] ) ) {
|
440 |
+
return;
|
441 |
+
}
|
442 |
+
|
443 |
+
if( empty( $_REQUEST['slug'] ) ) {
|
444 |
+
return;
|
445 |
+
}
|
446 |
+
|
447 |
+
if( ! current_user_can( 'update_plugins' ) ) {
|
448 |
+
wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
449 |
+
}
|
450 |
+
|
451 |
+
$response = $this->api_request( 'show_changelog', array( 'slug' => $_REQUEST['slug'] ) );
|
452 |
+
|
453 |
+
if( $response && isset( $response->sections['changelog'] ) ) {
|
454 |
+
echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
|
455 |
+
}
|
456 |
+
|
457 |
+
|
458 |
+
exit;
|
459 |
+
}
|
460 |
+
}
|
461 |
+
|
462 |
+
}
|
config/options.php
CHANGED
@@ -4,5 +4,5 @@
|
|
4 |
* and can be changed by corresponding wordpress function calls
|
5 |
*/
|
6 |
$config = array(
|
7 |
-
|
8 |
);
|
4 |
* and can be changed by corresponding wordpress function calls
|
5 |
*/
|
6 |
$config = array(
|
7 |
+
|
8 |
);
|
controllers/admin/import.php
CHANGED
@@ -10,7 +10,60 @@ class PMWI_Admin_Import extends PMWI_Controller_Admin
|
|
10 |
|
11 |
$this->data['post'] =& $post;
|
12 |
|
13 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
|
|
|
|
|
|
|
|
15 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
}
|
10 |
|
11 |
$this->data['post'] =& $post;
|
12 |
|
13 |
+
switch ($post['custom_type'])
|
14 |
+
{
|
15 |
+
case 'product':
|
16 |
+
$this->render('admin/import/product/index');
|
17 |
+
break;
|
18 |
+
|
19 |
+
case 'shop_order':
|
20 |
+
$this->render('admin/import/shop_order/index');
|
21 |
+
break;
|
22 |
|
23 |
+
default:
|
24 |
+
# code...
|
25 |
+
break;
|
26 |
+
}
|
27 |
}
|
28 |
+
|
29 |
+
public function options( $isWizard = false, $post = array() )
|
30 |
+
{
|
31 |
+
$this->data['isWizard'] = $isWizard;
|
32 |
+
|
33 |
+
$this->data['post'] =& $post;
|
34 |
+
|
35 |
+
$this->data['existing_meta_keys'] = array();
|
36 |
+
|
37 |
+
if ( ! in_array($post['custom_type'], array('import_users'))){
|
38 |
+
|
39 |
+
global $wpdb;
|
40 |
+
|
41 |
+
// Get all meta keys for requested post type
|
42 |
+
$hide_fields = array('_wp_page_template', '_edit_lock', '_edit_last', '_wp_trash_meta_status', '_wp_trash_meta_time');
|
43 |
+
$records = get_posts( array('post_type' => $post['custom_type']) );
|
44 |
+
if ( ! empty($records)){
|
45 |
+
foreach ($records as $record) {
|
46 |
+
$record_meta = get_post_meta($record->ID, '');
|
47 |
+
if ( ! empty($record_meta)){
|
48 |
+
foreach ($record_meta as $record_meta_key => $record_meta_value) {
|
49 |
+
if ( ! in_array($record_meta_key, $this->data['existing_meta_keys']) and ! in_array($record_meta_key, $hide_fields)) $this->data['existing_meta_keys'][] = $record_meta_key;
|
50 |
+
}
|
51 |
+
}
|
52 |
+
}
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
$this->render();
|
57 |
+
}
|
58 |
+
|
59 |
+
public function confirm( $isWizard = false, $post = array() )
|
60 |
+
{
|
61 |
+
$this->data['isWizard'] = $isWizard;
|
62 |
+
|
63 |
+
$this->data['post'] =& $post;
|
64 |
+
|
65 |
+
$this->data['existing_meta_keys'] = array();
|
66 |
+
|
67 |
+
$this->render();
|
68 |
+
}
|
69 |
}
|
controllers/controller/admin.php
CHANGED
@@ -44,44 +44,44 @@ abstract class PMWI_Controller_Admin extends PMWI_Controller {
|
|
44 |
if ( ! is_a($wp_styles, 'WP_Styles'))
|
45 |
$wp_styles = new WP_Styles();
|
46 |
|
47 |
-
wp_enqueue_style('pmwi-admin-style', PMWI_ROOT_URL . '/static/css/admin.css', array(),
|
48 |
|
49 |
if ( version_compare(get_bloginfo('version'), '3.8-RC1') >= 0 ){
|
50 |
wp_enqueue_style('pmwi-admin-style-wp-3.8', PMWI_ROOT_URL . '/static/css/admin-wp-3.8.css');
|
51 |
}
|
52 |
|
53 |
wp_enqueue_script('pmwi-script', PMWI_ROOT_URL . '/static/js/pmwi.js', array('jquery'));
|
54 |
-
wp_enqueue_script('pmwi-admin-script', PMWI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-resizable', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'pmxi-admin-script'),
|
55 |
|
56 |
global $woocommerce;
|
57 |
|
58 |
$woocommerce_witepanel_params = array(
|
59 |
-
'remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.",
|
60 |
-
'remove_attribute' => __('Remove this attribute?',
|
61 |
-
'name_label' => __('Name',
|
62 |
-
'remove_label' => __('Remove',
|
63 |
-
'click_to_toggle' => __('Click to toggle',
|
64 |
-
'values_label' => __('Value(s)',
|
65 |
-
'text_attribute_tip' => __('Enter some text, or some attributes by pipe (|) separating values.',
|
66 |
-
'visible_label' => __('Visible on the product page',
|
67 |
-
'used_for_variations_label' => __('Used for variations',
|
68 |
-
'new_attribute_prompt' => __('Enter a name for the new attribute term:',
|
69 |
-
'calc_totals' => __("Calculate totals based on order items, discount amount, and shipping? Note, you will need to (optionally) calculate tax rows and cart discounts manually.",
|
70 |
-
'calc_line_taxes' => __("Calculate line taxes? This will calculate taxes based on the customers country. If no billing/shipping is set it will use the store base country.",
|
71 |
-
'copy_billing' => __("Copy billing information to shipping information? This will remove any currently entered shipping information.",
|
72 |
-
'load_billing' => __("Load the customer's billing information? This will remove any currently entered billing information.",
|
73 |
-
'load_shipping' => __("Load the customer's shipping information? This will remove any currently entered shipping information.",
|
74 |
-
'featured_label' => __('Featured',
|
75 |
'tax_or_vat' => $woocommerce->countries->tax_or_vat(),
|
76 |
'prices_include_tax' => get_option('woocommerce_prices_include_tax'),
|
77 |
'round_at_subtotal' => get_option( 'woocommerce_tax_round_at_subtotal' ),
|
78 |
-
'meta_name' => __('Meta Name',
|
79 |
-
'meta_value' => __('Meta Value',
|
80 |
-
'no_customer_selected' => __('No customer selected',
|
81 |
-
'tax_label' => __('Tax Label:',
|
82 |
-
'compound_label' => __('Compound:',
|
83 |
-
'cart_tax_label' => __('Cart Tax:',
|
84 |
-
'shipping_tax_label' => __('Shipping Tax:',
|
85 |
'plugin_url' => $woocommerce->plugin_url(),
|
86 |
'ajax_url' => admin_url('admin-ajax.php'),
|
87 |
'add_order_item_nonce' => wp_create_nonce("add-order-item"),
|
44 |
if ( ! is_a($wp_styles, 'WP_Styles'))
|
45 |
$wp_styles = new WP_Styles();
|
46 |
|
47 |
+
wp_enqueue_style('pmwi-admin-style', PMWI_ROOT_URL . '/static/css/admin.css', array(), PMWI_VERSION);
|
48 |
|
49 |
if ( version_compare(get_bloginfo('version'), '3.8-RC1') >= 0 ){
|
50 |
wp_enqueue_style('pmwi-admin-style-wp-3.8', PMWI_ROOT_URL . '/static/css/admin-wp-3.8.css');
|
51 |
}
|
52 |
|
53 |
wp_enqueue_script('pmwi-script', PMWI_ROOT_URL . '/static/js/pmwi.js', array('jquery'));
|
54 |
+
wp_enqueue_script('pmwi-admin-script', PMWI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-resizable', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'pmxi-admin-script'), PMWI_VERSION);
|
55 |
|
56 |
global $woocommerce;
|
57 |
|
58 |
$woocommerce_witepanel_params = array(
|
59 |
+
'remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", PMWI_Plugin::TEXT_DOMAIN),
|
60 |
+
'remove_attribute' => __('Remove this attribute?', PMWI_Plugin::TEXT_DOMAIN),
|
61 |
+
'name_label' => __('Name', PMWI_Plugin::TEXT_DOMAIN),
|
62 |
+
'remove_label' => __('Remove', PMWI_Plugin::TEXT_DOMAIN),
|
63 |
+
'click_to_toggle' => __('Click to toggle', PMWI_Plugin::TEXT_DOMAIN),
|
64 |
+
'values_label' => __('Value(s)', PMWI_Plugin::TEXT_DOMAIN),
|
65 |
+
'text_attribute_tip' => __('Enter some text, or some attributes by pipe (|) separating values.', PMWI_Plugin::TEXT_DOMAIN),
|
66 |
+
'visible_label' => __('Visible on the product page', PMWI_Plugin::TEXT_DOMAIN),
|
67 |
+
'used_for_variations_label' => __('Used for variations', PMWI_Plugin::TEXT_DOMAIN),
|
68 |
+
'new_attribute_prompt' => __('Enter a name for the new attribute term:', PMWI_Plugin::TEXT_DOMAIN),
|
69 |
+
'calc_totals' => __("Calculate totals based on order items, discount amount, and shipping? Note, you will need to (optionally) calculate tax rows and cart discounts manually.", PMWI_Plugin::TEXT_DOMAIN),
|
70 |
+
'calc_line_taxes' => __("Calculate line taxes? This will calculate taxes based on the customers country. If no billing/shipping is set it will use the store base country.", PMWI_Plugin::TEXT_DOMAIN),
|
71 |
+
'copy_billing' => __("Copy billing information to shipping information? This will remove any currently entered shipping information.", PMWI_Plugin::TEXT_DOMAIN),
|
72 |
+
'load_billing' => __("Load the customer's billing information? This will remove any currently entered billing information.", PMWI_Plugin::TEXT_DOMAIN),
|
73 |
+
'load_shipping' => __("Load the customer's shipping information? This will remove any currently entered shipping information.", PMWI_Plugin::TEXT_DOMAIN),
|
74 |
+
'featured_label' => __('Featured', PMWI_Plugin::TEXT_DOMAIN),
|
75 |
'tax_or_vat' => $woocommerce->countries->tax_or_vat(),
|
76 |
'prices_include_tax' => get_option('woocommerce_prices_include_tax'),
|
77 |
'round_at_subtotal' => get_option( 'woocommerce_tax_round_at_subtotal' ),
|
78 |
+
'meta_name' => __('Meta Name', PMWI_Plugin::TEXT_DOMAIN),
|
79 |
+
'meta_value' => __('Meta Value', PMWI_Plugin::TEXT_DOMAIN),
|
80 |
+
'no_customer_selected' => __('No customer selected', PMWI_Plugin::TEXT_DOMAIN),
|
81 |
+
'tax_label' => __('Tax Label:', PMWI_Plugin::TEXT_DOMAIN),
|
82 |
+
'compound_label' => __('Compound:', PMWI_Plugin::TEXT_DOMAIN),
|
83 |
+
'cart_tax_label' => __('Cart Tax:', PMWI_Plugin::TEXT_DOMAIN),
|
84 |
+
'shipping_tax_label' => __('Shipping Tax:', PMWI_Plugin::TEXT_DOMAIN),
|
85 |
'plugin_url' => $woocommerce->plugin_url(),
|
86 |
'ajax_url' => admin_url('admin-ajax.php'),
|
87 |
'add_order_item_nonce' => wp_create_nonce("add-order-item"),
|
filters/pmxi_article_data.php
CHANGED
@@ -1,7 +1,25 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
$articleData['post_type'] = $post_to_update->post_type;
|
5 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
return $articleData;
|
7 |
}
|
1 |
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Preset post type and status.
|
6 |
+
*
|
7 |
+
* @param $articleData
|
8 |
+
* @param $import
|
9 |
+
* @param $post_to_update
|
10 |
+
*
|
11 |
+
* @return mixed
|
12 |
+
*/
|
13 |
+
function pmwi_pmxi_article_data($articleData, $import, $post_to_update) {
|
14 |
+
if (!empty($articleData['post_type']) && $articleData['post_type'] == 'product' && $import->options['update_all_data'] == 'no' && !$import->options['is_update_product_type'] && !empty($post_to_update)) {
|
15 |
$articleData['post_type'] = $post_to_update->post_type;
|
16 |
}
|
17 |
+
if (!empty($articleData['post_type']) && $articleData['post_type'] == 'shop_order' && !empty($post_to_update)) {
|
18 |
+
$articleData['post_status'] = $post_to_update->post_status;
|
19 |
+
}
|
20 |
+
if (!empty($articleData['post_type']) && $articleData['post_type'] == 'product' && !empty($post_to_update) && $post_to_update->post_type == 'product_variation') {
|
21 |
+
$articleData['post_parent'] = $post_to_update->post_parent;
|
22 |
+
$articleData['post_type'] = 'product_variation';
|
23 |
+
}
|
24 |
return $articleData;
|
25 |
}
|
filters/pmxi_custom_field.php
CHANGED
@@ -1,11 +1,17 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
function pmwi_pmxi_custom_field($cf_value, $pid, $cf_key, $existing_meta_keys, $import_id){
|
4 |
-
|
5 |
-
if ($cf_key == 'total_sales')
|
6 |
-
{
|
7 |
delete_post_meta($pid, $cf_key);
|
8 |
}
|
9 |
-
|
10 |
return $cf_value;
|
11 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* @param $cf_value
|
5 |
+
* @param $pid
|
6 |
+
* @param $cf_key
|
7 |
+
* @param $existing_meta_keys
|
8 |
+
* @param $import_id
|
9 |
+
*
|
10 |
+
* @return mixed
|
11 |
+
*/
|
12 |
function pmwi_pmxi_custom_field($cf_value, $pid, $cf_key, $existing_meta_keys, $import_id){
|
13 |
+
if ($cf_key == 'total_sales') {
|
|
|
|
|
14 |
delete_post_meta($pid, $cf_key);
|
15 |
}
|
|
|
16 |
return $cf_value;
|
17 |
}
|
filters/pmxi_custom_field_to_delete.php
CHANGED
@@ -1,25 +1,44 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
function pmwi_pmxi_custom_field_to_delete($field_to_delete, $pid, $post_type, $options, $cur_meta_key){
|
3 |
|
4 |
if ($field_to_delete === false || $post_type != "product") return $field_to_delete;
|
5 |
|
6 |
-
if ($cur_meta_key
|
7 |
|
8 |
-
if ($cur_meta_key == '_is_first_variation_created')
|
9 |
-
{
|
10 |
delete_post_meta($pid, $cur_meta_key);
|
11 |
return false;
|
12 |
}
|
13 |
|
14 |
-
// Do not update attributes
|
15 |
-
if ($options['update_all_data'] == 'no'
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
if ($cur_meta_key == '_product_attributes'){
|
21 |
$current_product_attributes = get_post_meta($pid, '_product_attributes', true);
|
22 |
-
if ( ! empty($current_product_attributes)
|
23 |
foreach ($current_product_attributes as $attr_name => $attr_value) {
|
24 |
if ( in_array($attr_name, array_filter($options['attributes_list'], 'trim'))) unset($current_product_attributes[$attr_name]);
|
25 |
}
|
@@ -28,21 +47,21 @@ function pmwi_pmxi_custom_field_to_delete($field_to_delete, $pid, $post_type, $o
|
|
28 |
return false;
|
29 |
}
|
30 |
|
31 |
-
if ( strpos($cur_meta_key, "attribute_") === 0
|
32 |
|
33 |
if (in_array($cur_meta_key, array('_default_attributes'))) return false;
|
34 |
|
35 |
}
|
36 |
|
37 |
-
// Leave these attributes alone, update all other Attributes
|
38 |
-
if ($options['update_all_data'] == 'no'
|
39 |
|
40 |
if ($cur_meta_key == '_product_attributes'){
|
41 |
|
42 |
if (empty($options['attributes_list'])) { delete_post_meta($pid, $cur_meta_key); return false; }
|
43 |
|
44 |
$current_product_attributes = get_post_meta($pid, '_product_attributes', true);
|
45 |
-
if ( ! empty($current_product_attributes)
|
46 |
foreach ($current_product_attributes as $attr_name => $attr_value) {
|
47 |
if ( ! in_array($attr_name, array_filter($options['attributes_list'], 'trim'))) unset($current_product_attributes[$attr_name]);
|
48 |
}
|
@@ -51,11 +70,10 @@ function pmwi_pmxi_custom_field_to_delete($field_to_delete, $pid, $post_type, $o
|
|
51 |
return false;
|
52 |
}
|
53 |
|
54 |
-
if ( strpos($cur_meta_key, "attribute_") === 0
|
55 |
|
56 |
if (in_array($cur_meta_key, array('_default_attributes'))) return false;
|
57 |
}
|
58 |
|
59 |
return true;
|
60 |
}
|
61 |
-
?>
|
1 |
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Check if custom field needs to be deleted.
|
6 |
+
*
|
7 |
+
* @param $field_to_delete
|
8 |
+
* @param $pid
|
9 |
+
* @param $post_type
|
10 |
+
* @param $options
|
11 |
+
* @param $cur_meta_key
|
12 |
+
*
|
13 |
+
* @return bool
|
14 |
+
*/
|
15 |
function pmwi_pmxi_custom_field_to_delete($field_to_delete, $pid, $post_type, $options, $cur_meta_key){
|
16 |
|
17 |
if ($field_to_delete === false || $post_type != "product") return $field_to_delete;
|
18 |
|
19 |
+
if (in_array($cur_meta_key, array('total_sales', '_stock_status'))) return false;
|
20 |
|
21 |
+
if ($cur_meta_key == '_is_first_variation_created') {
|
|
|
22 |
delete_post_meta($pid, $cur_meta_key);
|
23 |
return false;
|
24 |
}
|
25 |
|
26 |
+
// Do not update attributes.
|
27 |
+
if ($options['update_all_data'] == 'no' && !$options['is_update_attributes'] && (in_array($cur_meta_key, array('_default_attributes', '_product_attributes')) || strpos($cur_meta_key, "attribute_") === 0)) return false;
|
28 |
+
|
29 |
+
// Don't touch existing, only add new attributes.
|
30 |
+
if ($options['update_all_data'] == 'no' && $options['is_update_attributes'] && $options['update_attributes_logic'] == 'add_new'){
|
31 |
+
if (in_array($cur_meta_key, array('_default_attributes', '_product_attributes')) || strpos($cur_meta_key, "attribute_") === 0 ){
|
32 |
+
return false;
|
33 |
+
}
|
34 |
+
}
|
35 |
+
|
36 |
+
// Update only these Attributes, leave the rest alone.
|
37 |
+
if ($options['update_all_data'] == 'no' && $options['is_update_attributes'] && $options['update_attributes_logic'] == 'only'){
|
38 |
|
39 |
if ($cur_meta_key == '_product_attributes'){
|
40 |
$current_product_attributes = get_post_meta($pid, '_product_attributes', true);
|
41 |
+
if ( ! empty($current_product_attributes) && ! empty($options['attributes_list']) && is_array($options['attributes_list']))
|
42 |
foreach ($current_product_attributes as $attr_name => $attr_value) {
|
43 |
if ( in_array($attr_name, array_filter($options['attributes_list'], 'trim'))) unset($current_product_attributes[$attr_name]);
|
44 |
}
|
47 |
return false;
|
48 |
}
|
49 |
|
50 |
+
if ( strpos($cur_meta_key, "attribute_") === 0 && !empty($options['attributes_list']) && is_array($options['attributes_list']) && !in_array(str_replace("attribute_", "", $cur_meta_key), array_filter($options['attributes_list'], 'trim'))) return false;
|
51 |
|
52 |
if (in_array($cur_meta_key, array('_default_attributes'))) return false;
|
53 |
|
54 |
}
|
55 |
|
56 |
+
// Leave these attributes alone, update all other Attributes.
|
57 |
+
if ($options['update_all_data'] == 'no' && $options['is_update_attributes'] && $options['update_attributes_logic'] == 'all_except') {
|
58 |
|
59 |
if ($cur_meta_key == '_product_attributes'){
|
60 |
|
61 |
if (empty($options['attributes_list'])) { delete_post_meta($pid, $cur_meta_key); return false; }
|
62 |
|
63 |
$current_product_attributes = get_post_meta($pid, '_product_attributes', true);
|
64 |
+
if ( ! empty($current_product_attributes) && ! empty($options['attributes_list']) && is_array($options['attributes_list']))
|
65 |
foreach ($current_product_attributes as $attr_name => $attr_value) {
|
66 |
if ( ! in_array($attr_name, array_filter($options['attributes_list'], 'trim'))) unset($current_product_attributes[$attr_name]);
|
67 |
}
|
70 |
return false;
|
71 |
}
|
72 |
|
73 |
+
if ( strpos($cur_meta_key, "attribute_") === 0 && !empty($options['attributes_list']) && is_array($options['attributes_list']) && in_array(str_replace("attribute_", "", $cur_meta_key), array_filter($options['attributes_list'], 'trim'))) return false;
|
74 |
|
75 |
if (in_array($cur_meta_key, array('_default_attributes'))) return false;
|
76 |
}
|
77 |
|
78 |
return true;
|
79 |
}
|
|
filters/pmxi_custom_field_to_update.php
CHANGED
@@ -1,16 +1,36 @@
|
|
1 |
<?php
|
2 |
-
function pmwi_pmxi_custom_field_to_update( $field_to_update, $post_type, $options, $m_key ){
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
}
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
|
|
2 |
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Check if custom field needs to be updated.
|
6 |
+
*
|
7 |
+
* @param $field_to_update
|
8 |
+
* @param $post_type
|
9 |
+
* @param $options
|
10 |
+
* @param $m_key
|
11 |
+
*
|
12 |
+
* @return bool
|
13 |
+
*/
|
14 |
+
function pmwi_pmxi_custom_field_to_update($field_to_update, $post_type, $options, $m_key) {
|
15 |
|
16 |
+
if ($field_to_update === FALSE || $post_type != 'product' || strpos($m_key, 'attribute_') === FALSE) {
|
17 |
+
return $field_to_update;
|
18 |
+
}
|
19 |
+
// Do not update attributes.
|
20 |
+
if ($options['update_all_data'] == 'no' && !$options['is_update_attributes'] && (!in_array($m_key, [
|
21 |
+
'_default_attributes',
|
22 |
+
'_product_attributes',
|
23 |
+
]) || strpos($m_key, "attribute_") === FALSE)) {
|
24 |
+
return TRUE;
|
25 |
+
}
|
26 |
+
if ($options['is_update_attributes'] && $options['update_attributes_logic'] == 'full_update') {
|
27 |
+
return TRUE;
|
28 |
+
}
|
29 |
+
if ($options['is_update_attributes'] && $options['update_attributes_logic'] == "only" && !empty($options['attributes_list']) && is_array($options['attributes_list']) && in_array(str_replace("attribute_", "", $m_key), $options['attributes_list'])) {
|
30 |
+
return TRUE;
|
31 |
+
}
|
32 |
+
if ($options['is_update_attributes'] && $options['update_attributes_logic'] == "all_except" && (empty($options['attributes_list']) || !in_array(str_replace("attribute_", "", $m_key), $options['attributes_list']))) {
|
33 |
+
return TRUE;
|
34 |
+
}
|
35 |
+
return FALSE;
|
36 |
+
}
|
filters/pmxi_custom_types.php
CHANGED
@@ -1,42 +1,55 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
function pmwi_pmxi_custom_types($custom_types)
|
4 |
-
{
|
5 |
-
if (class_exists('WooCommerce'))
|
6 |
-
{
|
7 |
-
if ( ! empty($custom_types['product']) ) $custom_types['product']->labels->name = __('WooCommerce Products','wpai_woocommerce_addon_plugin');
|
8 |
-
if ( ! empty($custom_types['shop_order']) ) $custom_types['shop_order']->labels->name = __('WooCommerce Orders','wpai_woocommerce_addon_plugin');
|
9 |
-
if ( ! empty($custom_types['shop_coupon'])) $custom_types['shop_coupon']->labels->name = __('WooCommerce Coupons','wpai_woocommerce_addon_plugin');
|
10 |
-
if ( ! empty($custom_types['product_variation'])) unset($custom_types['product_variation']);
|
11 |
-
if ( ! empty($custom_types['shop_order_refund'])) unset($custom_types['shop_order_refund']);
|
12 |
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
{
|
19 |
-
if (isset($ordered_custom_types[$type])) continue;
|
20 |
|
21 |
-
|
22 |
-
{
|
23 |
-
if (isset($ordered_custom_types[$key])) continue;
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
42 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Filter custom post types and return them is needed order.
|
6 |
+
*
|
7 |
+
* @param $custom_types
|
8 |
+
*
|
9 |
+
* @return array
|
10 |
+
*/
|
11 |
+
function pmwi_pmxi_custom_types($custom_types) {
|
12 |
|
13 |
+
if (class_exists('WooCommerce')) {
|
14 |
+
if (!empty($custom_types['product'])) {
|
15 |
+
$custom_types['product']->labels->name = __('WooCommerce Products', PMWI_Plugin::TEXT_DOMAIN);
|
16 |
+
}
|
17 |
+
if (!empty($custom_types['shop_order'])) {
|
18 |
+
$custom_types['shop_order']->labels->name = __('WooCommerce Orders', PMWI_Plugin::TEXT_DOMAIN);
|
19 |
+
}
|
20 |
+
if (!empty($custom_types['shop_coupon'])) {
|
21 |
+
$custom_types['shop_coupon']->labels->name = __('WooCommerce Coupons', PMWI_Plugin::TEXT_DOMAIN);
|
22 |
+
}
|
23 |
+
if (!empty($custom_types['product_variation'])) {
|
24 |
+
unset($custom_types['product_variation']);
|
25 |
+
}
|
26 |
+
if (!empty($custom_types['shop_order_refund'])) {
|
27 |
+
unset($custom_types['shop_order_refund']);
|
28 |
+
}
|
29 |
|
30 |
+
$order = ['shop_order', 'shop_coupon', 'product'];
|
|
|
|
|
31 |
|
32 |
+
$ordered_custom_types = [];
|
|
|
|
|
33 |
|
34 |
+
foreach ($order as $type) {
|
35 |
+
if (isset($ordered_custom_types[$type])) {
|
36 |
+
continue;
|
37 |
+
}
|
38 |
+
foreach ($custom_types as $key => $custom_type) {
|
39 |
+
if (isset($ordered_custom_types[$key])) {
|
40 |
+
continue;
|
41 |
+
}
|
42 |
+
if (in_array($key, $order)) {
|
43 |
+
if ($key == $type) {
|
44 |
+
$ordered_custom_types[$key] = $custom_type;
|
45 |
+
}
|
46 |
+
}
|
47 |
+
else {
|
48 |
+
$ordered_custom_types[$key] = $custom_type;
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
return $ordered_custom_types;
|
53 |
+
}
|
54 |
+
return $custom_types;
|
55 |
}
|
filters/pmxi_options_validation.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @param $errors
|
4 |
+
* @param $post
|
5 |
+
* @param $importObj
|
6 |
+
*
|
7 |
+
* @return mixed
|
8 |
+
*/
|
9 |
+
function pmwi_pmxi_options_validation($errors, $post, $importObj) {
|
10 |
+
// Validate import template settings for variable products.
|
11 |
+
if (isset($post['multiple_product_type']) && $post['multiple_product_type'] == 'variable' && empty($post['link_all_variations'])) {
|
12 |
+
switch ($post['matching_parent']) {
|
13 |
+
case 'auto':
|
14 |
+
if (empty($post['single_product_id'])) {
|
15 |
+
$errors->add('form-validation', __('`SKU element for parent` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
16 |
+
}
|
17 |
+
if (empty($post['single_product_parent_id'])) {
|
18 |
+
$errors->add('form-validation', __('`Parent SKU element for variation` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
19 |
+
}
|
20 |
+
break;
|
21 |
+
case 'first_is_parent_id':
|
22 |
+
if (empty($post['single_product_id_first_is_parent_id'])) {
|
23 |
+
$errors->add('form-validation', __('`Unique Value` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
24 |
+
}
|
25 |
+
break;
|
26 |
+
case 'first_is_parent_title':
|
27 |
+
if (empty($post['single_product_id_first_is_parent_title'])) {
|
28 |
+
$errors->add('form-validation', __('`Product Title` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
29 |
+
}
|
30 |
+
break;
|
31 |
+
case 'first_is_variation':
|
32 |
+
if (empty($post['single_product_id_first_is_variation'])) {
|
33 |
+
$errors->add('form-validation', __('`Product Title` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
34 |
+
}
|
35 |
+
break;
|
36 |
+
case 'xml':
|
37 |
+
if (empty($post['variations_xpath'])) {
|
38 |
+
$errors->add('form-validation', __('`Variations XPath` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
39 |
+
}
|
40 |
+
break;
|
41 |
+
case 'existing':
|
42 |
+
if ($post['existing_parent_product_matching_logic'] == 'custom field') {
|
43 |
+
if (empty($post['existing_parent_product_cf_name'])) {
|
44 |
+
$errors->add('form-validation', __('`Custom Field Name` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
45 |
+
}
|
46 |
+
if (empty($post['existing_parent_product_cf_value'])) {
|
47 |
+
$errors->add('form-validation', __('`Custom Field Value` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
48 |
+
}
|
49 |
+
}
|
50 |
+
if ($post['existing_parent_product_matching_logic'] == 'title' && empty($post['existing_parent_product_title'])) {
|
51 |
+
$errors->add('form-validation', __('`Parent Title` must be specified on the Variations Tab', PMWI_Plugin::TEXT_DOMAIN));
|
52 |
+
}
|
53 |
+
break;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
return $errors;
|
57 |
+
}
|
filters/pmxi_unique_key.php
CHANGED
@@ -1,11 +1,15 @@
|
|
1 |
<?php
|
2 |
-
function pmwi_pmxi_unique_key( $unique_key, $options ){
|
3 |
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
|
|
6 |
$unique_key .= ( ! empty($options['attribute_value'])) ? implode('-', $options['attribute_value']) : '';
|
7 |
-
|
8 |
}
|
9 |
-
|
10 |
return $unique_key;
|
11 |
}
|
1 |
<?php
|
|
|
2 |
|
3 |
+
/**
|
4 |
+
* @param $unique_key
|
5 |
+
* @param $options
|
6 |
+
*
|
7 |
+
* @return string
|
8 |
+
*/
|
9 |
+
function pmwi_pmxi_unique_key($unique_key, $options) {
|
10 |
|
11 |
+
if ($options['custom_type'] == 'product') {
|
12 |
$unique_key .= ( ! empty($options['attribute_value'])) ? implode('-', $options['attribute_value']) : '';
|
|
|
13 |
}
|
|
|
14 |
return $unique_key;
|
15 |
}
|
filters/pmxi_visible_confirm_sections.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Filter sections visibility on import confirm screen.
|
6 |
+
*
|
7 |
+
* @param $sections
|
8 |
+
* @param $post_type
|
9 |
+
*
|
10 |
+
* @return array
|
11 |
+
*/
|
12 |
+
function pmwi_pmxi_visible_confirm_sections($sections, $post_type) {
|
13 |
+
// Render order's template only for bundle and import with WP All Import featured.
|
14 |
+
if ( 'shop_order' == $post_type && class_exists('WooCommerce') ) {
|
15 |
+
return array();
|
16 |
+
}
|
17 |
+
return $sections;
|
18 |
+
}
|
filters/pmxi_visible_options_sections.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Filter sections visibility on import options screen.
|
6 |
+
*
|
7 |
+
* @param $sections
|
8 |
+
* @param $post_type
|
9 |
+
*
|
10 |
+
* @return array
|
11 |
+
*/
|
12 |
+
function pmwi_pmxi_visible_options_sections( $sections, $post_type ) {
|
13 |
+
// Render order's options view only for bundle and import with WP All Import featured.
|
14 |
+
if ( 'shop_order' == $post_type && class_exists('WooCommerce') ) {
|
15 |
+
return array('settings');
|
16 |
+
}
|
17 |
+
return $sections;
|
18 |
+
}
|
filters/pmxi_visible_template_sections.php
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Filter sections visibility on import template screen.
|
6 |
+
*
|
7 |
+
* @param $sections
|
8 |
+
* @param $post_type
|
9 |
+
*
|
10 |
+
* @return array
|
11 |
+
*/
|
12 |
+
function pmwi_pmxi_visible_template_sections( $sections, $post_type ) {
|
13 |
+
// Render order's template only for bundle and import with WP All Import featured.
|
14 |
+
if ( 'shop_order' == $post_type && class_exists('WooCommerce') ) {
|
15 |
+
return array('main', 'cf');
|
16 |
+
}
|
17 |
+
return $sections;
|
18 |
+
}
|
filters/wp_all_import_existing_meta_keys.php
CHANGED
@@ -1,9 +1,16 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
$hide_fields = array('_regular_price_tmp', '_sale_price_tmp', '_sale_price_dates_from_tmp', '_sale_price_dates_from_tmp', '_sale_price_dates_to_tmp', '_price_tmp', '_stock_tmp', '_stock_status_tmp', '_product_image_gallery_tmp');
|
8 |
if (version_compare(WOOCOMMERCE_VERSION, '3.0') >= 0){
|
9 |
$hide_fields[] = '_stock_status';
|
@@ -11,9 +18,11 @@ function pmwi_wp_all_import_existing_meta_keys( $existing_meta_keys, $custom_typ
|
|
11 |
$hide_fields[] = '_featured';
|
12 |
}
|
13 |
foreach ($existing_meta_keys as $key => $value) {
|
14 |
-
if ( in_array($value, $hide_fields) || strpos($value, '_v_') === 0 )
|
|
|
|
|
15 |
}
|
16 |
$existing_meta_keys = array_values($existing_meta_keys);
|
17 |
-
|
18 |
-
|
19 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Filter available to import custom fields.
|
6 |
+
*
|
7 |
+
* @param $existing_meta_keys
|
8 |
+
* @param $custom_type
|
9 |
+
*
|
10 |
+
* @return array
|
11 |
+
*/
|
12 |
+
function pmwi_wp_all_import_existing_meta_keys($existing_meta_keys, $custom_type) {
|
13 |
+
if ( $custom_type == 'product') {
|
14 |
$hide_fields = array('_regular_price_tmp', '_sale_price_tmp', '_sale_price_dates_from_tmp', '_sale_price_dates_from_tmp', '_sale_price_dates_to_tmp', '_price_tmp', '_stock_tmp', '_stock_status_tmp', '_product_image_gallery_tmp');
|
15 |
if (version_compare(WOOCOMMERCE_VERSION, '3.0') >= 0){
|
16 |
$hide_fields[] = '_stock_status';
|
18 |
$hide_fields[] = '_featured';
|
19 |
}
|
20 |
foreach ($existing_meta_keys as $key => $value) {
|
21 |
+
if ( in_array($value, $hide_fields) || strpos($value, '_v_') === 0 ) {
|
22 |
+
unset($existing_meta_keys[$key]);
|
23 |
+
}
|
24 |
}
|
25 |
$existing_meta_keys = array_values($existing_meta_keys);
|
26 |
+
}
|
27 |
+
return $existing_meta_keys;
|
28 |
}
|
filters/wp_all_import_is_post_to_delete.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
*
|
5 |
+
* Check if product allowed to be deleted.
|
6 |
+
*
|
7 |
+
* @param $to_delete
|
8 |
+
* @param $pid
|
9 |
+
* @param $import
|
10 |
+
*
|
11 |
+
* @return bool
|
12 |
+
*/
|
13 |
+
function pmwi_wp_all_import_is_post_to_delete($to_delete, $pid, $import) {
|
14 |
+
if ( $import->options['custom_type'] == 'product') {
|
15 |
+
$post_to_delete = get_post($pid);
|
16 |
+
if ( $to_delete && $post_to_delete->post_type == 'product' && class_exists('WooCommerce')) {
|
17 |
+
$children = get_posts( array(
|
18 |
+
'post_parent' => $pid,
|
19 |
+
'posts_per_page'=> -1,
|
20 |
+
'post_type' => 'product_variation',
|
21 |
+
'fields' => 'ids',
|
22 |
+
'orderby' => 'ID',
|
23 |
+
'order' => 'ASC',
|
24 |
+
'post_status' => array('draft', 'publish', 'trash', 'pending', 'future', 'private')
|
25 |
+
) );
|
26 |
+
|
27 |
+
if ( count($children) ){
|
28 |
+
$to_delete = false;
|
29 |
+
$maybe_to_delete = get_option('wp_all_import_products_maybe_to_delete_' . $import->id, array());
|
30 |
+
if ( ! in_array($pid, $maybe_to_delete) ){
|
31 |
+
$maybe_to_delete[] = $pid;
|
32 |
+
update_option('wp_all_import_products_maybe_to_delete_' . $import->id, $maybe_to_delete);
|
33 |
+
}
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
return $to_delete;
|
38 |
+
}
|
helpers/pmwi_adjust_price.php
CHANGED
@@ -1,58 +1,18 @@
|
|
1 |
<?php
|
2 |
-
function pmwi_adjust_price( $price, $field, $options ){
|
3 |
-
|
4 |
-
switch ($field) {
|
5 |
-
case 'variable_regular_price':
|
6 |
-
case 'regular_price':
|
7 |
-
|
8 |
-
if ( ! empty($options['single_product_regular_price_adjust']) ){
|
9 |
-
|
10 |
-
switch ($options['single_product_regular_price_adjust_type']) {
|
11 |
-
case '%':
|
12 |
-
$price = ($price/100) * $options['single_product_regular_price_adjust'];
|
13 |
-
break;
|
14 |
-
|
15 |
-
case '$':
|
16 |
-
|
17 |
-
$price += (double) $options['single_product_regular_price_adjust'];
|
18 |
-
|
19 |
-
break;
|
20 |
-
}
|
21 |
-
|
22 |
-
$price = ( (double) $price > 0) ? number_format( (double) $price, 2, '.', '' ) : 0;
|
23 |
-
}
|
24 |
-
|
25 |
-
break;
|
26 |
-
case 'variable_sale_price':
|
27 |
-
case 'sale_price':
|
28 |
-
|
29 |
-
if ( ! empty($options['single_product_sale_price_adjust']) ){
|
30 |
-
|
31 |
-
switch ($options['single_product_sale_price_adjust_type']) {
|
32 |
-
case '%':
|
33 |
-
$price = ($price/100) * $options['single_product_sale_price_adjust'];
|
34 |
-
break;
|
35 |
-
|
36 |
-
case '$':
|
37 |
-
|
38 |
-
$price += (double) $options['single_product_sale_price_adjust'];
|
39 |
-
|
40 |
-
break;
|
41 |
-
}
|
42 |
-
|
43 |
-
$price = ( (double) $price > 0) ? number_format( (double) $price, 2, '.', '' ) : 0;
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
break;
|
48 |
-
|
49 |
-
/*default:
|
50 |
-
|
51 |
-
return $price;*/
|
52 |
-
|
53 |
-
break;
|
54 |
-
}
|
55 |
-
|
56 |
-
return $price;
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
/**
|
4 |
+
* Adjust price and prepare it to valid format.
|
5 |
+
*
|
6 |
+
* @param $price
|
7 |
+
* @param $field
|
8 |
+
* @param $options
|
9 |
+
*
|
10 |
+
* @return float|int|string
|
11 |
+
*
|
12 |
+
* @deprecated since @3.0.0
|
13 |
+
*/
|
14 |
+
function pmwi_adjust_price($price, $field, $options) {
|
15 |
+
return XmlImportWooCommerceService::getInstance()
|
16 |
+
->getPriceService()
|
17 |
+
->adjustPrice($price, $field, $options);
|
18 |
}
|
helpers/pmwi_prepare_price.php
CHANGED
@@ -1,63 +1,19 @@
|
|
1 |
<?php
|
2 |
-
function pmwi_prepare_price( $price, $disable_prepare_price, $prepare_price_to_woo_format, $convert_decimal_separator ){
|
3 |
-
|
4 |
-
if ( $disable_prepare_price ){
|
5 |
-
|
6 |
-
$price = preg_replace("/[^0-9\.,]/","", $price);
|
7 |
-
|
8 |
-
}
|
9 |
-
|
10 |
-
if ( $convert_decimal_separator and strlen($price) > 3)
|
11 |
-
{
|
12 |
-
$decimal_sep = get_option( 'woocommerce_price_decimal_sep', '.' );
|
13 |
-
$thousand_sep = get_option( 'woocommerce_price_thousand_sep', ',' );
|
14 |
-
|
15 |
-
$comma_position = strrpos($price, ",", strlen($price) - 3);
|
16 |
-
|
17 |
-
if ($comma_position !== false)
|
18 |
-
{
|
19 |
-
$price = str_replace(".", "", $price);
|
20 |
-
$comma_position = strrpos($price, ",");
|
21 |
-
$price = str_replace(",", "", substr_replace($price, ".", $comma_position, 1));
|
22 |
-
}
|
23 |
-
else
|
24 |
-
{
|
25 |
-
$comma_position = strrpos($price, ".", strlen($price) - 3);
|
26 |
-
if ($comma_position !== false)
|
27 |
-
{
|
28 |
-
$price = str_replace(",", "", $price);
|
29 |
-
}
|
30 |
-
elseif(strlen($price) > 4)
|
31 |
-
{
|
32 |
-
$comma_position = strrpos($price, ",", strlen($price) - 4);
|
33 |
-
|
34 |
-
if ($comma_position and strlen($price) - $comma_position == 4)
|
35 |
-
{
|
36 |
-
$price = str_replace(",", "", $price);
|
37 |
-
}
|
38 |
-
else
|
39 |
-
{
|
40 |
-
$comma_position = strrpos($price, ".", strlen($price) - 4);
|
41 |
-
|
42 |
-
if ($comma_position and strlen($price) - $comma_position == 4)
|
43 |
-
{
|
44 |
-
$price = str_replace(".", "", $price);
|
45 |
-
}
|
46 |
-
}
|
47 |
-
}
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
if ( $prepare_price_to_woo_format ){
|
52 |
-
|
53 |
-
$price = str_replace(",", ".", $price);
|
54 |
-
|
55 |
-
$price = str_replace(",", ".", str_replace(".", "", preg_replace("%\.([0-9]){1,2}?$%", ",$0", $price)));
|
56 |
-
|
57 |
-
$price = ("" != $price) ? number_format( (double) $price, 2, '.', '' ) : "";
|
58 |
-
|
59 |
-
}
|
60 |
-
|
61 |
-
return apply_filters('pmxi_price', $price);
|
62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
}
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
/**
|
4 |
+
* Prepare price to valid format.
|
5 |
+
*
|
6 |
+
* @param $price
|
7 |
+
* @param $disable_prepare_price
|
8 |
+
* @param $prepare_price_to_woo_format
|
9 |
+
* @param $convert_decimal_separator
|
10 |
+
*
|
11 |
+
* @return float|int|string
|
12 |
+
*
|
13 |
+
* @deprecated since @3.0.0
|
14 |
+
*/
|
15 |
+
function pmwi_prepare_price($price, $disable_prepare_price, $prepare_price_to_woo_format, $convert_decimal_separator) {
|
16 |
+
return XmlImportWooCommerceService::getInstance()
|
17 |
+
->getPriceService()
|
18 |
+
->preparePrice($price, $disable_prepare_price, $prepare_price_to_woo_format, $convert_decimal_separator);
|
19 |
}
|
i18n/languages/wpai_woocommerce_addon_plugin-ja.mo
CHANGED
File without changes
|
i18n/languages/wpai_woocommerce_addon_plugin-ja.po
CHANGED
File without changes
|
libraries/XmlImportWooCommerce.php
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use wpai_woocommerce_add_on\libraries\importer\Importer;
|
4 |
+
use wpai_woocommerce_add_on\libraries\parser\ParserInterface;
|
5 |
+
|
6 |
+
require_once dirname(__FILE__) . '/XmlImportWooCommerceInterface.php';
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class XmlImportWooCommerce
|
10 |
+
*/
|
11 |
+
abstract class XmlImportWooCommerce implements XmlImportWooCommerceInterface {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var ParserInterface
|
15 |
+
*/
|
16 |
+
public $parser;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var Importer
|
20 |
+
*/
|
21 |
+
public $importer;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var
|
25 |
+
*/
|
26 |
+
public $import;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var
|
30 |
+
*/
|
31 |
+
public $xml;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var
|
35 |
+
*/
|
36 |
+
public $logger;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var
|
40 |
+
*/
|
41 |
+
public $count;
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @var
|
45 |
+
*/
|
46 |
+
public $chunk;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @var
|
50 |
+
*/
|
51 |
+
public $xpath;
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @var
|
55 |
+
*/
|
56 |
+
public $wpdb;
|
57 |
+
|
58 |
+
/**
|
59 |
+
* @var
|
60 |
+
*/
|
61 |
+
public $data;
|
62 |
+
|
63 |
+
/**
|
64 |
+
* @var bool
|
65 |
+
*/
|
66 |
+
public $articleData = FALSE;
|
67 |
+
|
68 |
+
/**
|
69 |
+
* XmlImportWooCommerceShopOrder constructor.
|
70 |
+
* @param $options
|
71 |
+
*/
|
72 |
+
public function __construct($options) {
|
73 |
+
global $wpdb;
|
74 |
+
$this->import = $options['import'];
|
75 |
+
$this->count = $options['count'];
|
76 |
+
$this->xml = $options['xml'];
|
77 |
+
$this->logger = $options['logger'];
|
78 |
+
$this->chunk = $options['chunk'];
|
79 |
+
$this->xpath = $options['xpath_prefix'];
|
80 |
+
$this->wpdb = $wpdb;
|
81 |
+
}
|
82 |
+
}
|
libraries/XmlImportWooCommerceInterface.php
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Interface XmlImportWooCommerceInterface
|
5 |
+
*/
|
6 |
+
interface XmlImportWooCommerceInterface {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @return mixed
|
10 |
+
*/
|
11 |
+
public function parse();
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @param $importData
|
15 |
+
* @return mixed
|
16 |
+
*/
|
17 |
+
public function import($importData);
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @param $importData
|
21 |
+
* @return mixed
|
22 |
+
*/
|
23 |
+
public function after_save_post($importData);
|
24 |
+
}
|
libraries/XmlImportWooCommerceProduct.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use wpai_woocommerce_add_on\libraries\helpers\ImporterOptions;
|
4 |
+
use wpai_woocommerce_add_on\libraries\importer\ImporterIndex;
|
5 |
+
use wpai_woocommerce_add_on\libraries\importer\ImportProductBase;
|
6 |
+
use wpai_woocommerce_add_on\libraries\importer\ProductsActions;
|
7 |
+
use wpai_woocommerce_add_on\libraries\importer\ProductsImporter;
|
8 |
+
use wpai_woocommerce_add_on\libraries\parser\ParserFactory;
|
9 |
+
|
10 |
+
require_once dirname(__FILE__) . '/XmlImportWooCommerce.php';
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Class XmlImportWooCommerceProduct
|
14 |
+
*/
|
15 |
+
class XmlImportWooCommerceProduct extends XmlImportWooCommerce{
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @var ProductsActions
|
19 |
+
*/
|
20 |
+
public $actions;
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var ImporterIndex
|
24 |
+
*/
|
25 |
+
public $index;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var
|
29 |
+
*/
|
30 |
+
public $previousID;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var ProductsImporter
|
34 |
+
*/
|
35 |
+
public $importer;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* XmlImportWooCommerceProduct constructor.
|
39 |
+
*
|
40 |
+
* @param $options
|
41 |
+
*/
|
42 |
+
public function __construct($options) {
|
43 |
+
parent::__construct($options);
|
44 |
+
$this->parser = ParserFactory::generate('products', $options);
|
45 |
+
$this->actions = new ProductsActions($this->parser);
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @return mixed
|
50 |
+
*/
|
51 |
+
public function parse() {
|
52 |
+
$this->data = $this->parser->parse();
|
53 |
+
return $this->data;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @param $importData
|
58 |
+
*/
|
59 |
+
public function import($importData) {
|
60 |
+
$this->index = new ImporterIndex($importData['pid'], $importData['i'], $importData['articleData']);
|
61 |
+
$this->importer = new ProductsImporter($this->index, new ImporterOptions($this->parser));
|
62 |
+
$this->actions->setImporter($this->importer);
|
63 |
+
$this->importer->import();
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param $importData
|
68 |
+
*
|
69 |
+
* @throws \Exception
|
70 |
+
*/
|
71 |
+
public function after_save_post($importData) {
|
72 |
+
$this->importer->afterPostImport();
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @return ImportProductBase
|
77 |
+
*/
|
78 |
+
public function getImporterEngine() {
|
79 |
+
return $this->importer->importEngine;
|
80 |
+
}
|
81 |
+
}
|
libraries/XmlImportWooCommerceService.php
ADDED
@@ -0,0 +1,519 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class XmlImportWooCommerceService
|
5 |
+
*/
|
6 |
+
final class XmlImportWooCommerceService {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Singletone instance
|
10 |
+
* @var XmlImportWooCommerceService
|
11 |
+
*/
|
12 |
+
protected static $instance;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Product custom field name to keep information about is product
|
16 |
+
* was created or updated by import.
|
17 |
+
*
|
18 |
+
*/
|
19 |
+
const FLAG_IS_NEW_PRODUCT = '__is_newly_created_product';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Store all originally parsed data in product meta.
|
23 |
+
*/
|
24 |
+
const PARSED_DATA_KEY = '__originally_parsed_data';
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Store ID of variation created from parent row in product meta.
|
28 |
+
*/
|
29 |
+
const FIRST_VARIATION = '__first_variation_id';
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var XmlImportWooTaxonomyService
|
33 |
+
*/
|
34 |
+
public $taxonomiesService;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var XmlImportWooPriceService
|
38 |
+
*/
|
39 |
+
public $priceService;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var \PMXI_Image_Record
|
43 |
+
*/
|
44 |
+
public $import;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @var array
|
48 |
+
*/
|
49 |
+
public $product_taxonomies;
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Return singletone instance
|
53 |
+
* @return XmlImportWooCommerceService
|
54 |
+
*/
|
55 |
+
static public function getInstance() {
|
56 |
+
if (self::$instance == NULL) {
|
57 |
+
self::$instance = new self();
|
58 |
+
}
|
59 |
+
self::$instance->setImport();
|
60 |
+
return self::$instance;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* XmlImportWooCommerceService constructor.
|
65 |
+
*/
|
66 |
+
protected function __construct() {
|
67 |
+
try {
|
68 |
+
// Init current import instance.
|
69 |
+
$this->setImport();
|
70 |
+
$this->taxonomiesService = new XmlImportWooTaxonomyService($this->import);
|
71 |
+
$this->priceService = new XmlImportWooPriceService($this->import);
|
72 |
+
$taxonomies = array('post_format', 'product_type', 'product_shipping_class', 'product_visibility');
|
73 |
+
$taxonomies = apply_filters('wp_all_import_variation_taxonomies', $taxonomies);
|
74 |
+
$this->product_taxonomies = array_diff_key(get_taxonomies_by_object_type(array('product'), 'object'), array_flip($taxonomies));
|
75 |
+
}
|
76 |
+
catch(\Exception $e) {
|
77 |
+
self::getLogger() && call_user_func(self::getLogger(), '<b>ERROR:</b> ' . $e->getMessage());
|
78 |
+
}
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Init import object form request data.
|
83 |
+
*/
|
84 |
+
public function setImport() {
|
85 |
+
// Init current import instance.
|
86 |
+
$this->import = new PMXI_Import_Record();
|
87 |
+
$input = new PMXI_Input();
|
88 |
+
$importID = $input->get('id');
|
89 |
+
if (empty($importID)) {
|
90 |
+
$importID = $input->get('import_id');
|
91 |
+
}
|
92 |
+
if (empty($importID)) {
|
93 |
+
$importID = \PMXI_Plugin::$session->import_id;
|
94 |
+
}
|
95 |
+
if ($importID && ($this->import->isEmpty() || $this->import->id != $importID)) {
|
96 |
+
$this->import->getById($importID);
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @return \XmlImportWooTaxonomyService
|
102 |
+
*/
|
103 |
+
public function getTaxonomiesService() {
|
104 |
+
return $this->taxonomiesService;
|
105 |
+
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
* @return \XmlImportWooPriceService
|
109 |
+
*/
|
110 |
+
public function getPriceService() {
|
111 |
+
return $this->priceService;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* @return \PMXI_Image_Record
|
116 |
+
*/
|
117 |
+
public function getImport() {
|
118 |
+
return $this->import;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* @return array
|
123 |
+
*/
|
124 |
+
public function getProductTaxonomies() {
|
125 |
+
return $this->product_taxonomies;
|
126 |
+
}
|
127 |
+
|
128 |
+
/**
|
129 |
+
* @param $productID
|
130 |
+
*
|
131 |
+
* @return mixed
|
132 |
+
*/
|
133 |
+
public function getAllOriginallyParsedData($productID) {
|
134 |
+
$data = get_post_meta($productID, self::PARSED_DATA_KEY, true);
|
135 |
+
return $data;
|
136 |
+
}
|
137 |
+
|
138 |
+
/**
|
139 |
+
* @param $productID
|
140 |
+
* @param $key
|
141 |
+
*
|
142 |
+
* @return mixed
|
143 |
+
*/
|
144 |
+
public function getOriginallyParsedData($productID, $key) {
|
145 |
+
$data = $this->getAllOriginallyParsedData($productID);
|
146 |
+
return isset($data[$key]) ? $data[$key] : NULL;
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Sync parent product prices & attributes with variations.
|
151 |
+
*
|
152 |
+
* @param $parentID
|
153 |
+
*/
|
154 |
+
public function syncVariableProductData($parentID) {
|
155 |
+
$product = new \WC_Product_Variable($parentID);
|
156 |
+
$variations = array();
|
157 |
+
$variationIDs = $product->get_children();
|
158 |
+
// Collect product variations.
|
159 |
+
foreach ($variationIDs as $key => $variationID) {
|
160 |
+
$variations[] = new \WC_Product_Variation($variationID);
|
161 |
+
}
|
162 |
+
$parentAttributes = get_post_meta($product->get_id(), '_product_attributes', TRUE);
|
163 |
+
// Sync attribute terms with parent product.
|
164 |
+
if (!empty($parentAttributes)) {
|
165 |
+
foreach ($parentAttributes as $name => $parentAttribute) {
|
166 |
+
// Only in case if attribute marked to import as taxonomy terms.
|
167 |
+
if ($parentAttribute['is_taxonomy']) {
|
168 |
+
$terms = explode("|", $parentAttribute['value']);
|
169 |
+
$terms = array_filter($terms);
|
170 |
+
if (!empty($terms)) {
|
171 |
+
$this->getTaxonomiesService()->associateTerms($parentID, $terms, $name);
|
172 |
+
}
|
173 |
+
}
|
174 |
+
}
|
175 |
+
}
|
176 |
+
// Sync parent product with variation if at least one variation exist.
|
177 |
+
if (!empty($variations)) {
|
178 |
+
/** @var WC_Product_Variable_Data_Store_CPT $data_store */
|
179 |
+
if (!$this->getImport()->options['link_all_variations'] && (count($variationIDs) > 1 || !$this->getImport()->options['make_simple_product'])) {
|
180 |
+
$data_store = WC_Data_Store::load( 'product-' . $product->get_type() );
|
181 |
+
$data_store->sync_price( $product );
|
182 |
+
$data_store->sync_stock_status( $product );
|
183 |
+
}
|
184 |
+
// Set product default attributes.
|
185 |
+
if ($this->isUpdateDataAllowed('is_update_attributes') && $this->getImport()->options['is_default_attributes']) {
|
186 |
+
$defaultVariation = FALSE;
|
187 |
+
// Set first variation as the default selection.
|
188 |
+
if ($this->getImport()->options['default_attributes_type'] == 'first') {
|
189 |
+
$defaultVariation = array_shift($variations);
|
190 |
+
}
|
191 |
+
// Set first in stock variation as the default selection.
|
192 |
+
if ($this->getImport()->options['default_attributes_type'] == 'instock') {
|
193 |
+
/** @var \WC_Product_Variation $variation */
|
194 |
+
foreach ($variations as $variation) {
|
195 |
+
if ($variation->is_in_stock()) {
|
196 |
+
$defaultVariation = $variation;
|
197 |
+
break;
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
$defaultAttributes = $defaultVariation ? $defaultVariation->get_attributes() : array();
|
202 |
+
$product->set_default_attributes($defaultAttributes);
|
203 |
+
}
|
204 |
+
$product->save();
|
205 |
+
}
|
206 |
+
// Sync custom fields for variation created from parent row.
|
207 |
+
$firstVariationID = get_post_meta($product->get_id(), self::FIRST_VARIATION, TRUE);
|
208 |
+
if ($firstVariationID) {
|
209 |
+
$parentMeta = get_post_meta($product->get_id(), '');
|
210 |
+
foreach ($this->getImport()->options['custom_name'] as $customFieldName) {
|
211 |
+
if ($this->isUpdateCustomField($customFieldName)) {
|
212 |
+
update_post_meta($firstVariationID, $customFieldName, $parentMeta[$customFieldName][0]);
|
213 |
+
}
|
214 |
+
}
|
215 |
+
// Sync all ACF fields.
|
216 |
+
foreach ($parentMeta as $parentMetaKey => $parentMetaValue) {
|
217 |
+
if (strpos($parentMetaValue[0], 'field_') === 0) {
|
218 |
+
update_post_meta($firstVariationID, $parentMetaKey, $parentMetaValue[0]);
|
219 |
+
$acfFieldKey = preg_replace("%^_(.*)%", "$1", $parentMetaKey);
|
220 |
+
foreach ($parentMeta as $key => $value) {
|
221 |
+
if (strpos($key, $acfFieldKey) === 0) {
|
222 |
+
update_post_meta($firstVariationID, $key, $value[0]);
|
223 |
+
}
|
224 |
+
}
|
225 |
+
}
|
226 |
+
}
|
227 |
+
}
|
228 |
+
|
229 |
+
update_post_meta($product->get_id(), '_product_attributes', $parentAttributes);
|
230 |
+
// Make product simple it has less than minimum number of variations.
|
231 |
+
$minimumVariations = apply_filters('wp_all_import_minimum_number_of_variations', 2, $product->get_id(), $this->getImport()->id);
|
232 |
+
if (count($variationIDs) < $minimumVariations) {
|
233 |
+
$this->maybeMakeProductSimple($product, $variationIDs);
|
234 |
+
}
|
235 |
+
do_action('wp_all_import_variable_product_imported', $product->get_id());
|
236 |
+
// Delete originally parsed data, which was temporary stored in
|
237 |
+
// product meta.
|
238 |
+
delete_post_meta($product->get_id(), self::PARSED_DATA_KEY);
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* Convert variable product into simple.
|
243 |
+
*
|
244 |
+
* @param $product \WC_Product_Variable
|
245 |
+
* @param $variationIDs
|
246 |
+
*/
|
247 |
+
public function maybeMakeProductSimple($product, $variationIDs) {
|
248 |
+
$isNewProduct = get_post_meta($product->get_id(), self::FLAG_IS_NEW_PRODUCT, true);
|
249 |
+
if ($this->isUpdateDataAllowed('is_update_product_type', $isNewProduct) && $this->getImport()->options['make_simple_product']) {
|
250 |
+
do_action('wp_all_import_before_make_product_simple', $product->get_id(), $this->getImport()->id);
|
251 |
+
$product_type_term = is_exists_term('simple', 'product_type', 0);
|
252 |
+
if (!empty($product_type_term) && !is_wp_error($product_type_term)) {
|
253 |
+
$this->getTaxonomiesService()->associateTerms($product->get_id(), array( (int) $product_type_term['term_taxonomy_id'] ), 'product_type');
|
254 |
+
}
|
255 |
+
}
|
256 |
+
// Sync prices after conversion to simple product or if product has less than 2 variations.
|
257 |
+
$getPricesFromFirstVariation = apply_filters('wp_all_import_get_prices_from_first_variation', FALSE, $product->get_id(), $this->getImport()->id);
|
258 |
+
$parsedData = $this->getAllOriginallyParsedData($product->get_id());
|
259 |
+
if ($getPricesFromFirstVariation && !empty($variationIDs)) {
|
260 |
+
$firstVariationID = get_post_meta($product->get_id(), self::FIRST_VARIATION, TRUE);
|
261 |
+
$parsedData['regular_price'] = get_post_meta($firstVariationID, '_regular_price', TRUE);
|
262 |
+
$parsedData['sale_price'] = get_post_meta($firstVariationID, '_sale_price', TRUE);
|
263 |
+
$price = get_post_meta($firstVariationID, '_price', TRUE);
|
264 |
+
}
|
265 |
+
if (!empty($parsedData)) {
|
266 |
+
if (empty($variationIDs)) {
|
267 |
+
// Sync product data in case variations weren't created for this product.
|
268 |
+
$simpleProduct = new \WC_Product_Simple($product->get_id());
|
269 |
+
$simpleProduct->set_stock_status($parsedData['stock_status']);
|
270 |
+
$simpleProduct->save();
|
271 |
+
}
|
272 |
+
if (empty($price)) {
|
273 |
+
$price = isset($parsedData['sale_price']) ? $parsedData['sale_price'] : '';
|
274 |
+
if ($price == '' && isset($parsedData['regular_price'])) {
|
275 |
+
$price = $parsedData['regular_price'];
|
276 |
+
}
|
277 |
+
}
|
278 |
+
if (isset($parsedData['regular_price'])) {
|
279 |
+
XmlImportWooCommerceService::getInstance()->pushMeta($product->get_id(), '_regular_price', $parsedData['regular_price'], $isNewProduct);
|
280 |
+
}
|
281 |
+
if (isset($parsedData['sale_price'])) {
|
282 |
+
XmlImportWooCommerceService::getInstance()->pushMeta($product->get_id(), '_sale_price', $parsedData['sale_price'], $isNewProduct);
|
283 |
+
}
|
284 |
+
XmlImportWooCommerceService::getInstance()->pushMeta($product->get_id(), '_price', $price, $isNewProduct);
|
285 |
+
// Recover original SKU.
|
286 |
+
if (isset($parsedData['original_sku']) && $this->getImport()->options['make_simple_product']) {
|
287 |
+
XmlImportWooCommerceService::getInstance()->pushMeta($product->get_id(), '_sku', $parsedData['original_sku'], $isNewProduct);
|
288 |
+
}
|
289 |
+
}
|
290 |
+
if ($this->isUpdateDataAllowed('is_update_product_type', $isNewProduct) && $this->getImport()->options['make_simple_product']) {
|
291 |
+
try {
|
292 |
+
$stock_quantity = get_post_meta($product->get_id(), '_stock', TRUE);
|
293 |
+
$data_store = WC_Data_Store::load( 'product' );
|
294 |
+
$data_store->update_product_stock( $product->get_id(), $stock_quantity, 'set' );
|
295 |
+
}
|
296 |
+
catch(\Exception $e) {
|
297 |
+
self::getLogger() && call_user_func(self::getLogger(), '<b>ERROR:</b> ' . $e->getMessage());
|
298 |
+
}
|
299 |
+
do_action('wp_all_import_make_product_simple', $product->get_id(), $this->getImport()->id);
|
300 |
+
}
|
301 |
+
}
|
302 |
+
|
303 |
+
/**
|
304 |
+
* Get All orders IDs for a given product ID.
|
305 |
+
*
|
306 |
+
* @param integer $product_id (required)
|
307 |
+
* @return array
|
308 |
+
*/
|
309 |
+
public function getOrdersIdsByProductId( $product_id ){
|
310 |
+
global $wpdb;
|
311 |
+
$results = $wpdb->get_col("
|
312 |
+
SELECT order_items.order_id
|
313 |
+
FROM {$wpdb->prefix}woocommerce_order_items as order_items
|
314 |
+
LEFT JOIN {$wpdb->prefix}woocommerce_order_itemmeta as order_item_meta ON order_items.order_item_id = order_item_meta.order_item_id
|
315 |
+
LEFT JOIN {$wpdb->posts} AS posts ON order_items.order_id = posts.ID
|
316 |
+
WHERE posts.post_type = 'shop_order'
|
317 |
+
AND order_items.order_item_type = 'line_item'
|
318 |
+
AND order_item_meta.meta_key = '_product_id'
|
319 |
+
AND order_item_meta.meta_value = '$product_id'
|
320 |
+
");
|
321 |
+
return $results;
|
322 |
+
}
|
323 |
+
|
324 |
+
/**
|
325 |
+
* @param string $option
|
326 |
+
* @param bool $isNewProduct
|
327 |
+
* @return bool
|
328 |
+
*/
|
329 |
+
public function isUpdateDataAllowed($option = '', $isNewProduct = TRUE) {
|
330 |
+
// Allow update data for newly created products.
|
331 |
+
if ($isNewProduct) {
|
332 |
+
return TRUE;
|
333 |
+
}
|
334 |
+
// `Update existing posts with changed data in your file` option disabled.
|
335 |
+
if ($this->getImport()->options['is_keep_former_posts'] == 'yes') {
|
336 |
+
return FALSE;
|
337 |
+
}
|
338 |
+
// `Update all data` option enabled
|
339 |
+
if ($this->getImport()->options['update_all_data'] == 'yes') {
|
340 |
+
return TRUE;
|
341 |
+
}
|
342 |
+
if (in_array($option, array('is_update_catalog_visibility', 'is_update_featured_status')) && empty($this->getImport()->options['is_update_advanced_options'])) {
|
343 |
+
return FALSE;
|
344 |
+
}
|
345 |
+
|
346 |
+
return empty($this->getImport()->options[$option]) ? FALSE : TRUE;
|
347 |
+
}
|
348 |
+
|
349 |
+
/**
|
350 |
+
* @param $tx_name
|
351 |
+
* @param bool $isNewProduct
|
352 |
+
* @return bool
|
353 |
+
*/
|
354 |
+
public function isUpdateTaxonomy($tx_name, $isNewProduct = TRUE) {
|
355 |
+
|
356 |
+
if (!$isNewProduct) {
|
357 |
+
if ($this->getImport()->options['update_all_data'] == 'yes'){
|
358 |
+
return TRUE;
|
359 |
+
}
|
360 |
+
if ( ! $this->getImport()->options['is_update_categories'] ) {
|
361 |
+
return FALSE;
|
362 |
+
}
|
363 |
+
if ($this->getImport()->options['update_all_data'] == "no" && $this->getImport()->options['update_categories_logic'] == "all_except" && !empty($this->getImport()->options['taxonomies_list'])
|
364 |
+
&& is_array($this->getImport()->options['taxonomies_list']) && in_array($tx_name, $this->getImport()->options['taxonomies_list'])) {
|
365 |
+
return FALSE;
|
366 |
+
}
|
367 |
+
if ($this->getImport()->options['update_all_data'] == "no" && $this->getImport()->options['update_categories_logic'] == "only" && ((!empty($this->getImport()->options['taxonomies_list'])
|
368 |
+
&& is_array($this->getImport()->options['taxonomies_list']) && ! in_array($tx_name, $this->getImport()->options['taxonomies_list'])) || empty($this->getImport()->options['taxonomies_list']))) {
|
369 |
+
return FALSE;
|
370 |
+
}
|
371 |
+
}
|
372 |
+
return TRUE;
|
373 |
+
}
|
374 |
+
|
375 |
+
/**
|
376 |
+
* @param $attributeName
|
377 |
+
* @param bool $isNewProduct
|
378 |
+
*
|
379 |
+
* @return bool
|
380 |
+
*/
|
381 |
+
public function isUpdateAttribute($attributeName, $pid, $isNewProduct = TRUE) {
|
382 |
+
$is_update_attributes = TRUE;
|
383 |
+
// Update only these Attributes, leave the rest alone.
|
384 |
+
if ( ! $isNewProduct && $this->getImport()->options['update_all_data'] == "no" && $this->getImport()->options['is_update_attributes'] && $this->getImport()->options['update_attributes_logic'] == 'only') {
|
385 |
+
if ( ! empty($this->getImport()->options['attributes_list']) && is_array($this->getImport()->options['attributes_list'])) {
|
386 |
+
if ( ! in_array( $attributeName , array_filter($this->getImport()->options['attributes_list'], 'trim'))) {
|
387 |
+
$is_update_attributes = FALSE;
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
// Leave these attributes alone, update all other Attributes.
|
392 |
+
if ( ! $isNewProduct && $this->getImport()->options['update_all_data'] == "no" && $this->getImport()->options['is_update_attributes'] && $this->getImport()->options['update_attributes_logic'] == 'all_except') {
|
393 |
+
if ( ! empty($this->getImport()->options['attributes_list']) && is_array($this->getImport()->options['attributes_list'])) {
|
394 |
+
if ( in_array( $attributeName , array_filter($this->getImport()->options['attributes_list'], 'trim'))) {
|
395 |
+
$is_update_attributes = FALSE;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
}
|
399 |
+
return $is_update_attributes;
|
400 |
+
}
|
401 |
+
|
402 |
+
/**
|
403 |
+
* @param $meta_key
|
404 |
+
* @return bool
|
405 |
+
*/
|
406 |
+
public function isUpdateCustomField($meta_key) {
|
407 |
+
|
408 |
+
$options = $this->getImport()->options;
|
409 |
+
|
410 |
+
if ($options['update_all_data'] == 'yes') {
|
411 |
+
return TRUE;
|
412 |
+
}
|
413 |
+
|
414 |
+
if (!$options['is_update_custom_fields']) {
|
415 |
+
return FALSE;
|
416 |
+
}
|
417 |
+
|
418 |
+
if ($options['update_custom_fields_logic'] == "full_update") {
|
419 |
+
return TRUE;
|
420 |
+
}
|
421 |
+
if ($options['update_custom_fields_logic'] == "only"
|
422 |
+
&& !empty($options['custom_fields_list'])
|
423 |
+
&& is_array($options['custom_fields_list'])
|
424 |
+
&& in_array($meta_key, $options['custom_fields_list'])
|
425 |
+
) {
|
426 |
+
return TRUE;
|
427 |
+
}
|
428 |
+
if ($options['update_custom_fields_logic'] == "all_except"
|
429 |
+
&& (empty($options['custom_fields_list']) || !in_array($meta_key, $options['custom_fields_list']))
|
430 |
+
) {
|
431 |
+
return TRUE;
|
432 |
+
}
|
433 |
+
|
434 |
+
return FALSE;
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* @param $pid
|
439 |
+
* @param $meta_key
|
440 |
+
* @param $meta_value
|
441 |
+
* @param bool $isNewPost
|
442 |
+
* @return mixed
|
443 |
+
*/
|
444 |
+
public function pushMeta($pid, $meta_key, $meta_value, $isNewPost = TRUE) {
|
445 |
+
if (!empty($meta_key) && ($isNewPost || $this->isUpdateCustomField($meta_key))) {
|
446 |
+
update_post_meta($pid, $meta_key, $meta_value);
|
447 |
+
}
|
448 |
+
}
|
449 |
+
|
450 |
+
/**
|
451 |
+
* @param $input
|
452 |
+
* @return array
|
453 |
+
*/
|
454 |
+
public static function arrayCartesian($input) {
|
455 |
+
|
456 |
+
$result = array();
|
457 |
+
|
458 |
+
while ( list( $key, $values ) = each( $input ) ) {
|
459 |
+
// If a sub-array is empty, it doesn't affect the cartesian product
|
460 |
+
if ( empty( $values ) ) {
|
461 |
+
continue;
|
462 |
+
}
|
463 |
+
|
464 |
+
// Special case: seeding the product array with the values from the first sub-array
|
465 |
+
if ( empty( $result ) ) {
|
466 |
+
foreach ( $values as $value ) {
|
467 |
+
$result[] = array( $key => $value );
|
468 |
+
}
|
469 |
+
}
|
470 |
+
else {
|
471 |
+
// Second and subsequent input sub-arrays work like this:
|
472 |
+
// 1. In each existing array inside $product, add an item with
|
473 |
+
// key == $key and value == first item in input sub-array
|
474 |
+
// 2. Then, for each remaining item in current input sub-array,
|
475 |
+
// add a copy of each existing array inside $product with
|
476 |
+
// key == $key and value == first item in current input sub-array
|
477 |
+
|
478 |
+
// Store all items to be added to $product here; adding them on the spot
|
479 |
+
// inside the foreach will result in an infinite loop
|
480 |
+
$append = array();
|
481 |
+
foreach( $result as &$product ) {
|
482 |
+
// Do step 1 above. array_shift is not the most efficient, but it
|
483 |
+
// allows us to iterate over the rest of the items with a simple
|
484 |
+
// foreach, making the code short and familiar.
|
485 |
+
$product[ $key ] = array_shift( $values );
|
486 |
+
|
487 |
+
// $product is by reference (that's why the key we added above
|
488 |
+
// will appear in the end result), so make a copy of it here
|
489 |
+
$copy = $product;
|
490 |
+
|
491 |
+
// Do step 2 above.
|
492 |
+
foreach( $values as $item ) {
|
493 |
+
$copy[ $key ] = $item;
|
494 |
+
$append[] = $copy;
|
495 |
+
}
|
496 |
+
|
497 |
+
// Undo the side effecst of array_shift
|
498 |
+
array_unshift( $values, $product[ $key ] );
|
499 |
+
}
|
500 |
+
|
501 |
+
// Out of the foreach, we can add to $results now
|
502 |
+
$result = array_merge( $result, $append );
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
return $result;
|
507 |
+
}
|
508 |
+
|
509 |
+
/**
|
510 |
+
* @return bool|\Closure
|
511 |
+
*/
|
512 |
+
public static function getLogger() {
|
513 |
+
$logger = FALSE;
|
514 |
+
if (PMXI_Plugin::is_ajax()) {
|
515 |
+
$logger = function($m) {echo "<div class='progress-msg'>[". date("H:i:s") ."] $m</div>\n";flush();};
|
516 |
+
}
|
517 |
+
return $logger;
|
518 |
+
}
|
519 |
+
}
|
libraries/XmlImportWooCommerceShopOrder.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
use wpai_woocommerce_add_on\libraries\helpers\ImporterOptions;
|
4 |
+
use wpai_woocommerce_add_on\libraries\importer\ImporterIndex;
|
5 |
+
use wpai_woocommerce_add_on\libraries\importer\OrderActions;
|
6 |
+
use wpai_woocommerce_add_on\libraries\importer\OrdersImporter;
|
7 |
+
use wpai_woocommerce_add_on\libraries\parser\ParserFactory;
|
8 |
+
|
9 |
+
require_once dirname(__FILE__) . '/XmlImportWooCommerce.php';
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Class XmlImportWooCommerceShopOrder
|
13 |
+
*/
|
14 |
+
class XmlImportWooCommerceShopOrder extends XmlImportWooCommerce {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var OrderActions
|
18 |
+
*/
|
19 |
+
public $actions;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var ImporterIndex
|
23 |
+
*/
|
24 |
+
public $index;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var OrdersImporter
|
28 |
+
*/
|
29 |
+
public $importer;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* XmlImportWooCommerceShopOrder constructor.
|
33 |
+
* @param $options
|
34 |
+
*/
|
35 |
+
public function __construct($options) {
|
36 |
+
parent::__construct($options);
|
37 |
+
$this->parser = ParserFactory::generate('orders', $options);
|
38 |
+
$this->actions = new OrderActions($this->parser);
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @return mixed
|
43 |
+
*/
|
44 |
+
public function parse() {
|
45 |
+
$this->data = $this->parser->parse();
|
46 |
+
return $this->data;
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @param $importData
|
51 |
+
*/
|
52 |
+
public function import($importData) {
|
53 |
+
|
54 |
+
$order_id = $importData['pid'];
|
55 |
+
|
56 |
+
$this->index = new ImporterIndex($order_id, $importData['i'], $importData['articleData']);
|
57 |
+
$this->importer = new OrdersImporter($this->index, new ImporterOptions($this->parser));
|
58 |
+
$this->actions->setImporter($this->importer);
|
59 |
+
$this->importer->import();
|
60 |
+
|
61 |
+
// Generate order unique key in case it doesn't exist.
|
62 |
+
$order_key = get_post_meta($order_id, '_order_key', true);
|
63 |
+
if (empty($order_key)) {
|
64 |
+
update_post_meta($order_id, '_order_key', 'wc_' . apply_filters( 'woocommerce_generate_order_key', uniqid( 'order_' ) ));
|
65 |
+
}
|
66 |
+
|
67 |
+
update_post_meta($order_id, '_order_version', WC()->version);
|
68 |
+
$_order_tax = get_post_meta($order_id, '_order_tax', TRUE);
|
69 |
+
if (empty($_order_tax)) {
|
70 |
+
update_post_meta($order_id, '_order_tax', 0);
|
71 |
+
}
|
72 |
+
update_post_meta($order_id, '_order_shipping_tax', 0);
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* @param $importData
|
77 |
+
*/
|
78 |
+
public function after_save_post($importData) {
|
79 |
+
$this->importer->afterPostImport();
|
80 |
+
}
|
81 |
+
}
|
libraries/actions/Actions.php
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\parser\Parser;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Created by PhpStorm.
|
9 |
+
* User: cmd
|
10 |
+
* Date: 11/16/17
|
11 |
+
* Time: 3:44 PM
|
12 |
+
*/
|
13 |
+
|
14 |
+
abstract class Actions {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var Parser
|
18 |
+
*/
|
19 |
+
public $parser;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var ImporterInterface
|
23 |
+
*/
|
24 |
+
public $importer;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Actions constructor.
|
28 |
+
* @param Parser $parser
|
29 |
+
*/
|
30 |
+
public function __construct(Parser $parser) {
|
31 |
+
$this->parser = $parser;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @return Parser
|
36 |
+
*/
|
37 |
+
public function getParser() {
|
38 |
+
return $this->parser;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @return ImporterInterface
|
43 |
+
*/
|
44 |
+
public function getImporter() {
|
45 |
+
return $this->importer;
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param ImporterInterface $importer
|
50 |
+
*/
|
51 |
+
public function setImporter($importer) {
|
52 |
+
$this->importer = $importer;
|
53 |
+
}
|
54 |
+
}
|
libraries/actions/OrderActions.php
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\parser\OrdersParser;
|
6 |
+
use wpai_woocommerce_add_on\libraries\parser\Parser;
|
7 |
+
|
8 |
+
require_once dirname(__FILE__) . '/Actions.php';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Created by PhpStorm.
|
12 |
+
* User: cmd
|
13 |
+
* Date: 11/16/17
|
14 |
+
* Time: 3:44 PM
|
15 |
+
*/
|
16 |
+
|
17 |
+
class OrderActions extends Actions {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* OrderActions constructor.
|
21 |
+
* @param Parser $parser
|
22 |
+
*/
|
23 |
+
public function __construct(Parser $parser) {
|
24 |
+
|
25 |
+
parent::__construct($parser);
|
26 |
+
|
27 |
+
if (!has_filter('wp_all_import_is_post_to_skip')) {
|
28 |
+
add_filter('wp_all_import_is_post_to_skip', array(
|
29 |
+
&$this,
|
30 |
+
'wp_all_import_is_post_to_skip'
|
31 |
+
), 10, 5);
|
32 |
+
}
|
33 |
+
|
34 |
+
if (!has_filter('wp_all_import_combine_article_data')) {
|
35 |
+
add_filter('wp_all_import_combine_article_data', array(
|
36 |
+
&$this,
|
37 |
+
'wp_all_import_combine_article_data'
|
38 |
+
), 10, 4);
|
39 |
+
}
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
*
|
44 |
+
* When users are matching to existing customers and/or products and no match it found,
|
45 |
+
* WP All Import doesn't have enough information to import that order, so the whole order will be skipped.
|
46 |
+
*
|
47 |
+
* @param $is_post_to_skip
|
48 |
+
* @param $import_id
|
49 |
+
* @param $current_xml_node
|
50 |
+
* @param $index
|
51 |
+
* @param $post_to_update_id
|
52 |
+
* @return bool
|
53 |
+
*/
|
54 |
+
public function wp_all_import_is_post_to_skip($is_post_to_skip, $import_id, $current_xml_node, $index, $post_to_update_id) {
|
55 |
+
|
56 |
+
$order_title = 'Order – ' . date_i18n('F j, Y @ h:i A', strtotime($this->getParser()->getData()['pmwi_order']['date'][$index]));
|
57 |
+
|
58 |
+
if (empty($post_to_update_id) or $this->getParser()->getImport()->options['update_all_data'] == 'yes' or $this->getParser()->getImport()->options['is_update_billing_details']) {
|
59 |
+
if ($this->getParser()->getImport()->options['pmwi_order']['billing_source'] == 'existing') {
|
60 |
+
$customer = $this->getParser()->get_existing_customer('billing_source', $index);
|
61 |
+
if (empty($customer) && empty($this->getParser()->getImport()->options['pmwi_order']['is_guest_matching'])) {
|
62 |
+
$this->getParser()->getLogger() and call_user_func($this->getParser()->getLogger(), sprintf(__('<b>SKIPPED</b>: %s Existing customer not found for Order `%s`.', \PMWI_Plugin::TEXT_DOMAIN), $this->getParser()->get_existing_customer_for_logger('billing_source', $index), $order_title));
|
63 |
+
$is_post_to_skip = TRUE;
|
64 |
+
}
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
if (empty($post_to_update_id) or $this->getParser()->getImport()->options['update_all_data'] == 'yes' or $this->getParser()->getImport()->options['is_update_products']) {
|
69 |
+
if (!$is_post_to_skip and $this->getParser()->getImport()->options['pmwi_order']['products_source'] == 'existing') {
|
70 |
+
$is_product_founded = FALSE;
|
71 |
+
|
72 |
+
$searching_for_sku = '';
|
73 |
+
|
74 |
+
foreach ($this->getParser()->getData()['pmwi_order']['products'][$index] as $productIndex => $productItem) {
|
75 |
+
if (empty($productItem['sku'])) {
|
76 |
+
continue;
|
77 |
+
}
|
78 |
+
|
79 |
+
$searching_for_sku = $productItem['sku'];
|
80 |
+
|
81 |
+
$args = array(
|
82 |
+
'post_type' => 'product',
|
83 |
+
'meta_key' => '_sku',
|
84 |
+
'meta_value' => $productItem['sku'],
|
85 |
+
'meta_compare' => '=',
|
86 |
+
);
|
87 |
+
|
88 |
+
$product = FALSE;
|
89 |
+
|
90 |
+
$query = new \WP_Query($args);
|
91 |
+
while ($query->have_posts()) {
|
92 |
+
$query->the_post();
|
93 |
+
$product = WC()->product_factory->get_product($query->post->ID);
|
94 |
+
break;
|
95 |
+
}
|
96 |
+
wp_reset_postdata();
|
97 |
+
|
98 |
+
if (empty($product)) {
|
99 |
+
$args['post_type'] = 'product_variation';
|
100 |
+
$query = new \WP_Query($args);
|
101 |
+
while ($query->have_posts()) {
|
102 |
+
$query->the_post();
|
103 |
+
$product = WC()->product_factory->get_product($query->post->ID);
|
104 |
+
break;
|
105 |
+
}
|
106 |
+
wp_reset_postdata();
|
107 |
+
}
|
108 |
+
if ($product) {
|
109 |
+
$is_product_founded = TRUE;
|
110 |
+
break;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
if (!$is_product_founded) {
|
114 |
+
$this->getParser()->getLogger() and call_user_func($this->getParser()->getLogger(), sprintf(__('<b>SKIPPED</b>: Existing product `%s` not found for Order `%s`.', \PMWI_Plugin::TEXT_DOMAIN), $searching_for_sku, $order_title));
|
115 |
+
$is_post_to_skip = TRUE;
|
116 |
+
}
|
117 |
+
}
|
118 |
+
}
|
119 |
+
return $is_post_to_skip;
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* @param $articleData
|
124 |
+
* @param $post_type
|
125 |
+
* @param $import_id
|
126 |
+
* @param $index
|
127 |
+
* @return mixed
|
128 |
+
*/
|
129 |
+
public function wp_all_import_combine_article_data($articleData, $post_type, $import_id, $index) {
|
130 |
+
if ($post_type == 'shop_order' && empty($articleData['post_title'])) {
|
131 |
+
$articleData['post_title'] = 'Order – ' . date_i18n('F j, Y @ h:i A', strtotime($this->getParser()->getData()['pmwi_order']['date'][$index]));
|
132 |
+
}
|
133 |
+
return $articleData;
|
134 |
+
}
|
135 |
+
}
|
libraries/actions/ProductsActions.php
ADDED
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\parser\Parser;
|
6 |
+
use wpai_woocommerce_add_on\libraries\parser\ProductsParser;
|
7 |
+
|
8 |
+
require_once dirname(__FILE__) . '/Actions.php';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Created by PhpStorm.
|
12 |
+
* User: cmd
|
13 |
+
* Date: 11/16/17
|
14 |
+
* Time: 3:44 PM
|
15 |
+
*/
|
16 |
+
|
17 |
+
class ProductsActions extends Actions {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* ProductsActions constructor.
|
21 |
+
* @param Parser $parser
|
22 |
+
*/
|
23 |
+
public function __construct(Parser $parser) {
|
24 |
+
parent::__construct($parser);
|
25 |
+
// Allow import products with duplicate SKU.
|
26 |
+
if ($parser->getImport()->options['disable_sku_matching']) {
|
27 |
+
add_filter('wc_product_has_unique_sku', array(
|
28 |
+
&$this,
|
29 |
+
'wc_product_has_unique_sku'
|
30 |
+
), 10, 3);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @param $sku_found
|
36 |
+
* @param $product_id
|
37 |
+
* @param $sku
|
38 |
+
*
|
39 |
+
* @return bool
|
40 |
+
*/
|
41 |
+
function wc_product_has_unique_sku($sku_found, $product_id, $sku){
|
42 |
+
return FALSE;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @return ProductsParser
|
47 |
+
*/
|
48 |
+
public function getParser() {
|
49 |
+
parent::getParser();
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @return ImporterInterface
|
54 |
+
*/
|
55 |
+
public function getImporter() {
|
56 |
+
return parent::getImporter();
|
57 |
+
}
|
58 |
+
}
|
libraries/helpers/ImporterOptions.php
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\helpers;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\parser\ParserInterface;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Created by PhpStorm.
|
9 |
+
* User: cmd
|
10 |
+
* Date: 11/14/17
|
11 |
+
* Time: 11:49 AM
|
12 |
+
*/
|
13 |
+
class ImporterOptions {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var ParserInterface
|
17 |
+
*/
|
18 |
+
public $parser;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* ParserOptions constructor.
|
22 |
+
* @param ParserInterface $parser
|
23 |
+
*/
|
24 |
+
public function __construct($parser) {
|
25 |
+
$this->parser = $parser;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @return ParserInterface
|
30 |
+
*/
|
31 |
+
public function getParser() {
|
32 |
+
return $this->parser;
|
33 |
+
}
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @param ParserInterface $parser
|
37 |
+
*/
|
38 |
+
public function setParser($parser) {
|
39 |
+
$this->parser = $parser;
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @return mixed
|
44 |
+
*/
|
45 |
+
public function getParsedData() {
|
46 |
+
return $this->getParser()->getData();
|
47 |
+
}
|
48 |
+
}
|
libraries/helpers/ParserOptions.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\helpers;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class ParserOptions
|
7 |
+
* @package wpai_woocommerce_add_on\libraries\helpers
|
8 |
+
*/
|
9 |
+
class ParserOptions {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var \PMXI_Import_Record
|
13 |
+
*/
|
14 |
+
public $import;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
public $xml;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var mixed
|
23 |
+
*/
|
24 |
+
public $logger;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var mixed
|
28 |
+
*/
|
29 |
+
public $count;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var mixed
|
33 |
+
*/
|
34 |
+
public $chunk;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var mixed
|
38 |
+
*/
|
39 |
+
public $xpath;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @var \wpdb
|
43 |
+
*/
|
44 |
+
public $wpdb;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* ParserOptions constructor.
|
48 |
+
* @param array $options
|
49 |
+
*/
|
50 |
+
public function __construct($options) {
|
51 |
+
global $wpdb;
|
52 |
+
$this->wpdb = $wpdb;
|
53 |
+
$this->import = $options['import'];
|
54 |
+
$this->count = $options['count'];
|
55 |
+
$this->xml = $options['xml'];
|
56 |
+
$this->logger = $options['logger'];
|
57 |
+
$this->chunk = $options['chunk'];
|
58 |
+
$this->xpath = $options['xpath_prefix'];
|
59 |
+
}
|
60 |
+
}
|
libraries/importer/ImportBase.php
ADDED
@@ -0,0 +1,171 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\helpers\ImporterOptions;
|
6 |
+
use XmlImportWooCommerceService;
|
7 |
+
|
8 |
+
require_once dirname(__FILE__) . '/ImportBaseInterface.php';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class ImportBase
|
12 |
+
* @package wpai_woocommerce_add_on\libraries\importer
|
13 |
+
*/
|
14 |
+
abstract class ImportBase implements ImportBaseInterface {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var array
|
18 |
+
*/
|
19 |
+
public $data;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var ImporterIndex
|
23 |
+
*/
|
24 |
+
public $index;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var ImporterOptions
|
28 |
+
*/
|
29 |
+
public $options;
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @var \wpdb
|
33 |
+
*/
|
34 |
+
public $wpdb;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @var XmlImportWooCommerceService
|
38 |
+
*/
|
39 |
+
public $importService;
|
40 |
+
|
41 |
+
/**
|
42 |
+
* ImportOrderBase constructor.
|
43 |
+
* @param ImporterIndex $index
|
44 |
+
* @param ImporterOptions $options
|
45 |
+
* @param array $data
|
46 |
+
*/
|
47 |
+
public function __construct(ImporterIndex $index, ImporterOptions $options, $data = array()) {
|
48 |
+
global $wpdb;
|
49 |
+
$this->index = $index;
|
50 |
+
$this->options = $options;
|
51 |
+
$this->data = $data;
|
52 |
+
$this->wpdb = $wpdb;
|
53 |
+
$this->importService = XmlImportWooCommerceService::getInstance();
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @return \XmlImportWooCommerceService
|
58 |
+
*/
|
59 |
+
public function getImportService() {
|
60 |
+
return $this->importService;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Import WooCommerce Entity.
|
65 |
+
*/
|
66 |
+
public function import() {}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* @return ImporterOptions
|
70 |
+
*/
|
71 |
+
public function getOptions() {
|
72 |
+
return $this->options;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
*
|
77 |
+
* Get parsed data
|
78 |
+
*
|
79 |
+
* @return mixed
|
80 |
+
*/
|
81 |
+
public function getParsedData() {
|
82 |
+
return $this->getOptions()->getParsedData();
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @param $option
|
87 |
+
* @return mixed
|
88 |
+
*/
|
89 |
+
public function getParsedDataOption($option) {
|
90 |
+
return $this->data[$option];
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* @param $option
|
95 |
+
* @return mixed
|
96 |
+
*/
|
97 |
+
public function getValue($option) {
|
98 |
+
return isset($this->data[$option]) ? $this->data[$option][$this->index->getIndex()] : '';
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @param $option
|
103 |
+
* @param $value
|
104 |
+
* @return mixed
|
105 |
+
*/
|
106 |
+
public function setValue($option, $value) {
|
107 |
+
$this->data[$option][$this->index->getIndex()] = $value;
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* @return mixed
|
112 |
+
*/
|
113 |
+
public function getArticle() {
|
114 |
+
return $this->index->getArticle();
|
115 |
+
}
|
116 |
+
|
117 |
+
/**
|
118 |
+
* @param $option
|
119 |
+
* @return mixed
|
120 |
+
*/
|
121 |
+
public function getArticleData($option) {
|
122 |
+
$articleData = $this->getArticle();
|
123 |
+
return isset($articleData[$option]) ? $articleData[$option] : FALSE;
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* @return mixed
|
128 |
+
*/
|
129 |
+
public function getIndex() {
|
130 |
+
return $this->index->getIndex();
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* @return mixed
|
135 |
+
*/
|
136 |
+
public function getPid(){
|
137 |
+
return $this->index->getPid();
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @return \PMXI_Import_Record
|
142 |
+
*/
|
143 |
+
public function getImport() {
|
144 |
+
return $this->getOptions()->getParser()->getImport();
|
145 |
+
}
|
146 |
+
|
147 |
+
/**
|
148 |
+
* @return mixed
|
149 |
+
*/
|
150 |
+
public function getLogger() {
|
151 |
+
return $this->getOptions()->getParser()->getLogger();
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* @param $var
|
156 |
+
* @return bool
|
157 |
+
*/
|
158 |
+
public function filtering($var) {
|
159 |
+
return ("" == $var) ? FALSE : TRUE;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
*
|
164 |
+
* Add message into import log.
|
165 |
+
*
|
166 |
+
* @param $msg
|
167 |
+
*/
|
168 |
+
public function log($msg) {
|
169 |
+
$this->getLogger() and call_user_func($this->getLogger(), $msg);
|
170 |
+
}
|
171 |
+
}
|
libraries/importer/ImportBaseInterface.php
ADDED
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\helpers\ImporterOptions;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* interface ImportBaseInterface
|
9 |
+
* @package wpai_woocommerce_add_on\libraries\importer
|
10 |
+
*/
|
11 |
+
interface ImportBaseInterface {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return ImporterOptions
|
15 |
+
*/
|
16 |
+
public function getOptions();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @param $option
|
20 |
+
* @return mixed
|
21 |
+
*/
|
22 |
+
public function getValue($option);
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param $option
|
26 |
+
* @param $value
|
27 |
+
* @return mixed
|
28 |
+
*/
|
29 |
+
public function setValue($option, $value);
|
30 |
+
|
31 |
+
/**
|
32 |
+
* @return mixed
|
33 |
+
*/
|
34 |
+
public function getArticle();
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @param $option
|
38 |
+
* @return mixed
|
39 |
+
*/
|
40 |
+
public function getArticleData($option);
|
41 |
+
|
42 |
+
/**
|
43 |
+
* @return mixed
|
44 |
+
*/
|
45 |
+
public function getIndex();
|
46 |
+
|
47 |
+
/**
|
48 |
+
* @return \PMXI_Import_Record
|
49 |
+
*/
|
50 |
+
public function getImport();
|
51 |
+
|
52 |
+
/**
|
53 |
+
* @return mixed
|
54 |
+
*/
|
55 |
+
public function getLogger();
|
56 |
+
|
57 |
+
/**
|
58 |
+
* @return mixed
|
59 |
+
*/
|
60 |
+
public function import();
|
61 |
+
|
62 |
+
/**
|
63 |
+
* @param $var
|
64 |
+
* @return mixed
|
65 |
+
*/
|
66 |
+
public function filtering($var);
|
67 |
+
}
|
libraries/importer/Importer.php
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
require_once dirname(__FILE__) . '/ImportBase.php';
|
6 |
+
require_once dirname(__FILE__) . '/ImporterInterface.php';
|
7 |
+
|
8 |
+
abstract class Importer extends ImportBase implements ImporterInterface {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @return ImporterIndex
|
12 |
+
*/
|
13 |
+
public function getIndexObject() {
|
14 |
+
return $this->index;
|
15 |
+
}
|
16 |
+
}
|
libraries/importer/ImporterIndex.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
use ImporterIndexInterface;
|
6 |
+
|
7 |
+
require_once dirname(__FILE__) . '/ImporterIndexInterface.php';
|
8 |
+
|
9 |
+
class ImporterIndex implements ImporterIndexInterface {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @var int
|
13 |
+
*/
|
14 |
+
public $pid;
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var int
|
18 |
+
*/
|
19 |
+
public $index;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @var array
|
23 |
+
*/
|
24 |
+
public $article;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* ImporterIndex constructor.
|
28 |
+
*
|
29 |
+
* @param int $pid
|
30 |
+
* @param int $index
|
31 |
+
* @param array $article
|
32 |
+
*/
|
33 |
+
public function __construct($pid, $index, $article) {
|
34 |
+
$this->pid = $pid;
|
35 |
+
$this->index = $index;
|
36 |
+
$this->article = $article;
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @return mixed
|
41 |
+
*/
|
42 |
+
public function getPid() {
|
43 |
+
return $this->pid;
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* @return mixed
|
48 |
+
*/
|
49 |
+
public function getIndex() {
|
50 |
+
return $this->index;
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @return mixed
|
55 |
+
*/
|
56 |
+
public function getArticle() {
|
57 |
+
return $this->article;
|
58 |
+
}
|
59 |
+
|
60 |
+
}
|
libraries/importer/ImporterIndexInterface.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Created by PhpStorm.
|
4 |
+
* User: cmd
|
5 |
+
* Date: 11/14/17
|
6 |
+
* Time: 5:37 PM
|
7 |
+
*/
|
8 |
+
|
9 |
+
Interface ImporterIndexInterface{
|
10 |
+
|
11 |
+
/**
|
12 |
+
* @return mixed
|
13 |
+
*/
|
14 |
+
public function getPid();
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return mixed
|
18 |
+
*/
|
19 |
+
public function getIndex();
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return mixed
|
23 |
+
*/
|
24 |
+
public function getArticle();
|
25 |
+
|
26 |
+
}
|
libraries/importer/ImporterInterface.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Created by PhpStorm.
|
7 |
+
* User: cmd
|
8 |
+
* Date: 11/14/17
|
9 |
+
* Time: 11:33 AM
|
10 |
+
*/
|
11 |
+
/**
|
12 |
+
* Interface ImporterInterface
|
13 |
+
* @package wpai_woocommerce_add_on\libraries\importer
|
14 |
+
*/
|
15 |
+
interface ImporterInterface {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* @return mixed
|
19 |
+
*/
|
20 |
+
public function import();
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @return mixed
|
24 |
+
*/
|
25 |
+
public function afterPostImport();
|
26 |
+
|
27 |
+
}
|
libraries/importer/ProductsImporter.php
ADDED
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
require_once dirname(__FILE__) . '/Importer.php';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class ProductsImporter
|
9 |
+
* @package wpai_woocommerce_add_on\libraries\importer
|
10 |
+
*/
|
11 |
+
class ProductsImporter extends Importer {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var ImportProductBase
|
15 |
+
*/
|
16 |
+
public $importEngine;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var \WC_Product
|
20 |
+
*/
|
21 |
+
public $product;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @var bool
|
25 |
+
*/
|
26 |
+
public $isNewProduct;
|
27 |
+
|
28 |
+
/**
|
29 |
+
*
|
30 |
+
* Import WooCommerce Products
|
31 |
+
*
|
32 |
+
*/
|
33 |
+
public function import() {
|
34 |
+
|
35 |
+
$this->log(__('<strong>WooCommerce ADD-ON:</strong>', \PMWI_Plugin::TEXT_DOMAIN));
|
36 |
+
|
37 |
+
$productID = $this->getArticleData('ID');
|
38 |
+
|
39 |
+
$this->isNewProduct = empty($productID) ? TRUE : FALSE;
|
40 |
+
|
41 |
+
$data = $this->getParsedData();
|
42 |
+
|
43 |
+
$currentProductType = \WC_Product_Factory::get_product_type( $this->getPid() );
|
44 |
+
|
45 |
+
$productType = empty($data['product_types'][$this->getIndex()]) ? 'simple' : sanitize_title(stripslashes($data['product_types'][$this->getIndex()]));
|
46 |
+
|
47 |
+
if ($this->getImport()->options['update_all_data'] == 'no' && ! $this->getImport()->options['is_update_product_type'] && ! $this->isNewProduct || $currentProductType == 'variation'){
|
48 |
+
$productType = \WC_Product_Factory::get_product_type( $this->getPid() );
|
49 |
+
}
|
50 |
+
|
51 |
+
$this->getImportService()->pushMeta($this->getPid(), '_wc_review_count', 0, $this->isNewProduct);
|
52 |
+
$this->getImportService()->pushMeta($this->getPid(), '_wc_rating_count', 0, $this->isNewProduct);
|
53 |
+
$this->getImportService()->pushMeta($this->getPid(), '_wc_average_rating', 0, $this->isNewProduct);
|
54 |
+
|
55 |
+
$className = \WC_Product_Factory::get_product_classname( $this->getPid(), $productType ? $productType : 'simple' );
|
56 |
+
|
57 |
+
$this->product = new $className( $this->getPid() );
|
58 |
+
|
59 |
+
$this->importEngine = new ImportSimpleProduct($this->getIndexObject(), $this->getOptions(), $data);
|
60 |
+
$this->importEngine->setProduct($this->product);
|
61 |
+
$this->importEngine->import();
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
*
|
66 |
+
* After Import WooCommerce Products
|
67 |
+
*
|
68 |
+
* @return void
|
69 |
+
* @throws \Exception
|
70 |
+
*/
|
71 |
+
public function afterPostImport() {
|
72 |
+
|
73 |
+
$table = $this->wpdb->posts;
|
74 |
+
|
75 |
+
$p = $this->wpdb->get_row($this->wpdb->prepare("SELECT * FROM $table WHERE ID = %d;", $this->getPid()));
|
76 |
+
|
77 |
+
if ($p) {
|
78 |
+
|
79 |
+
if ($p->post_type == 'product_variation') {
|
80 |
+
// Do not import variation as draft.
|
81 |
+
$variationData = array( 'post_excerpt' => '', 'post_name' => sanitize_title($p->post_title), 'guid' => '' );
|
82 |
+
if ($this->getImport()->options['create_draft'] == 'yes' && $p->post_status == 'draft') {
|
83 |
+
$variationData['post_status'] = 'publish';
|
84 |
+
}
|
85 |
+
$this->wpdb->update( $this->wpdb->posts, $variationData, array('ID' => $this->getPid()));
|
86 |
+
// Unset missing attributes.
|
87 |
+
$attributes = $this->getImportService()->getProductTaxonomies();
|
88 |
+
if (!empty($attributes)) {
|
89 |
+
foreach ($attributes as $ctx) {
|
90 |
+
if ( strpos($ctx->name, "pa_") === 0 ) {
|
91 |
+
continue;
|
92 |
+
}
|
93 |
+
$this->getImportService()->getTaxonomiesService()->associateTerms($this->getPid(), NULL, $ctx->name);
|
94 |
+
}
|
95 |
+
}
|
96 |
+
$post_to_update_id = $p->post_parent;
|
97 |
+
}
|
98 |
+
else {
|
99 |
+
// Unset missing attributes.
|
100 |
+
$product_attributes = get_post_meta( $this->getPid(), '_product_attributes', TRUE );
|
101 |
+
$attributes = $this->getImportService()->getProductTaxonomies();
|
102 |
+
if (!empty($attributes)) {
|
103 |
+
foreach ($attributes as $ctx) {
|
104 |
+
if ( strpos($ctx->name, "pa_") === 0 && ! isset($product_attributes[strtolower(urlencode($ctx->name))]) ){
|
105 |
+
$this->getImportService()->getTaxonomiesService()->associateTerms($this->getPid(), NULL, $ctx->name);
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
update_post_meta( $this->getPid(), '_product_version', WC_VERSION );
|
111 |
+
|
112 |
+
$post_to_update_id = $this->getPid();
|
113 |
+
|
114 |
+
// Associate linked products.
|
115 |
+
$wp_all_import_not_linked_products = get_option('wp_all_import_not_linked_products_' . $this->getImport()->id );
|
116 |
+
if (!empty($wp_all_import_not_linked_products)) {
|
117 |
+
$post_to_update_sku = get_post_meta($post_to_update_id, '_sku', TRUE);
|
118 |
+
foreach ($wp_all_import_not_linked_products as $product) {
|
119 |
+
if ($product['pid'] != $post_to_update_id && ! empty($product['not_linked_products'])) {
|
120 |
+
if ( in_array($post_to_update_sku, $product['not_linked_products'])
|
121 |
+
|| in_array( (string) $post_to_update_id, $product['not_linked_products'])
|
122 |
+
|| in_array($p->post_title, $product['not_linked_products'])
|
123 |
+
|| in_array($p->post_name, $product['not_linked_products'])
|
124 |
+
)
|
125 |
+
{
|
126 |
+
$linked_products = get_post_meta($product['pid'], $product['type'], TRUE);
|
127 |
+
if (empty($linked_products)) {
|
128 |
+
$linked_products = array();
|
129 |
+
}
|
130 |
+
if ( ! in_array($post_to_update_id, $linked_products)) {
|
131 |
+
$linked_products[] = $post_to_update_id;
|
132 |
+
$this->getLogger() && call_user_func($this->getLogger(), sprintf(__('Added to %s list of product ID %d.', \PMWI_Plugin::TEXT_DOMAIN), $product['type'] == '_upsell_ids' ? 'Up-Sells' : 'Cross-Sells', $product['pid']) );
|
133 |
+
update_post_meta($product['pid'], $product['type'], $linked_products);
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
if ($post_to_update_id){
|
142 |
+
$postRecord = new \PMXI_Post_Record();
|
143 |
+
$postRecord->clear();
|
144 |
+
// Find corresponding article among previously imported.
|
145 |
+
$postRecord->getBy(array(
|
146 |
+
'unique_key' => 'Variation ' . get_post_meta($post_to_update_id, '_sku', TRUE),
|
147 |
+
'import_id' => $this->getImport()->id,
|
148 |
+
));
|
149 |
+
$pid = ( ! $postRecord->isEmpty() ) ? $postRecord->post_id : FALSE;
|
150 |
+
// Update first variation.
|
151 |
+
if ( $pid ) {
|
152 |
+
// Check is variation already processed.
|
153 |
+
$is_variation_updated = get_post_meta($pid, '_variation_updated', TRUE);
|
154 |
+
if ( empty($is_variation_updated) ){
|
155 |
+
// save thumbnail
|
156 |
+
if ($this->isNewProduct || $this->getImport()->options['is_update_images'] && $this->getImport()->options['update_images_logic'] == 'full_update') {
|
157 |
+
$post_thumbnail_id = get_post_thumbnail_id( $post_to_update_id );
|
158 |
+
if ($post_thumbnail_id) {
|
159 |
+
set_post_thumbnail($pid, $post_thumbnail_id);
|
160 |
+
}
|
161 |
+
if ($this->getImport()->options['put_variation_image_to_gallery'] && $post_thumbnail_id) {
|
162 |
+
do_action('pmxi_gallery_image', $pid, $post_thumbnail_id, FALSE);
|
163 |
+
}
|
164 |
+
}
|
165 |
+
if ($this->getImport()->options['create_draft'] == 'yes') {
|
166 |
+
$this->wpdb->update( $this->wpdb->posts, array('post_status' => 'publish' ), array('ID' => $pid));
|
167 |
+
}
|
168 |
+
update_post_meta($pid, '_variation_updated', 1);
|
169 |
+
}
|
170 |
+
}
|
171 |
+
}
|
172 |
+
// Update product gallery.
|
173 |
+
$tmp_gallery = explode(",", get_post_meta( $post_to_update_id, '_product_image_gallery_tmp', TRUE));
|
174 |
+
$gallery = explode(",", get_post_meta( $post_to_update_id, '_product_image_gallery', TRUE));
|
175 |
+
if (is_array($gallery)) {
|
176 |
+
$gallery = array_filter($gallery);
|
177 |
+
if (!empty($tmp_gallery)) {
|
178 |
+
$gallery = array_unique(array_merge($gallery, $tmp_gallery));
|
179 |
+
}
|
180 |
+
}
|
181 |
+
elseif (!empty($tmp_gallery)) {
|
182 |
+
$gallery = array_unique($tmp_gallery);
|
183 |
+
}
|
184 |
+
// Do not add featured image to the gallery.
|
185 |
+
if (!empty($gallery)){
|
186 |
+
$post_thumbnail_id = get_post_thumbnail_id( $post_to_update_id );
|
187 |
+
foreach ($gallery as $key => $value) {
|
188 |
+
if ($value == $post_thumbnail_id){
|
189 |
+
unset($gallery[$key]);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
$this->getImportService()->pushMeta( $post_to_update_id, '_product_image_gallery', implode(",", $gallery), $this->isNewProduct );
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
libraries/importer/products/ImportProduct.php
ADDED
@@ -0,0 +1,735 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\helpers\ImporterOptions;
|
6 |
+
|
7 |
+
require_once dirname(__FILE__) . '/ImportProductBase.php';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class ImportProduct
|
11 |
+
* @package wpai_woocommerce_add_on\libraries\importer
|
12 |
+
*/
|
13 |
+
abstract class ImportProduct extends ImportProductBase {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var \WC_Product
|
17 |
+
*/
|
18 |
+
public $product;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @var array
|
22 |
+
*/
|
23 |
+
public $productProperties = array();
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @var bool
|
27 |
+
*/
|
28 |
+
public $isNewProduct;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* @var bool
|
32 |
+
*/
|
33 |
+
public $downloadable;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* @var bool
|
37 |
+
*/
|
38 |
+
public $virtual;
|
39 |
+
|
40 |
+
/**
|
41 |
+
* @var bool
|
42 |
+
*/
|
43 |
+
public $featured;
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @var string
|
47 |
+
*/
|
48 |
+
protected $productType;
|
49 |
+
|
50 |
+
/**
|
51 |
+
* ImportProduct constructor.
|
52 |
+
* @param \wpai_woocommerce_add_on\libraries\importer\ImporterIndex $index
|
53 |
+
* @param \wpai_woocommerce_add_on\libraries\helpers\ImporterOptions $options
|
54 |
+
* @param array $data
|
55 |
+
*/
|
56 |
+
public function __construct(ImporterIndex $index, ImporterOptions $options, array $data) {
|
57 |
+
parent::__construct($index, $options, $data);
|
58 |
+
$productID = $this->getArticleData('ID');
|
59 |
+
$this->isNewProduct = empty($productID) ? TRUE : FALSE;
|
60 |
+
$this->downloadable = $this->getValue('product_downloadable') == 'yes';
|
61 |
+
$this->virtual = $this->getValue('product_virtual') == 'yes';
|
62 |
+
$this->featured = $this->getValue('product_featured') == 'yes';
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
*
|
67 |
+
* @return mixed
|
68 |
+
*/
|
69 |
+
public function import() {
|
70 |
+
$this->setProperties();
|
71 |
+
$this->save();
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Save product data into database.
|
76 |
+
*/
|
77 |
+
public function save() {
|
78 |
+
/**
|
79 |
+
* @since 3.0.0 to set props before save.
|
80 |
+
*/
|
81 |
+
do_action( 'woocommerce_admin_process_product_object', $this->product );
|
82 |
+
$this->product->save();
|
83 |
+
do_action( 'woocommerce_process_product_meta_' . $this->product->get_type(), $this->product->get_id() );
|
84 |
+
wc_delete_product_transients($this->product->get_id());
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @return mixed
|
89 |
+
*/
|
90 |
+
public function setProperties() {
|
91 |
+
$this->prepareProperties();
|
92 |
+
foreach ($this->productProperties as $property => $value) {
|
93 |
+
$this->log(sprintf(__('Property `%s` updated with value `%s`', \PMWI_Plugin::TEXT_DOMAIN), $property, maybe_serialize($value)));
|
94 |
+
}
|
95 |
+
$errors = $this->product->set_props($this->productProperties);
|
96 |
+
if (is_wp_error($errors)) {
|
97 |
+
$this->log('<b>ERROR:</b> ' . $errors->get_error_message());
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* @return array
|
103 |
+
*/
|
104 |
+
public function getProperties() {
|
105 |
+
return $this->productProperties;
|
106 |
+
}
|
107 |
+
|
108 |
+
/*
|
109 |
+
|--------------------------------------------------------------------------
|
110 |
+
| Product Properties Methods
|
111 |
+
|--------------------------------------------------------------------------
|
112 |
+
*/
|
113 |
+
|
114 |
+
/**
|
115 |
+
*
|
116 |
+
* Define all product properties.
|
117 |
+
*
|
118 |
+
* @return mixed
|
119 |
+
*/
|
120 |
+
public function prepareProperties(){
|
121 |
+
$this->prepareGeneralProperties();
|
122 |
+
$this->prepareInventoryProperties();
|
123 |
+
$this->prepareShippingProperties();
|
124 |
+
$this->prepareLinkedProducts();
|
125 |
+
$this->prepareAttributesProperties();
|
126 |
+
$this->prepareAdvancedProperties();
|
127 |
+
}
|
128 |
+
|
129 |
+
/**
|
130 |
+
* Define general properties.
|
131 |
+
*/
|
132 |
+
public function prepareGeneralProperties(){
|
133 |
+
// Prices.
|
134 |
+
$this->setProperty('price', wc_clean( $this->getValue('product_regular_price') ));
|
135 |
+
$this->setProperty('regular_price', wc_clean( $this->getValue('product_regular_price') ));
|
136 |
+
$this->setProperty('sale_price', wc_clean( $this->getValue('product_sale_price') ));
|
137 |
+
$this->setProperty('date_on_sale_from', wc_clean( $this->getValue('product_sale_price_dates_from') ));
|
138 |
+
$this->setProperty('date_on_sale_to', wc_clean( $this->getValue('product_sale_price_dates_to') ));
|
139 |
+
// Product properties.
|
140 |
+
$this->setProperty('downloadable', $this->isDownloadable());
|
141 |
+
$this->setProperty('virtual', $this->isVirtual());
|
142 |
+
$this->setProperty('featured', $this->isFeatured());
|
143 |
+
// Validate catalog visibility.
|
144 |
+
$catalog_visibility = strtolower(wc_clean( $this->getValue('product_visibility') ));
|
145 |
+
$options = array_keys( wc_get_product_visibility_options() );
|
146 |
+
if ( ! in_array( $catalog_visibility, $options, true ) ) {
|
147 |
+
$catalog_visibility = 'visible';
|
148 |
+
}
|
149 |
+
$this->setProperty('catalog_visibility', $catalog_visibility);
|
150 |
+
$this->prepareDownloadableProperties();
|
151 |
+
$this->prepareTaxProperties();
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Define general -> downloadable properties.
|
156 |
+
*/
|
157 |
+
public function prepareDownloadableProperties(){
|
158 |
+
// Downloadable options.
|
159 |
+
if ( $this->isDownloadable() ) {
|
160 |
+
$_download_limit = absint( $this->getValue('product_download_limit') );
|
161 |
+
if (!$_download_limit) {
|
162 |
+
$_download_limit = ''; // 0 or blank = unlimited
|
163 |
+
}
|
164 |
+
$this->setProperty('download_limit', $_download_limit);
|
165 |
+
$_download_expiry = absint( $this->getValue('product_download_expiry') );
|
166 |
+
if (!$_download_expiry) {
|
167 |
+
$_download_expiry = ''; // 0 or blank = unlimited
|
168 |
+
}
|
169 |
+
$this->setProperty('download_expiry', $_download_expiry);
|
170 |
+
// File paths will be stored in an array keyed off md5(file path).
|
171 |
+
if ($this->getValue('product_files')) {
|
172 |
+
$_file_paths = array();
|
173 |
+
$file_paths = explode( $this->getImport()->options['product_files_delim'] , $this->getValue('product_files') );
|
174 |
+
$file_names = explode( $this->getImport()->options['product_files_names_delim'] , $this->getValue('product_files_names') );
|
175 |
+
foreach ( $file_paths as $fn => $file_path ) {
|
176 |
+
$file_path = trim( $file_path );
|
177 |
+
$_file_paths[ md5( $file_path ) ] = array(
|
178 |
+
'download_id' => md5( $file_path ),
|
179 |
+
'name' => ((!empty($file_names[$fn])) ? $file_names[$fn] : basename($file_path)),
|
180 |
+
'file' => $file_path
|
181 |
+
);
|
182 |
+
}
|
183 |
+
$this->setProperty('downloads', $_file_paths);
|
184 |
+
// Sync file download permissions in related orders.
|
185 |
+
if ($this->isNewProduct() || $this->getImportService()->isUpdateCustomField('_downloads')) {
|
186 |
+
// Get all product related orders.
|
187 |
+
$orders = $this->getImportService()->getOrdersIdsByProductId($this->getPid());
|
188 |
+
if (!empty($orders)) {
|
189 |
+
global $wpdb;
|
190 |
+
foreach ($orders as $orderID) {
|
191 |
+
$order = new \WC_Order($orderID);
|
192 |
+
foreach ($_file_paths as $download_id => $download_data) {
|
193 |
+
// Grant permission if it doesn't already exist.
|
194 |
+
if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT 1=1 FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE order_id = %d AND product_id = %d AND download_id = %s", $order->id, $this->getPid(), $download_id ) ) ) {
|
195 |
+
wc_downloadable_file_permission( $download_id, $this->getPid(), $order );
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
/**
|
206 |
+
* Define general -> tax properties.
|
207 |
+
*/
|
208 |
+
public function prepareTaxProperties(){
|
209 |
+
$tax_status = wc_clean($this->getValue('product_tax_status'));
|
210 |
+
$tax_class = strtolower($this->getValue('product_tax_class') == 'standard' ? '' : wc_clean($this->getValue('product_tax_class')));
|
211 |
+
$this->setProperty('tax_status', $tax_status != '' ? $tax_status : null);
|
212 |
+
$this->setProperty('tax_class', $tax_class);
|
213 |
+
}
|
214 |
+
|
215 |
+
/**
|
216 |
+
* Define inventory properties.
|
217 |
+
*/
|
218 |
+
public function prepareInventoryProperties() {
|
219 |
+
$this->prepareSKU();
|
220 |
+
$this->setProperty('manage_stock', $this->getValue('product_manage_stock') == 'yes');
|
221 |
+
$backorders = $this->getValue('product_allow_backorders');
|
222 |
+
$this->setProperty('backorders', $backorders != '' ? wc_clean($backorders) : null);
|
223 |
+
$this->setProperty('stock_status', wc_clean($this->getValue('product_stock_status')));
|
224 |
+
$this->setProperty('stock_quantity', $this->getStockQuantity());
|
225 |
+
$this->setProperty('sold_individually', 'yes' == $this->getValue('product_sold_individually'));
|
226 |
+
// Do not set Low stock threshold for variations.
|
227 |
+
if (!$this->getProduct() instanceof \WC_Product_Variation) {
|
228 |
+
$this->setProperty('low_stock_amount', $this->getValue('product_low_stock_amount'));
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* @return float|int
|
234 |
+
*/
|
235 |
+
public function getStockQuantity() {
|
236 |
+
return wc_stock_amount($this->getValue('product_stock_qty'));
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Define product SKU.
|
241 |
+
*/
|
242 |
+
public function prepareSKU() {
|
243 |
+
$this->setProperty('sku', $this->generateSKU() );
|
244 |
+
}
|
245 |
+
|
246 |
+
/**
|
247 |
+
* Define shipping properties.
|
248 |
+
*/
|
249 |
+
public function prepareShippingProperties() {
|
250 |
+
$shippingClass = $this->getShippingClass();
|
251 |
+
if (empty($shippingClass)) {
|
252 |
+
$shippingClass = -1;
|
253 |
+
}
|
254 |
+
$this->setProperty('shipping_class_id', absint($shippingClass));
|
255 |
+
$this->prepareDimensions();
|
256 |
+
}
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Define dimensions properties.
|
260 |
+
*/
|
261 |
+
protected function prepareDimensions() {
|
262 |
+
if ( ! $this->isVirtual() ) {
|
263 |
+
$this->setProperty('weight', stripslashes($this->getValue('product_weight')));
|
264 |
+
$this->setProperty('length', stripslashes($this->getValue('product_length')));
|
265 |
+
$this->setProperty('width', stripslashes($this->getValue('product_width')));
|
266 |
+
$this->setProperty('height', stripslashes($this->getValue('product_height')));
|
267 |
+
} else {
|
268 |
+
$this->setProperty('weight', '' );
|
269 |
+
$this->setProperty('length', '' );
|
270 |
+
$this->setProperty('width', '' );
|
271 |
+
$this->setProperty('height', '' );
|
272 |
+
}
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* Define linked properties.
|
277 |
+
*/
|
278 |
+
public function prepareLinkedProducts() {
|
279 |
+
// Upsells.
|
280 |
+
if ($this->isNewProduct() || $this->getImportService()->isUpdateCustomField('_upsell_ids')) {
|
281 |
+
$linked = $this->getLinkedProducts($this->getPid(), $this->getValue('product_up_sells'), '_upsell_ids');
|
282 |
+
$this->productProperties['upsell_ids'] = $linked;
|
283 |
+
}
|
284 |
+
// Cross sells.
|
285 |
+
if ($this->isNewProduct() || $this->getImportService()->isUpdateCustomField('_crosssell_ids')) {
|
286 |
+
$linked = $this->getLinkedProducts($this->getPid(), $this->getValue('product_cross_sells'), '_crosssell_ids');
|
287 |
+
$this->productProperties['cross_sell_ids'] = $linked;
|
288 |
+
}
|
289 |
+
// Grouping.
|
290 |
+
$this->importGrouping();
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Define attributes properties.
|
295 |
+
*/
|
296 |
+
public function prepareAttributesProperties() {
|
297 |
+
if (!$this->getImportService()->isUpdateDataAllowed('is_update_attributes', $this->isNewProduct())) {
|
298 |
+
return TRUE;
|
299 |
+
}
|
300 |
+
$attributes = $this->getAttributesProperties();
|
301 |
+
$this->setProperty('attributes', $attributes);
|
302 |
+
}
|
303 |
+
|
304 |
+
/**
|
305 |
+
* @return array \WC_Product_Attribute
|
306 |
+
*/
|
307 |
+
public function getAttributesProperties() {
|
308 |
+
$attributes = $this->getAttributesData();
|
309 |
+
if (!empty($attributes['attribute_names'])) {
|
310 |
+
$attributes = \WC_Meta_Box_Product_Data::prepare_attributes($attributes);
|
311 |
+
}
|
312 |
+
else {
|
313 |
+
$attributes = array();
|
314 |
+
}
|
315 |
+
return $attributes;
|
316 |
+
}
|
317 |
+
|
318 |
+
/**
|
319 |
+
* Get attributes data.
|
320 |
+
*
|
321 |
+
* @return array
|
322 |
+
*/
|
323 |
+
public function getAttributesData() {
|
324 |
+
$data = array(
|
325 |
+
'attribute_names' => array(),
|
326 |
+
'attribute_values' => array(),
|
327 |
+
'attribute_visibility' => array(),
|
328 |
+
'attribute_variation' => array(),
|
329 |
+
'attribute_position' => array()
|
330 |
+
);
|
331 |
+
$is_any_attribute = apply_filters('wp_all_import_variation_any_attribute', false, $this->getImport()->id);
|
332 |
+
$max_attribute_length = apply_filters('wp_all_import_max_woo_attribute_term_length', 199);
|
333 |
+
$parsedAttributes = array();
|
334 |
+
$attributesToImport = $this->getParsedDataOption('serialized_attributes');
|
335 |
+
if (!empty($attributesToImport)) {
|
336 |
+
$attribute_position = 0;
|
337 |
+
$attributes = [];
|
338 |
+
foreach ($attributesToImport as $attributeData) {
|
339 |
+
$attributes[] = [
|
340 |
+
'name' => $attributeData['names'][$this->getIndex()],
|
341 |
+
'value' => $attributeData['value'][$this->getIndex()],
|
342 |
+
'in_taxonomy' => $attributeData['in_taxonomy'][$this->getIndex()],
|
343 |
+
'is_create_taxonomy_terms' => $attributeData['is_create_taxonomy_terms'][$this->getIndex()],
|
344 |
+
'is_visible' => $attributeData['is_visible'][$this->getIndex()],
|
345 |
+
'in_variation' => $attributeData['in_variation'][$this->getIndex()],
|
346 |
+
];
|
347 |
+
}
|
348 |
+
$attributes = apply_filters('wp_all_import_parsed_product_attributes', $attributes, $this->getPid(), $this->getImport()->id);
|
349 |
+
$attributes_delimiter = apply_filters('wp_all_import_product_attributes_delimiter', "|", $this->getPid(), $this->getImport()->id);
|
350 |
+
foreach ($attributes as $attribute) {
|
351 |
+
$real_attr_name = $attribute['name'];
|
352 |
+
if (empty($real_attr_name)) {
|
353 |
+
continue;
|
354 |
+
}
|
355 |
+
$isTaxonomy = intval($attribute['in_taxonomy']);
|
356 |
+
$attributeName = ($isTaxonomy) ? wc_attribute_taxonomy_name( $real_attr_name ) : $real_attr_name;
|
357 |
+
$isUpdateAttributes = $this->getImportService()->isUpdateAttribute($attributeName, $this->getPid(), $this->isNewProduct());
|
358 |
+
$attribute_position++;
|
359 |
+
if ($isUpdateAttributes) {
|
360 |
+
$values = $attribute['value'];
|
361 |
+
if ( $isTaxonomy ) {
|
362 |
+
if ( isset( $attribute['value']) ) {
|
363 |
+
$values = array_map('stripslashes', array_map( 'strip_tags', explode( $attributes_delimiter, $attribute['value'])));
|
364 |
+
// Remove empty items in the array.
|
365 |
+
$values = array_filter( $values, array($this, "filtering") );
|
366 |
+
if (intval($attribute['is_create_taxonomy_terms'])){
|
367 |
+
$real_attr_name = $this->getImportService()->getTaxonomiesService()->createTaxonomy($real_attr_name);
|
368 |
+
$attributeName = wc_attribute_taxonomy_name( $real_attr_name );
|
369 |
+
}
|
370 |
+
if ( ! empty($values) && taxonomy_exists( wc_attribute_taxonomy_name( $real_attr_name ) )){
|
371 |
+
$attr_values = array();
|
372 |
+
foreach ($values as $key => $val) {
|
373 |
+
$value = substr($val, 0, $max_attribute_length);
|
374 |
+
$term = get_term_by('name', $value, wc_attribute_taxonomy_name( $real_attr_name ), ARRAY_A);
|
375 |
+
// For compatibility with WPML plugin.
|
376 |
+
$term = apply_filters('wp_all_import_term_exists', $term, wc_attribute_taxonomy_name( $real_attr_name ), $value, null);
|
377 |
+
if ( empty($term) && !is_wp_error($term) ){
|
378 |
+
$term = is_exists_term($value, wc_attribute_taxonomy_name( $real_attr_name ));
|
379 |
+
if ( empty($term) && !is_wp_error($term) ){
|
380 |
+
$term = is_exists_term(htmlspecialchars($value), wc_attribute_taxonomy_name( $real_attr_name ));
|
381 |
+
if ( empty($term) && !is_wp_error($term) && intval($attribute['is_create_taxonomy_terms'])){
|
382 |
+
$term = wp_insert_term(
|
383 |
+
$value, // the term
|
384 |
+
wc_attribute_taxonomy_name( $real_attr_name ) // the taxonomy
|
385 |
+
);
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
if (!is_wp_error($term)) {
|
390 |
+
$attr_values[] = (int) $term['term_id'];
|
391 |
+
}
|
392 |
+
}
|
393 |
+
$values = $attr_values;
|
394 |
+
$values = array_map( 'intval', $values );
|
395 |
+
$values = array_unique( $values );
|
396 |
+
}
|
397 |
+
else{
|
398 |
+
$values = array();
|
399 |
+
}
|
400 |
+
}
|
401 |
+
}
|
402 |
+
if ($is_any_attribute && count($values) > 1 && $this->getProduct() instanceof \WC_Product_Variation) {
|
403 |
+
$values = '';
|
404 |
+
}
|
405 |
+
$parsedAttributes[strtolower(urlencode($attributeName))] = array(
|
406 |
+
'name' => $attributeName,
|
407 |
+
'value' => $values,
|
408 |
+
'is_visible' => intval($attribute['is_visible']),
|
409 |
+
'in_variation' => intval($attribute['in_variation']),
|
410 |
+
'position' => $attribute_position
|
411 |
+
);
|
412 |
+
}
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
if (!$this->getProduct() instanceof \WC_Product_Variation) {
|
417 |
+
$productAttributes = array();
|
418 |
+
$attributes = $this->getProduct()->get_attributes();
|
419 |
+
$currentAttributes = get_post_meta($this->getPid(), '_product_attributes', true);
|
420 |
+
/** @var \WC_Product_Attribute $attribute */
|
421 |
+
foreach ($attributes as $attributeName => $attribute) {
|
422 |
+
$isAddNew = FALSE;
|
423 |
+
// Don't touch existing attributes, add new attributes.
|
424 |
+
if ( ! $this->isNewProduct() && $this->getImport()->options['update_all_data'] == "no" && $this->getImport()->options['is_update_attributes'] && $this->getImport()->options['update_attributes_logic'] == 'add_new') {
|
425 |
+
if (isset($currentAttributes[$attributeName])) {
|
426 |
+
$isAddNew = TRUE;
|
427 |
+
}
|
428 |
+
}
|
429 |
+
$name = $attribute->is_taxonomy() ? $attributeName : $attribute->get_name();
|
430 |
+
if (!$this->getImportService()->isUpdateAttribute($name, $this->getPid(), $this->isNewProduct()) || $isAddNew) {
|
431 |
+
$productAttributes[$attributeName] = array(
|
432 |
+
'name' => $attribute->is_taxonomy() ? urldecode_deep($attributeName) : $attribute->get_name(),
|
433 |
+
'value' => $attribute->is_taxonomy() ? $attribute->get_options() : implode("|", $attribute->get_options()),
|
434 |
+
'is_visible' => $attribute->get_visible(),
|
435 |
+
'in_variation' => $attribute->get_variation(),
|
436 |
+
'position' => $attribute->get_position()
|
437 |
+
);
|
438 |
+
}
|
439 |
+
if ($isAddNew && isset($parsedAttributes[$attributeName])) {
|
440 |
+
$productAttributes[$attributeName]['value'] = array_merge($productAttributes[$attributeName]['value'], $parsedAttributes[$attributeName]['value']);
|
441 |
+
}
|
442 |
+
}
|
443 |
+
$parsedAttributes = array_merge($parsedAttributes, $productAttributes);
|
444 |
+
}
|
445 |
+
// Prepare attributes for response.
|
446 |
+
foreach ($parsedAttributes as $parsedAttribute) {
|
447 |
+
$data['attribute_names'][] = $parsedAttribute['name'];
|
448 |
+
$data['attribute_values'][] = $parsedAttribute['value'];
|
449 |
+
$data['attribute_visibility'][] = empty($parsedAttribute['is_visible']) ? NULL : TRUE;
|
450 |
+
$data['attribute_variation'][] = empty($parsedAttribute['in_variation']) ? NULL : TRUE;
|
451 |
+
$data['attribute_position'][] = $parsedAttribute['position'];
|
452 |
+
}
|
453 |
+
return $data;
|
454 |
+
}
|
455 |
+
|
456 |
+
/**
|
457 |
+
* Define advanced properties.
|
458 |
+
*/
|
459 |
+
public function prepareAdvancedProperties() {
|
460 |
+
// Import product comment status.
|
461 |
+
$this->setProperty('purchase_note', wp_kses_post(stripslashes($this->getValue('product_purchase_note'))));
|
462 |
+
$this->setProperty('reviews_allowed', $this->getValue('product_enable_reviews') == 'yes');
|
463 |
+
// Import product menu order.
|
464 |
+
$this->setProperty('menu_order', $this->getValue('product_menu_order') != '' ? (int) $this->getValue('product_menu_order') : 0);
|
465 |
+
// Import total sales.
|
466 |
+
$total_sales = get_post_meta($this->getPid(), 'total_sales', true);
|
467 |
+
if ( empty($total_sales)) {
|
468 |
+
update_post_meta($this->getPid(), 'total_sales', '0');
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
/*
|
473 |
+
|--------------------------------------------------------------------------
|
474 |
+
| Product Import Methods
|
475 |
+
|--------------------------------------------------------------------------
|
476 |
+
*/
|
477 |
+
|
478 |
+
/**
|
479 |
+
* Get shipping class.
|
480 |
+
*/
|
481 |
+
private function getShippingClass() {
|
482 |
+
$shipping_class = $this->getValue('product_shipping_class');
|
483 |
+
if ( $shipping_class != '' && $shipping_class != '-1') {
|
484 |
+
if (!is_numeric($shipping_class)){
|
485 |
+
$term = is_exists_term( $shipping_class, 'product_shipping_class');
|
486 |
+
// For compatibility with WPML plugin.
|
487 |
+
$term = apply_filters('wp_all_import_term_exists', $term, 'product_shipping_class', $shipping_class, null);
|
488 |
+
}
|
489 |
+
else {
|
490 |
+
$term = is_exists_term( (int) $shipping_class, 'product_shipping_class');
|
491 |
+
if (empty($term) || is_wp_error($term)) {
|
492 |
+
$term = is_exists_term( $shipping_class, 'product_shipping_class');
|
493 |
+
}
|
494 |
+
}
|
495 |
+
// The term to check. Accepts term ID, slug, or name.
|
496 |
+
if (!empty($term) && !is_wp_error($term)){
|
497 |
+
$shipping_class = (int) $term['term_id'];
|
498 |
+
}
|
499 |
+
else {
|
500 |
+
$term = wp_insert_term($shipping_class, 'product_shipping_class');
|
501 |
+
if (!empty($term) && !is_wp_error($term)) {
|
502 |
+
$shipping_class = (int) $term['term_id'];
|
503 |
+
}
|
504 |
+
}
|
505 |
+
|
506 |
+
if (empty($term) || is_wp_error($term)) {
|
507 |
+
$shipping_class = '';
|
508 |
+
}
|
509 |
+
}
|
510 |
+
return $shipping_class;
|
511 |
+
}
|
512 |
+
|
513 |
+
/**
|
514 |
+
* Generate product SKU.
|
515 |
+
*/
|
516 |
+
protected function generateSKU() {
|
517 |
+
|
518 |
+
// Unique SKU.
|
519 |
+
$newSKU = wc_clean( trim( stripslashes( $this->getValue('product_sku') ) ) );
|
520 |
+
|
521 |
+
if ( ( in_array($this->productType, array('variation', 'variable')) || $this->getValue('product_types') == "variable" ) && ! $this->getImport()->options['link_all_variations'] ){
|
522 |
+
$identity = FALSE;
|
523 |
+
switch ($this->getImport()->options['matching_parent']){
|
524 |
+
case 'first_is_parent_id':
|
525 |
+
$identity = $this->getValue('single_product_first_is_parent_id_parent_sku');
|
526 |
+
break;
|
527 |
+
case 'first_is_variation':
|
528 |
+
$identity = $this->getValue('single_product_first_is_parent_title_parent_sku');
|
529 |
+
break;
|
530 |
+
}
|
531 |
+
if (!empty($identity)) {
|
532 |
+
update_post_meta($this->getPid(), '_parent_sku', $identity);
|
533 |
+
}
|
534 |
+
}
|
535 |
+
|
536 |
+
if ($newSKU == '' && !$this->getImport()->options['disable_auto_sku_generation']) {
|
537 |
+
if ($this->isNewProduct() || $this->getImportService()->isUpdateCustomField('_sku')) {
|
538 |
+
if (!empty($this->getImport()->options['unique_key'])) {
|
539 |
+
try {
|
540 |
+
$tmp_files = array();
|
541 |
+
$xpath = $this->getParser()->getXpath() . $this->getImport()->xpath;
|
542 |
+
$unique_keys = \XmlImportParser::factory($this->getParser()
|
543 |
+
->getXml(), $xpath, $this->getImport()->options['unique_key'], $file)
|
544 |
+
->parse();
|
545 |
+
$tmp_files[] = $file;
|
546 |
+
foreach ($tmp_files as $file) { // remove all temporary files created
|
547 |
+
@unlink($file);
|
548 |
+
}
|
549 |
+
$newSKU = substr(md5($unique_keys[$this->getIndex()]), 0, 12);
|
550 |
+
}
|
551 |
+
catch(\Exception $e){
|
552 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
553 |
+
}
|
554 |
+
}
|
555 |
+
|
556 |
+
if ( ( in_array($this->productType, array('variation', 'variable')) || $this->getValue('product_types') == "variable" ) && ! $this->getImport()->options['link_all_variations'] ) {
|
557 |
+
$identity = FALSE;
|
558 |
+
switch ($this->getImport()->options['matching_parent']){
|
559 |
+
case 'first_is_parent_id':
|
560 |
+
$identity = $this->getValue('single_product_first_is_parent_id_parent_sku');
|
561 |
+
break;
|
562 |
+
case 'first_is_variation':
|
563 |
+
$identity = $this->getValue('single_product_first_is_parent_title_parent_sku');
|
564 |
+
break;
|
565 |
+
}
|
566 |
+
if (empty($identity)){
|
567 |
+
update_post_meta($this->getPid(), '_parent_sku', strrev($newSKU));
|
568 |
+
}
|
569 |
+
}
|
570 |
+
}
|
571 |
+
}
|
572 |
+
return wc_clean($newSKU);
|
573 |
+
}
|
574 |
+
|
575 |
+
/**
|
576 |
+
* Import products grouping.
|
577 |
+
*/
|
578 |
+
protected function importGrouping() {
|
579 |
+
// Group products by Parent.
|
580 |
+
if (in_array($this->productType, array( 'simple', 'external', 'variable' ))) {
|
581 |
+
// Group all product to one parent ( no XPath provided ).
|
582 |
+
if ($this->getImport()->options['is_multiple_grouping_product'] != 'yes') {
|
583 |
+
// Trying to find parent product according to matching options.
|
584 |
+
if ($this->getImport()->options['grouping_indicator'] == 'xpath' && !is_numeric($this->getValue('product_grouping_parent'))) {
|
585 |
+
$post = pmxi_findDuplicates(array(
|
586 |
+
'post_type' => 'product',
|
587 |
+
'ID' => $this->getPid(),
|
588 |
+
'post_parent' => $this->getArticleData('post_parent'),
|
589 |
+
'post_title' => $this->getValue('product_grouping_parent')
|
590 |
+
));
|
591 |
+
if (!empty($post)) {
|
592 |
+
$this->setValue('product_grouping_parent', $post[0]);
|
593 |
+
}
|
594 |
+
else {
|
595 |
+
$this->setValue('product_grouping_parent', 0);
|
596 |
+
}
|
597 |
+
}
|
598 |
+
elseif ($this->getImport()->options['grouping_indicator'] != 'xpath') {
|
599 |
+
$post = pmxi_findDuplicates($this->getArticle(), $this->getValue('custom_grouping_indicator_name'), $this->getValue('custom_grouping_indicator_value'), 'custom field');
|
600 |
+
if (!empty($post)) {
|
601 |
+
$this->setValue('product_grouping_parent', array_shift($post));
|
602 |
+
}
|
603 |
+
else {
|
604 |
+
$this->setValue('product_grouping_parent', 0);
|
605 |
+
}
|
606 |
+
}
|
607 |
+
}
|
608 |
+
// Update `children` property of parent product with new item (current product).
|
609 |
+
if ($this->getValue('product_grouping_parent') != "" && absint($this->getValue('product_grouping_parent')) > 0) {
|
610 |
+
$this->product->set_parent_id(absint( $this->getValue('product_grouping_parent') ));
|
611 |
+
$all_grouped_products = get_post_meta($this->getValue('product_grouping_parent'), '_children', true);
|
612 |
+
if (empty($all_grouped_products)) {
|
613 |
+
$all_grouped_products = array();
|
614 |
+
}
|
615 |
+
if (!in_array($this->getPid(), $all_grouped_products)) {
|
616 |
+
$all_grouped_products[] = $this->getPid();
|
617 |
+
update_post_meta($this->getValue('product_grouping_parent'), '_children', $all_grouped_products);
|
618 |
+
}
|
619 |
+
}
|
620 |
+
}
|
621 |
+
}
|
622 |
+
|
623 |
+
/*
|
624 |
+
|--------------------------------------------------------------------------
|
625 |
+
| Getters & Setters
|
626 |
+
|--------------------------------------------------------------------------
|
627 |
+
*/
|
628 |
+
|
629 |
+
/**
|
630 |
+
* @return boolean
|
631 |
+
*/
|
632 |
+
public function isNewProduct() {
|
633 |
+
return $this->isNewProduct;
|
634 |
+
}
|
635 |
+
|
636 |
+
/**
|
637 |
+
* @return boolean
|
638 |
+
*/
|
639 |
+
public function isDownloadable() {
|
640 |
+
return $this->downloadable;
|
641 |
+
}
|
642 |
+
|
643 |
+
/**
|
644 |
+
* @return boolean
|
645 |
+
*/
|
646 |
+
public function isVirtual() {
|
647 |
+
return $this->virtual;
|
648 |
+
}
|
649 |
+
|
650 |
+
/**
|
651 |
+
* @return boolean
|
652 |
+
*/
|
653 |
+
public function isFeatured() {
|
654 |
+
return $this->featured;
|
655 |
+
}
|
656 |
+
|
657 |
+
/**
|
658 |
+
* @return \WC_Product
|
659 |
+
*/
|
660 |
+
public function getProduct() {
|
661 |
+
return $this->product;
|
662 |
+
}
|
663 |
+
|
664 |
+
/**
|
665 |
+
* @param \WC_Product $product
|
666 |
+
*/
|
667 |
+
public function setProduct($product) {
|
668 |
+
$this->product = $product;
|
669 |
+
}
|
670 |
+
|
671 |
+
/**
|
672 |
+
* @param $property
|
673 |
+
* @param $value
|
674 |
+
*/
|
675 |
+
public function setProperty($property, $value) {
|
676 |
+
switch ($property) {
|
677 |
+
case 'attributes':
|
678 |
+
case 'menu_order':
|
679 |
+
case 'catalog_visibility':
|
680 |
+
if ($this->getImportService()->isUpdateDataAllowed('is_update_' . $property, $this->isNewProduct())) {
|
681 |
+
$this->productProperties[$property] = $value;
|
682 |
+
}
|
683 |
+
break;
|
684 |
+
case 'featured':
|
685 |
+
if ($this->getImportService()->isUpdateDataAllowed('is_update_featured_status', $this->isNewProduct())) {
|
686 |
+
$this->productProperties[$property] = $value;
|
687 |
+
}
|
688 |
+
break;
|
689 |
+
case 'description':
|
690 |
+
if ($this->isNewProduct() || $this->getImportService()->isUpdateCustomField('_variation_description')) {
|
691 |
+
$this->productProperties[$property] = $value;
|
692 |
+
}
|
693 |
+
break;
|
694 |
+
case 'stock_status':
|
695 |
+
// As of WooCommerce 3.0 stock status is automatically updated when stock is updated.
|
696 |
+
if ($this->isNewProduct() || $this->getImportService()->isUpdateCustomField('_stock')) {
|
697 |
+
$this->productProperties[$property] = $value;
|
698 |
+
}
|
699 |
+
break;
|
700 |
+
default:
|
701 |
+
if ($this->isNewProduct() || $this->getImportService()->isUpdateCustomField($this->getPropertyMetaKey($property))) {
|
702 |
+
$this->productProperties[$property] = $value;
|
703 |
+
}
|
704 |
+
break;
|
705 |
+
}
|
706 |
+
}
|
707 |
+
|
708 |
+
/**
|
709 |
+
* @param $property
|
710 |
+
*
|
711 |
+
* @return mixed
|
712 |
+
*/
|
713 |
+
private function getPropertyMetaKey($property) {
|
714 |
+
switch ($property) {
|
715 |
+
case 'stock_quantity':
|
716 |
+
$property = '_stock';
|
717 |
+
break;
|
718 |
+
case 'date_on_sale_to':
|
719 |
+
$property = '_sale_price_dates_to';
|
720 |
+
break;
|
721 |
+
case 'date_on_sale_from':
|
722 |
+
$property = '_sale_price_dates_from';
|
723 |
+
break;
|
724 |
+
}
|
725 |
+
return '_' === substr( $property, 0, 1 ) ? $property : '_' . $property;
|
726 |
+
}
|
727 |
+
|
728 |
+
/**
|
729 |
+
* @param $property
|
730 |
+
* @return mixed|null
|
731 |
+
*/
|
732 |
+
public function getProperty($property) {
|
733 |
+
return isset($this->productProperties[$property]) ? $this->productProperties[$property] : null;
|
734 |
+
}
|
735 |
+
}
|
libraries/importer/products/ImportProductBase.php
ADDED
@@ -0,0 +1,259 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\parser\ParserInterface;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Created by PhpStorm.
|
9 |
+
* User: cmd
|
10 |
+
* Date: 11/15/17
|
11 |
+
* Time: 2:10 PM
|
12 |
+
*/
|
13 |
+
abstract class ImportProductBase extends ImportBase {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* @var
|
17 |
+
*/
|
18 |
+
public $product_data;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* @return mixed
|
22 |
+
*/
|
23 |
+
public function getProductID() {
|
24 |
+
return $this->index->getPid();
|
25 |
+
}
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @return bool|\WC_Product
|
29 |
+
*/
|
30 |
+
public function getProduct() {
|
31 |
+
return new \WC_Product($this->getProductID());
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @return ParserInterface
|
36 |
+
*/
|
37 |
+
public function getParser() {
|
38 |
+
return $this->getOptions()->getParser();
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* @param $product \WC_Product_Variation
|
43 |
+
* @return mixed|void
|
44 |
+
*/
|
45 |
+
protected function generateProductTitle($product) {
|
46 |
+
|
47 |
+
$attributes = (array) $product->get_attributes();
|
48 |
+
|
49 |
+
// Don't include attributes if the product has 3+ attributes.
|
50 |
+
$should_include_attributes = count( $attributes ) < 3;
|
51 |
+
|
52 |
+
// Don't include attributes if an attribute name has 2+ words.
|
53 |
+
if ( $should_include_attributes ) {
|
54 |
+
foreach ( $attributes as $name => $value ) {
|
55 |
+
if ( false !== strpos( $name, '-' ) ) {
|
56 |
+
$should_include_attributes = false;
|
57 |
+
break;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
|
62 |
+
$should_include_attributes = apply_filters( 'woocommerce_product_variation_title_include_attributes', $should_include_attributes, $product );
|
63 |
+
$separator = apply_filters( 'woocommerce_product_variation_title_attributes_separator', ' - ', $product );
|
64 |
+
$title_base = get_post_field( 'post_title', $product->get_parent_id() );
|
65 |
+
$title_suffix = $should_include_attributes ? wc_get_formatted_variation( $product, true, false ) : '';
|
66 |
+
|
67 |
+
return apply_filters( 'woocommerce_product_variation_title', rtrim( $title_base . $separator . $title_suffix, $separator ), $product, $title_base, $title_suffix );
|
68 |
+
}
|
69 |
+
|
70 |
+
/**
|
71 |
+
* @param $variation \WC_Product_Variation
|
72 |
+
* @param $parentProduct \WC_Product
|
73 |
+
*/
|
74 |
+
protected function duplicatePostMeta($variation, $parentProduct) {
|
75 |
+
$properties = $parentProduct->get_data();
|
76 |
+
$variation->set_props($properties);
|
77 |
+
if ($this->getImport()->options['put_variation_image_to_gallery']) {
|
78 |
+
$post_thumbnail_id = get_post_thumbnail_id($parentProduct->get_id());
|
79 |
+
do_action('pmxi_gallery_image', $variation->get_id(), $post_thumbnail_id, FALSE);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
/**
|
84 |
+
*
|
85 |
+
* Get list of Linked Product IDs.
|
86 |
+
*
|
87 |
+
* @param $pid - Current product ID.
|
88 |
+
* @param $products - Products which needs to be linked.
|
89 |
+
* @param $type
|
90 |
+
*
|
91 |
+
* @return array
|
92 |
+
*/
|
93 |
+
protected function getLinkedProducts($pid, $products, $type) {
|
94 |
+
$linked_products = array();
|
95 |
+
if (!empty($products)) {
|
96 |
+
$not_found = [];
|
97 |
+
$ids = array_filter(explode(',', $products), 'trim');
|
98 |
+
foreach ($ids as $id) {
|
99 |
+
// Do not link product to himself.
|
100 |
+
if ($id == $pid) continue;
|
101 |
+
// Search linked product by _SKU.
|
102 |
+
$args = [
|
103 |
+
'post_type' => ['product', 'product_variation'],
|
104 |
+
'meta_query' => [
|
105 |
+
[
|
106 |
+
'key' => '_sku',
|
107 |
+
'value' => $id,
|
108 |
+
]
|
109 |
+
]
|
110 |
+
];
|
111 |
+
$query = new \WP_Query($args);
|
112 |
+
$linked_product = FALSE;
|
113 |
+
if ($query->have_posts()) {
|
114 |
+
$linked_product = get_post($query->post->ID);
|
115 |
+
}
|
116 |
+
wp_reset_postdata();
|
117 |
+
if (!$linked_product) {
|
118 |
+
if (is_numeric($id)) {
|
119 |
+
// Search linked product by ID.
|
120 |
+
$query = new \WP_Query([
|
121 |
+
'post_type' => [
|
122 |
+
'product',
|
123 |
+
'product_variation'
|
124 |
+
],
|
125 |
+
'post__in' => [$id]
|
126 |
+
]);
|
127 |
+
if ($query->have_posts()) {
|
128 |
+
$linked_product = get_post($query->post->ID);
|
129 |
+
}
|
130 |
+
wp_reset_postdata();
|
131 |
+
}
|
132 |
+
if (!$linked_product) {
|
133 |
+
// Search linked product by slug.
|
134 |
+
$args = [
|
135 |
+
'name' => $id,
|
136 |
+
'post_type' => 'product',
|
137 |
+
'post_status' => 'publish',
|
138 |
+
'numberposts' => 1
|
139 |
+
];
|
140 |
+
$query = get_posts($args);
|
141 |
+
if ($query) {
|
142 |
+
$linked_product = $query[0];
|
143 |
+
}
|
144 |
+
wp_reset_postdata();
|
145 |
+
if (!$linked_product) {
|
146 |
+
// Search linked product by title.
|
147 |
+
$linked_product = get_page_by_title( $id, OBJECT, 'product' );
|
148 |
+
}
|
149 |
+
}
|
150 |
+
}
|
151 |
+
if ($linked_product) {
|
152 |
+
// Do not link product to himself.
|
153 |
+
if ($pid == $linked_product->ID) {
|
154 |
+
continue;
|
155 |
+
}
|
156 |
+
$linked_products[] = $linked_product->ID;
|
157 |
+
$this->getLogger() and call_user_func($this->getLogger(), sprintf(__('Product `%s` with ID `%d` added to %s list.', \PMWI_Plugin::TEXT_DOMAIN), $linked_product->post_title, $linked_product->ID, $type == '_upsell_ids' ? 'Up-Sells' : 'Cross-Sells'));
|
158 |
+
}
|
159 |
+
else {
|
160 |
+
$not_found[] = $id;
|
161 |
+
}
|
162 |
+
}
|
163 |
+
|
164 |
+
// Not all linked products founded.
|
165 |
+
if (!empty($not_found)) {
|
166 |
+
$not_founded_linked_products = get_option('wp_all_import_not_linked_products_' . $this->getImport()->id);
|
167 |
+
if (empty($not_founded_linked_products)) {
|
168 |
+
$not_founded_linked_products = [];
|
169 |
+
}
|
170 |
+
$not_founded_linked_products[] = [
|
171 |
+
'pid' => $pid,
|
172 |
+
'type' => $type,
|
173 |
+
'not_linked_products' => $not_found
|
174 |
+
];
|
175 |
+
update_option('wp_all_import_not_linked_products_' . $this->getImport()->id, $not_founded_linked_products);
|
176 |
+
}
|
177 |
+
}
|
178 |
+
return $linked_products;
|
179 |
+
}
|
180 |
+
|
181 |
+
/**
|
182 |
+
* @param $url
|
183 |
+
*/
|
184 |
+
protected function autoCloakLinks(&$url){
|
185 |
+
|
186 |
+
$url = apply_filters('pmwi_cloak_affiliate_url', trim($url), $this->getImport()->id);
|
187 |
+
|
188 |
+
// cloak urls with `WP Wizard Cloak` if corresponding option is set
|
189 |
+
if ( ! empty($this->getImport()->options['is_cloak']) and class_exists('PMLC_Plugin')) {
|
190 |
+
if (preg_match('%^\w+://%i', $url)) { // mask only links having protocol
|
191 |
+
// try to find matching cloaked link among already registered ones
|
192 |
+
$list = new PMLC_Link_List(); $linkTable = $list->getTable();
|
193 |
+
$rule = new PMLC_Rule_Record(); $ruleTable = $rule->getTable();
|
194 |
+
$dest = new PMLC_Destination_Record(); $destTable = $dest->getTable();
|
195 |
+
$list->join($ruleTable, "$ruleTable.link_id = $linkTable.id")
|
196 |
+
->join($destTable, "$destTable.rule_id = $ruleTable.id")
|
197 |
+
->setColumns("$linkTable.*")
|
198 |
+
->getBy(array(
|
199 |
+
"$linkTable.destination_type =" => 'ONE_SET',
|
200 |
+
"$linkTable.is_trashed =" => 0,
|
201 |
+
"$linkTable.preset =" => '',
|
202 |
+
"$linkTable.expire_on =" => '0000-00-00',
|
203 |
+
"$ruleTable.type =" => 'ONE_SET',
|
204 |
+
"$destTable.weight =" => 100,
|
205 |
+
"$destTable.url LIKE" => $url,
|
206 |
+
), NULL, 1, 1)->convertRecords();
|
207 |
+
if ($list->count()) { // matching link found
|
208 |
+
$link = $list[0];
|
209 |
+
} else { // register new cloaked link
|
210 |
+
global $wpdb;
|
211 |
+
$slug = max(
|
212 |
+
intval($wpdb->get_var("SELECT MAX(CONVERT(name, SIGNED)) FROM $linkTable")),
|
213 |
+
intval($wpdb->get_var("SELECT MAX(CONVERT(slug, SIGNED)) FROM $linkTable")),
|
214 |
+
0
|
215 |
+
);
|
216 |
+
$i = 0; do {
|
217 |
+
is_int(++$slug) and $slug > 0 or $slug = 1;
|
218 |
+
$is_slug_found = ! intval($wpdb->get_var("SELECT COUNT(*) FROM $linkTable WHERE name = '$slug' OR slug = '$slug'"));
|
219 |
+
} while( ! $is_slug_found and $i++ < 100000);
|
220 |
+
if ($is_slug_found) {
|
221 |
+
$link = new PMLC_Link_Record(array(
|
222 |
+
'name' => strval($slug),
|
223 |
+
'slug' => strval($slug),
|
224 |
+
'header_tracking_code' => '',
|
225 |
+
'footer_tracking_code' => '',
|
226 |
+
'redirect_type' => '301',
|
227 |
+
'destination_type' => 'ONE_SET',
|
228 |
+
'preset' => '',
|
229 |
+
'forward_url_params' => 1,
|
230 |
+
'no_global_tracking_code' => 0,
|
231 |
+
'expire_on' => '0000-00-00',
|
232 |
+
'created_on' => date('Y-m-d H:i:s'),
|
233 |
+
'is_trashed' => 0,
|
234 |
+
));
|
235 |
+
$link->insert();
|
236 |
+
$rule = new PMLC_Rule_Record(array(
|
237 |
+
'link_id' => $link->id,
|
238 |
+
'type' => 'ONE_SET',
|
239 |
+
'rule' => '',
|
240 |
+
));
|
241 |
+
$rule->insert();
|
242 |
+
$dest = new PMLC_Destination_Record(array(
|
243 |
+
'rule_id' => $rule->id,
|
244 |
+
'url' => $url,
|
245 |
+
'weight' => 100,
|
246 |
+
));
|
247 |
+
$dest->insert();
|
248 |
+
} else {
|
249 |
+
$this->getLogger() and call_user_func($this->getLogger(), sprintf(__('- <b>WARNING</b>: Unable to create cloaked link for %s', \PMWI_Plugin::TEXT_DOMAIN), $url));
|
250 |
+
$link = NULL;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
if ($link) { // cloaked link is found or created for url
|
254 |
+
$url = preg_replace('%' . preg_quote($url, '%') . '(?=([\s\'"]|$))%i', $link->getUrl(), $url);
|
255 |
+
}
|
256 |
+
}
|
257 |
+
}
|
258 |
+
}
|
259 |
+
}
|
libraries/importer/products/ImportSimpleProduct.php
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\importer;
|
4 |
+
|
5 |
+
require_once dirname(__FILE__) . '/ImportProduct.php';
|
6 |
+
|
7 |
+
/**
|
8 |
+
*
|
9 |
+
* Import Simple Product
|
10 |
+
*
|
11 |
+
* Class ImportSimpleProduct
|
12 |
+
* @package wpai_woocommerce_add_on\libraries\importer
|
13 |
+
*/
|
14 |
+
class ImportSimpleProduct extends ImportProduct {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var string
|
18 |
+
*/
|
19 |
+
protected $productType = 'simple';
|
20 |
+
|
21 |
+
/**
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
public function import() {
|
25 |
+
parent::import();
|
26 |
+
}
|
27 |
+
}
|
libraries/parser/Parser.php
ADDED
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\parser;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\helpers\ParserOptions;
|
6 |
+
use XmlImportWooCommerceService;
|
7 |
+
|
8 |
+
require_once dirname(__FILE__) . '/ParserInterface.php';
|
9 |
+
|
10 |
+
/**
|
11 |
+
* Class Parser
|
12 |
+
* @package wpai_woocommerce_add_on\libraries\parser
|
13 |
+
*/
|
14 |
+
abstract class Parser implements ParserInterface {
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @var ParserOptions
|
18 |
+
*/
|
19 |
+
public $options;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* An array with parsed data.
|
23 |
+
*
|
24 |
+
* @var array
|
25 |
+
*/
|
26 |
+
public $data;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
+
public $tmp_files;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var XmlImportWooCommerceService
|
35 |
+
*/
|
36 |
+
public $importService;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* ProductsParser constructor.
|
40 |
+
*
|
41 |
+
* @param ParserOptions $options
|
42 |
+
*/
|
43 |
+
public function __construct(ParserOptions $options) {
|
44 |
+
$this->options = $options;
|
45 |
+
$this->importService = XmlImportWooCommerceService::getInstance();
|
46 |
+
}
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @return \XmlImportWooCommerceService
|
50 |
+
*/
|
51 |
+
public function getImportService() {
|
52 |
+
return $this->importService;
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* @param $option
|
57 |
+
* @param $index
|
58 |
+
* @return mixed
|
59 |
+
*/
|
60 |
+
public function getValue($option, $index) {
|
61 |
+
return $this->data[$option][$index];
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @return ParserOptions
|
66 |
+
*/
|
67 |
+
public function getOptions() {
|
68 |
+
return $this->options;
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* @return \PMXI_Import_Record
|
73 |
+
*/
|
74 |
+
public function getImport() {
|
75 |
+
return $this->getOptions()->import;
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @param \PMXI_Import_Record $import
|
80 |
+
*/
|
81 |
+
public function setImport($import) {
|
82 |
+
$this->getOptions()->import = $import;
|
83 |
+
}
|
84 |
+
|
85 |
+
/**
|
86 |
+
* @return string
|
87 |
+
*/
|
88 |
+
public function getXml() {
|
89 |
+
return $this->getOptions()->xml;
|
90 |
+
}
|
91 |
+
|
92 |
+
/**
|
93 |
+
* @param string $xml
|
94 |
+
*/
|
95 |
+
public function setXml($xml) {
|
96 |
+
$this->getOptions()->xml = $xml;
|
97 |
+
}
|
98 |
+
|
99 |
+
/**
|
100 |
+
* @return mixed
|
101 |
+
*/
|
102 |
+
public function getLogger() {
|
103 |
+
return $this->getOptions()->logger;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* @param mixed $logger
|
108 |
+
*/
|
109 |
+
public function setLogger($logger) {
|
110 |
+
$this->getOptions()->logger = $logger;
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* @return mixed
|
115 |
+
*/
|
116 |
+
public function getCount() {
|
117 |
+
return $this->getOptions()->count;
|
118 |
+
}
|
119 |
+
|
120 |
+
/**
|
121 |
+
* @param mixed $count
|
122 |
+
*/
|
123 |
+
public function setCount($count) {
|
124 |
+
$this->getOptions()->count = $count;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* @return mixed
|
129 |
+
*/
|
130 |
+
public function getChunk() {
|
131 |
+
return $this->getOptions()->chunk;
|
132 |
+
}
|
133 |
+
|
134 |
+
/**
|
135 |
+
* @param mixed $chunk
|
136 |
+
*/
|
137 |
+
public function setChunk($chunk) {
|
138 |
+
$this->getOptions()->chunk = $chunk;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* @return mixed
|
143 |
+
*/
|
144 |
+
public function getXpath() {
|
145 |
+
return $this->getOptions()->xpath;
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* @param mixed $xpath
|
150 |
+
*/
|
151 |
+
public function setXpath($xpath) {
|
152 |
+
$this->getOptions()->xpath = $xpath;
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* @return mixed
|
157 |
+
*/
|
158 |
+
public function getWpdb() {
|
159 |
+
return $this->getOptions()->wpdb;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @param mixed $wpdb
|
164 |
+
*/
|
165 |
+
public function setWpdb($wpdb) {
|
166 |
+
$this->getOptions()->wpdb = $wpdb;
|
167 |
+
}
|
168 |
+
|
169 |
+
/**
|
170 |
+
* @return mixed
|
171 |
+
*/
|
172 |
+
public function getData() {
|
173 |
+
return $this->data;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* @param mixed $data
|
178 |
+
*/
|
179 |
+
public function setData($data) {
|
180 |
+
$this->data = $data;
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* @param $price
|
185 |
+
* @return mixed
|
186 |
+
*/
|
187 |
+
protected function preparePrice($price) {
|
188 |
+
return $this->getImportService()->getPriceService()->preparePrice( $price,
|
189 |
+
$this->getImport()->options['disable_prepare_price'],
|
190 |
+
$this->getImport()->options['prepare_price_to_woo_format'],
|
191 |
+
$this->getImport()->options['convert_decimal_separator']
|
192 |
+
);
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* @param $price
|
197 |
+
* @param $field
|
198 |
+
* @return float|int|string
|
199 |
+
*/
|
200 |
+
protected function adjustPrice($price, $field) {
|
201 |
+
return $this->getImportService()->getPriceService()->adjustPrice($price, $field);
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Remove all temporary created files.
|
206 |
+
*/
|
207 |
+
public function unlinkTempFiles() {
|
208 |
+
foreach ($this->tmp_files as $file) { // remove all temporary files created
|
209 |
+
unlink($file);
|
210 |
+
}
|
211 |
+
$this->tmp_files = array();
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Add message into import log.
|
216 |
+
*
|
217 |
+
* @param $msg
|
218 |
+
*/
|
219 |
+
public function log($msg) {
|
220 |
+
$this->getLogger() and call_user_func($this->getLogger(), $msg);
|
221 |
+
}
|
222 |
+
}
|
libraries/parser/ParserFactory.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\parser;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\helpers\ParserOptions;
|
6 |
+
|
7 |
+
/**
|
8 |
+
*
|
9 |
+
* Creates parser for particular entity type
|
10 |
+
*
|
11 |
+
* Created by PhpStorm.
|
12 |
+
* User: cmd
|
13 |
+
* Date: 11/14/17
|
14 |
+
* Time: 11:37 AM
|
15 |
+
*/
|
16 |
+
class ParserFactory {
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @param $type
|
20 |
+
* @param $options
|
21 |
+
* @return Parser|bool
|
22 |
+
*/
|
23 |
+
public static function generate($type, $options) {
|
24 |
+
// Init parser options.
|
25 |
+
$parserOptions = new ParserOptions($options);
|
26 |
+
// Define parser class.
|
27 |
+
$parser = FALSE;
|
28 |
+
switch ($type){
|
29 |
+
case 'orders':
|
30 |
+
$parser = new OrdersParser($parserOptions);
|
31 |
+
break;
|
32 |
+
case 'products':
|
33 |
+
$parser = new ProductsParser($parserOptions);
|
34 |
+
break;
|
35 |
+
}
|
36 |
+
return $parser;
|
37 |
+
}
|
38 |
+
}
|
libraries/parser/ParserInterface.php
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\parser;
|
4 |
+
|
5 |
+
use wpai_woocommerce_add_on\libraries\helpers\ParserOptions;
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Interface ParserInterface
|
9 |
+
* @package wpai_woocommerce_add_on\libraries\parser
|
10 |
+
*/
|
11 |
+
interface ParserInterface {
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @return mixed
|
15 |
+
*/
|
16 |
+
public function parse();
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @return mixed
|
20 |
+
*/
|
21 |
+
public function getData();
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @return \PMXI_Import_Record
|
25 |
+
*/
|
26 |
+
public function getImport();
|
27 |
+
|
28 |
+
/**
|
29 |
+
* @return ParserOptions
|
30 |
+
*/
|
31 |
+
public function getOptions();
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @return mixed
|
35 |
+
*/
|
36 |
+
public function getLogger();
|
37 |
+
|
38 |
+
}
|
libraries/parser/ProductsParser.php
ADDED
@@ -0,0 +1,118 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\parser;
|
4 |
+
|
5 |
+
require_once dirname(__FILE__) . '/ProductsParserBase.php';
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Class ProductsParser
|
9 |
+
* @package wpai_woocommerce_add_on\libraries\parser
|
10 |
+
*/
|
11 |
+
class ProductsParser extends ProductsParserBase {
|
12 |
+
|
13 |
+
/**
|
14 |
+
*
|
15 |
+
* Parse WooCommerce Products Import Template.
|
16 |
+
*
|
17 |
+
* @return array
|
18 |
+
*/
|
19 |
+
public function parse() {
|
20 |
+
$this->data = array();
|
21 |
+
$this->getChunk() == 1 && $this->log(__('Composing product data...', \PMWI_Plugin::TEXT_DOMAIN));
|
22 |
+
foreach ($this->getParsingWorkflow() as $callback => $options) {
|
23 |
+
if (!empty($options)) {
|
24 |
+
array_map(array($this, $callback), $options);
|
25 |
+
continue;
|
26 |
+
}
|
27 |
+
call_user_func(array($this, $callback));
|
28 |
+
}
|
29 |
+
$options = $this->getOptionsType_6();
|
30 |
+
foreach ($options as $m_option => $s_option) {
|
31 |
+
$this->parseOptionType_6($m_option, $s_option);
|
32 |
+
}
|
33 |
+
// Remove all temporary files created.
|
34 |
+
$this->unlinkTempFiles();
|
35 |
+
return $this->data;
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Get parsing workflow, where keys are callbacks for values.
|
40 |
+
*
|
41 |
+
* @return array
|
42 |
+
*/
|
43 |
+
public function getParsingWorkflow() {
|
44 |
+
return array(
|
45 |
+
'parseOptionType_1' => array(
|
46 |
+
'product_virtual',
|
47 |
+
'product_downloadable',
|
48 |
+
'product_enabled',
|
49 |
+
'product_featured',
|
50 |
+
'product_visibility',
|
51 |
+
'product_enable_reviews',
|
52 |
+
'product_manage_stock'
|
53 |
+
),
|
54 |
+
'parseOptionType_2' => array(
|
55 |
+
'product_id',
|
56 |
+
'product_parent_id',
|
57 |
+
'product_id_first_is_parent_id',
|
58 |
+
'product_id_first_is_parent_title',
|
59 |
+
'product_id_first_is_variation',
|
60 |
+
'product_first_is_parent_id_parent_sku',
|
61 |
+
'product_first_is_parent_title_parent_sku'
|
62 |
+
),
|
63 |
+
'parseOptionType_3' => array(
|
64 |
+
'product_sku',
|
65 |
+
'product_variation_description',
|
66 |
+
'product_url',
|
67 |
+
'product_button_text',
|
68 |
+
'product_regular_price',
|
69 |
+
'product_sale_price',
|
70 |
+
'product_whosale_price',
|
71 |
+
'product_files',
|
72 |
+
'product_files_names',
|
73 |
+
'product_download_limit',
|
74 |
+
'product_download_expiry',
|
75 |
+
'product_download_type',
|
76 |
+
'product_stock_qty',
|
77 |
+
'product_low_stock_amount',
|
78 |
+
'product_weight',
|
79 |
+
'product_length',
|
80 |
+
'product_width',
|
81 |
+
'product_height',
|
82 |
+
'product_up_sells',
|
83 |
+
'product_cross_sells',
|
84 |
+
'product_purchase_note',
|
85 |
+
'product_menu_order'
|
86 |
+
),
|
87 |
+
'parseOptionType_4' => array(
|
88 |
+
'sale_price_dates_from',
|
89 |
+
'sale_price_dates_to'
|
90 |
+
),
|
91 |
+
'parseOptionType_5' => array(
|
92 |
+
'type',
|
93 |
+
'tax_status',
|
94 |
+
'tax_class',
|
95 |
+
'shipping_class'
|
96 |
+
),
|
97 |
+
'parseStockStatus' => array(),
|
98 |
+
'parseGroupingProducts' => array(),
|
99 |
+
'parseVariationsManageStock' => array(),
|
100 |
+
'parseVariationsStockQty' => array(),
|
101 |
+
'parseVariationsStockStatus' => array(),
|
102 |
+
'parseVariationsEnabled' => array(),
|
103 |
+
'parseProductMatching' => array(),
|
104 |
+
'parseMatchingExistingParentProducts' => array(),
|
105 |
+
'parseAttributes' => array()
|
106 |
+
);
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @return array
|
111 |
+
*/
|
112 |
+
protected function getOptionsType_6() {
|
113 |
+
return array(
|
114 |
+
'product_allow_backorders' => 'single_product_allow_backorders',
|
115 |
+
'product_sold_individually' => 'single_product_sold_individually'
|
116 |
+
);
|
117 |
+
}
|
118 |
+
}
|
libraries/parser/ProductsParserBase.php
ADDED
@@ -0,0 +1,442 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace wpai_woocommerce_add_on\libraries\parser;
|
4 |
+
|
5 |
+
use XmlImportParser;
|
6 |
+
|
7 |
+
require_once dirname(__FILE__) . '/Parser.php';
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Class ProductsParserBase
|
11 |
+
* @package wpai_woocommerce_add_on\libraries\parser
|
12 |
+
*/
|
13 |
+
abstract class ProductsParserBase extends Parser {
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Get complete XPath expression for parser factory.
|
17 |
+
*
|
18 |
+
* @return string
|
19 |
+
*/
|
20 |
+
public function getCompleteXPath() {
|
21 |
+
return $this->getXpath() . $this->getImport()->xpath;
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @param $option
|
26 |
+
* @param $m_option
|
27 |
+
* @param $s_option
|
28 |
+
*/
|
29 |
+
public function parseXPathOption($option, $m_option, $s_option) {
|
30 |
+
try {
|
31 |
+
if ($this->getImport()->options[$m_option] == 'xpath' and "" != $this->getImport()->options[$s_option]) {
|
32 |
+
$this->data[$option] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options[$s_option], $file)
|
33 |
+
->parse();
|
34 |
+
$this->tmp_files[] = $file;
|
35 |
+
}
|
36 |
+
else {
|
37 |
+
$this->getCount() and $this->data[$option] = array_fill(0, $this->getCount(), $this->getImport()->options[$m_option]);
|
38 |
+
}
|
39 |
+
}
|
40 |
+
catch (\Exception $e) {
|
41 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Parse options type #1.
|
47 |
+
*
|
48 |
+
* @param $option
|
49 |
+
*/
|
50 |
+
public function parseOptionType_1($option) {
|
51 |
+
$this->parseXPathOption($option, 'is_' . $option, 'single_' . $option);
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Parse options type #2.
|
56 |
+
*
|
57 |
+
* @param $option
|
58 |
+
*/
|
59 |
+
public function parseOptionType_2($option) {
|
60 |
+
try {
|
61 |
+
if (isset($this->getImport()->options['single_' . $option]) && "" != $this->getImport()->options['single_' . $option]) {
|
62 |
+
$this->data['single_' . preg_replace("%id$%", "ID", $option)] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['single_' . $option], $file)
|
63 |
+
->parse();
|
64 |
+
$this->tmp_files[] = $file;
|
65 |
+
}
|
66 |
+
else {
|
67 |
+
$this->getCount() and $this->data['single_' . preg_replace("%id$%", "ID", $option)] = array_fill(0, $this->getCount(), "");
|
68 |
+
}
|
69 |
+
}
|
70 |
+
catch (\Exception $e) {
|
71 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
72 |
+
}
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Parse options type #3.
|
77 |
+
*
|
78 |
+
* @param $option
|
79 |
+
*/
|
80 |
+
public function parseOptionType_3($option) {
|
81 |
+
try {
|
82 |
+
if ("" != $this->getImport()->options['single_' . $option]) {
|
83 |
+
$this->data[$option] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['single_' . $option], $file)
|
84 |
+
->parse();
|
85 |
+
|
86 |
+
$this->tmp_files[] = $file;
|
87 |
+
|
88 |
+
switch ($option) {
|
89 |
+
case 'product_regular_price':
|
90 |
+
case 'product_sale_price':
|
91 |
+
$this->data[$option] = array_map(array(
|
92 |
+
$this,
|
93 |
+
'adjustPrice'
|
94 |
+
), array_map(array(
|
95 |
+
$this,
|
96 |
+
'preparePrice'
|
97 |
+
), $this->data[$option]), array_fill(0, $this->getCount(), preg_replace('%product_%', '', $option)));
|
98 |
+
break;
|
99 |
+
default:
|
100 |
+
break;
|
101 |
+
}
|
102 |
+
}
|
103 |
+
else {
|
104 |
+
$this->getCount() and $this->data[$option] = array_fill(0, $this->getCount(), "");
|
105 |
+
}
|
106 |
+
}
|
107 |
+
catch (\Exception $e) {
|
108 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
109 |
+
}
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Parse options type #4.
|
114 |
+
*
|
115 |
+
* @param $option
|
116 |
+
*/
|
117 |
+
public function parseOptionType_4($option) {
|
118 |
+
try {
|
119 |
+
if ($this->getImport()->options['is_regular_price_shedule'] and "" != $this->getImport()->options['single_' . $option]) {
|
120 |
+
$this->data['product_' . $option] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['single_' . $option], $file)
|
121 |
+
->parse();
|
122 |
+
$this->tmp_files[] = $file;
|
123 |
+
}
|
124 |
+
else {
|
125 |
+
$this->getCount() and $this->data['product_' . $option] = array_fill(0, $this->getCount(), "");
|
126 |
+
}
|
127 |
+
}
|
128 |
+
catch (\Exception $e) {
|
129 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
/**
|
134 |
+
* Parse options type #5.
|
135 |
+
*
|
136 |
+
* @param $option
|
137 |
+
*/
|
138 |
+
public function parseOptionType_5($option) {
|
139 |
+
try {
|
140 |
+
$option_name = ($option == 'type') ? 'types' : $option;
|
141 |
+
if ($this->getImport()->options['is_multiple_product_' . $option] != 'yes' and "" != $this->getImport()->options['single_product_' . $option]) {
|
142 |
+
$this->data['product_' . $option_name] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['single_product_' . $option], $file)
|
143 |
+
->parse();
|
144 |
+
$this->tmp_files[] = $file;
|
145 |
+
}
|
146 |
+
else {
|
147 |
+
$this->getCount() and $this->data['product_' . $option_name] = array_fill(0, $this->getCount(), $this->getImport()->options['multiple_product_' . $option]);
|
148 |
+
}
|
149 |
+
}
|
150 |
+
catch (\Exception $e) {
|
151 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
/**
|
156 |
+
* Parse options type #6.
|
157 |
+
*
|
158 |
+
* @param $m_option
|
159 |
+
* @param $s_option
|
160 |
+
*/
|
161 |
+
public function parseOptionType_6($m_option, $s_option) {
|
162 |
+
$this->parseXPathOption($m_option, $m_option, $s_option);
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* Parse Product Matching.
|
167 |
+
*/
|
168 |
+
public function parseProductMatching() {
|
169 |
+
if ($this->getImport()->options['matching_parent'] != "auto") {
|
170 |
+
switch ($this->getImport()->options['matching_parent']) {
|
171 |
+
case 'first_is_parent_id':
|
172 |
+
$this->data['single_product_parent_ID'] = $this->data['single_product_ID'] = $this->data['single_product_id_first_is_parent_ID'];
|
173 |
+
break;
|
174 |
+
case 'first_is_parent_title':
|
175 |
+
$this->data['single_product_parent_ID'] = $this->data['single_product_ID'] = $this->data['single_product_id_first_is_parent_title'];
|
176 |
+
break;
|
177 |
+
case 'first_is_variation':
|
178 |
+
$this->data['single_product_parent_ID'] = $this->data['single_product_ID'] = $this->data['single_product_id_first_is_variation'];
|
179 |
+
break;
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Parse Variations Manage Stock.
|
186 |
+
*/
|
187 |
+
public function parseVariationsManageStock() {
|
188 |
+
$this->parseXPathOption('v_product_manage_stock', 'is_variation_product_manage_stock', 'single_variation_product_manage_stock');
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Parse Variations Enabled.
|
193 |
+
*/
|
194 |
+
public function parseVariationsEnabled() {
|
195 |
+
$this->parseXPathOption('v_product_enabled', 'is_variable_product_enabled', 'single_variable_product_enabled');
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Parse Variations Stock Quantity.
|
200 |
+
*/
|
201 |
+
public function parseVariationsStockQty() {
|
202 |
+
try {
|
203 |
+
if ($this->getImport()->options['variation_stock'] != "") {
|
204 |
+
$this->data['v_stock'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['variation_stock'], $file)
|
205 |
+
->parse();
|
206 |
+
$this->tmp_files[] = $file;
|
207 |
+
}
|
208 |
+
else {
|
209 |
+
$this->getCount() and $this->data['v_stock'] = array_fill(0, $this->getCount(), '');
|
210 |
+
}
|
211 |
+
}
|
212 |
+
catch (\Exception $e) {
|
213 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Parse Grouping products.
|
219 |
+
*/
|
220 |
+
public function parseGroupingProducts() {
|
221 |
+
try {
|
222 |
+
if ($this->getImport()->options['is_multiple_grouping_product'] != 'yes') {
|
223 |
+
if ($this->getImport()->options['grouping_indicator'] == 'xpath') {
|
224 |
+
if ("" != $this->getImport()->options['single_grouping_product']) {
|
225 |
+
$this->data['product_grouping_parent'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['single_grouping_product'], $file)
|
226 |
+
->parse();
|
227 |
+
$this->tmp_files[] = $file;
|
228 |
+
}
|
229 |
+
else {
|
230 |
+
$this->getCount() and $this->data['product_grouping_parent'] = array_fill(0, $this->getCount(), $this->getImport()->options['multiple_grouping_product']);
|
231 |
+
}
|
232 |
+
}
|
233 |
+
else {
|
234 |
+
if ("" != $this->getImport()->options['custom_grouping_indicator_name'] and "" != $this->getImport()->options['custom_grouping_indicator_value']) {
|
235 |
+
$this->data['custom_grouping_indicator_name'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['custom_grouping_indicator_name'], $file)
|
236 |
+
->parse();
|
237 |
+
$this->tmp_files[] = $file;
|
238 |
+
$this->data['custom_grouping_indicator_value'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['custom_grouping_indicator_value'], $file)
|
239 |
+
->parse();
|
240 |
+
$this->tmp_files[] = $file;
|
241 |
+
}
|
242 |
+
else {
|
243 |
+
$this->getCount() and $this->data['custom_grouping_indicator_name'] = array_fill(0, $this->getCount(), "");
|
244 |
+
$this->getCount() and $this->data['custom_grouping_indicator_value'] = array_fill(0, $this->getCount(), "");
|
245 |
+
}
|
246 |
+
}
|
247 |
+
}
|
248 |
+
else {
|
249 |
+
$this->getCount() and $this->data['product_grouping_parent'] = array_fill(0, $this->getCount(), $this->getImport()->options['multiple_grouping_product']);
|
250 |
+
}
|
251 |
+
}
|
252 |
+
catch (\Exception $e) {
|
253 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Parse matching existing parent products.
|
259 |
+
*/
|
260 |
+
public function parseMatchingExistingParentProducts() {
|
261 |
+
try {
|
262 |
+
if ($this->getImport()->options['existing_parent_product_matching_logic'] == 'title') {
|
263 |
+
if ("" != $this->getImport()->options['existing_parent_product_title']) {
|
264 |
+
$this->data['existing_parent_product'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['existing_parent_product_title'], $file)
|
265 |
+
->parse();
|
266 |
+
$this->tmp_files[] = $file;
|
267 |
+
}
|
268 |
+
}
|
269 |
+
else {
|
270 |
+
if ("" != $this->getImport()->options['existing_parent_product_cf_name'] and "" != $this->getImport()->options['existing_parent_product_cf_value']) {
|
271 |
+
$this->data['existing_parent_product_cf_name'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['existing_parent_product_cf_name'], $file)
|
272 |
+
->parse();
|
273 |
+
$this->tmp_files[] = $file;
|
274 |
+
$this->data['existing_parent_product_cf_value'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['existing_parent_product_cf_value'], $file)
|
275 |
+
->parse();
|
276 |
+
$this->tmp_files[] = $file;
|
277 |
+
}
|
278 |
+
}
|
279 |
+
}
|
280 |
+
catch (\Exception $e) {
|
281 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Parse product's stock status.
|
287 |
+
*/
|
288 |
+
public function parseStockStatus() {
|
289 |
+
try {
|
290 |
+
// Composing product Stock status.
|
291 |
+
if ($this->getImport()->options['product_stock_status'] == 'xpath' and "" != $this->getImport()->options['single_product_stock_status']) {
|
292 |
+
$this->data['product_stock_status'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['single_product_stock_status'], $file)
|
293 |
+
->parse();
|
294 |
+
$this->tmp_files[] = $file;
|
295 |
+
}
|
296 |
+
elseif ($this->getImport()->options['product_stock_status'] == 'auto') {
|
297 |
+
$this->getCount() and $this->data['product_stock_status'] = array_fill(0, $this->getCount(), $this->getImport()->options['product_stock_status']);
|
298 |
+
$nostock = absint(max(get_option('woocommerce_notify_no_stock_amount'), 0));
|
299 |
+
foreach ($this->data['product_stock_qty'] as $key => $value) {
|
300 |
+
if ($this->data['product_manage_stock'][$key] == 'yes') {
|
301 |
+
$this->data['product_stock_status'][$key] = (((int) $value === 0 or (int) $value <= $nostock) and $value != "") ? 'outofstock' : 'instock';
|
302 |
+
}
|
303 |
+
else {
|
304 |
+
$this->data['product_stock_status'][$key] = 'instock';
|
305 |
+
}
|
306 |
+
}
|
307 |
+
}
|
308 |
+
else {
|
309 |
+
$this->getCount() and $this->data['product_stock_status'] = array_fill(0, $this->getCount(), $this->getImport()->options['product_stock_status']);
|
310 |
+
}
|
311 |
+
}
|
312 |
+
catch (\Exception $e) {
|
313 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
314 |
+
}
|
315 |
+
}
|
316 |
+
|
317 |
+
/**
|
318 |
+
* Parse Stock Status for variations.
|
319 |
+
*/
|
320 |
+
public function parseVariationsStockStatus() {
|
321 |
+
try {
|
322 |
+
if ($this->getImport()->options['variation_stock_status'] == 'xpath' and "" != $this->getImport()->options['single_variation_stock_status']) {
|
323 |
+
$this->data['v_stock_status'] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['single_variation_stock_status'], $file)->parse();
|
324 |
+
$this->tmp_files[] = $file;
|
325 |
+
}
|
326 |
+
elseif ($this->getImport()->options['variation_stock_status'] == 'auto') {
|
327 |
+
$this->getCount() and $this->data['v_stock_status'] = array_fill(0, $this->getCount(), $this->getImport()->options['variation_stock_status']);
|
328 |
+
$nostock = absint(max(get_option('woocommerce_notify_no_stock_amount'), 0));
|
329 |
+
foreach ($this->data['v_stock'] as $key => $value) {
|
330 |
+
if ($this->data['v_product_manage_stock'][$key] == 'yes') {
|
331 |
+
$this->data['v_stock_status'][$key] = (((int) $value === 0 or (int) $value <= $nostock) and $value != "") ? 'outofstock' : 'instock';
|
332 |
+
}
|
333 |
+
else {
|
334 |
+
$this->data['v_stock_status'][$key] = 'instock';
|
335 |
+
}
|
336 |
+
}
|
337 |
+
}
|
338 |
+
else {
|
339 |
+
$this->getCount() and $this->data['v_stock_status'] = array_fill(0, $this->getCount(), $this->getImport()->options['variation_stock_status']);
|
340 |
+
}
|
341 |
+
}
|
342 |
+
catch (\Exception $e) {
|
343 |
+
$this->log('<b>ERROR:</b> ' . $e->getMessage());
|
344 |
+
}
|
345 |
+
}
|
346 |
+
|
347 |
+
/**
|
348 |
+
* Parse Product Attributes.
|
349 |
+
*/
|
350 |
+
public function parseAttributes() {
|
351 |
+
|
352 |
+
$attribute_keys = array();
|
353 |
+
$attribute_values = array();
|
354 |
+
|
355 |
+
$attribute_options = array(
|
356 |
+
'in_variations' => array(),
|
357 |
+
'is_visible' => array(),
|
358 |
+
'is_taxonomy' => array(),
|
359 |
+
'is_create_terms' => array()
|
360 |
+
);
|
361 |
+
|
362 |
+
if (!empty($this->getImport()->options['attribute_name'][0])) {
|
363 |
+
foreach ($this->getImport()->options['attribute_name'] as $j => $attribute_name) {
|
364 |
+
if ($attribute_name == "") {
|
365 |
+
continue;
|
366 |
+
}
|
367 |
+
try {
|
368 |
+
$attribute_keys[$j] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $attribute_name, $file)
|
369 |
+
->parse();
|
370 |
+
$this->tmp_files[] = $file;
|
371 |
+
$attribute_values[$j] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['attribute_value'][$j], $file)
|
372 |
+
->parse();
|
373 |
+
$this->tmp_files[] = $file;
|
374 |
+
|
375 |
+
if (empty($this->getImport()->options['is_advanced'][$j])) {
|
376 |
+
$attribute_options['in_variations'][$j] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['in_variations'][$j], $file)
|
377 |
+
->parse();
|
378 |
+
$this->tmp_files[] = $file;
|
379 |
+
$attribute_options['is_visible'][$j] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['is_visible'][$j], $file)
|
380 |
+
->parse();
|
381 |
+
$this->tmp_files[] = $file;
|
382 |
+
$attribute_options['is_taxonomy'][$j] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['is_taxonomy'][$j], $file)
|
383 |
+
->parse();
|
384 |
+
$this->tmp_files[] = $file;
|
385 |
+
$attribute_options['is_create_terms'][$j] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['create_taxonomy_in_not_exists'][$j], $file)
|
386 |
+
->parse();
|
387 |
+
$this->tmp_files[] = $file;
|
388 |
+
}
|
389 |
+
else {
|
390 |
+
$options = array(
|
391 |
+
'in_variations',
|
392 |
+
'is_visible',
|
393 |
+
'is_taxonomy',
|
394 |
+
'is_create_terms'
|
395 |
+
);
|
396 |
+
|
397 |
+
foreach ($options as $option) {
|
398 |
+
if ($this->getImport()->options['advanced_' . $option][$j] == 'xpath' and "" != $this->getImport()->options['advanced_' . $option . '_xpath'][$j]) {
|
399 |
+
$attribute_options[$option][$j] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['advanced_' . $option . '_xpath'][$j], $file)
|
400 |
+
->parse();
|
401 |
+
$this->tmp_files[] = $file;
|
402 |
+
}
|
403 |
+
else {
|
404 |
+
$attribute_options[$option][$j] = XmlImportParser::factory($this->getXml(), $this->getCompleteXPath(), $this->getImport()->options['advanced_' . $option][$j], $file)
|
405 |
+
->parse();
|
406 |
+
$this->tmp_files[] = $file;
|
407 |
+
}
|
408 |
+
|
409 |
+
foreach ($attribute_options[$option][$j] as $key => $value) {
|
410 |
+
if (!in_array($value, array('yes', 'no'))) {
|
411 |
+
$attribute_options[$option][$j][$key] = 1;
|
412 |
+
}
|
413 |
+
else {
|
414 |
+
$attribute_options[$option][$j][$key] = ($value == 'yes') ? 1 : 0;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
catch(\Exception $e) {
|
421 |
+
$this->log($e->getMessage());
|
422 |
+
}
|
423 |
+
}
|
424 |
+
}
|
425 |
+
|
426 |
+
// Serialized attributes for product variations.
|
427 |
+
$this->data['serialized_attributes'] = array();
|
428 |
+
|
429 |
+
if (!empty($attribute_keys)) {
|
430 |
+
foreach ($attribute_keys as $j => $attribute_name) {
|
431 |
+
$this->data['serialized_attributes'][] = array(
|
432 |
+
'names' => $attribute_name,
|
433 |
+
'value' => $attribute_values[$j],
|
434 |
+
'is_visible' => $attribute_options['is_visible'][$j],
|
435 |
+
'in_variation' => $attribute_options['in_variations'][$j],
|
436 |
+
'in_taxonomy' => $attribute_options['is_taxonomy'][$j],
|
437 |
+
'is_create_taxonomy_terms' => $attribute_options['is_create_terms'][$j]
|
438 |
+
);
|
439 |
+
}
|
440 |
+
}
|
441 |
+
}
|
442 |
+
}
|
libraries/services/XmlImportWooPriceService.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once dirname(__FILE__) . '/XmlImportWooServiceBase.php';
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class XmlImportWooPriceService
|
7 |
+
*/
|
8 |
+
class XmlImportWooPriceService extends XmlImportWooServiceBase {
|
9 |
+
|
10 |
+
/**
|
11 |
+
*
|
12 |
+
* Adjust price and prepare it to valid format.
|
13 |
+
*
|
14 |
+
* @param $price
|
15 |
+
* @param $field
|
16 |
+
*
|
17 |
+
* @param $options
|
18 |
+
* @return float|int|string
|
19 |
+
*/
|
20 |
+
public function adjustPrice($price, $field, $options = array()) {
|
21 |
+
if (empty($options)){
|
22 |
+
$options = $this->getImport()->options;
|
23 |
+
}
|
24 |
+
switch ($field) {
|
25 |
+
case 'variable_regular_price':
|
26 |
+
case 'regular_price':
|
27 |
+
if (!empty($options['single_product_regular_price_adjust'])) {
|
28 |
+
switch ($options['single_product_regular_price_adjust_type']) {
|
29 |
+
case '%':
|
30 |
+
if (empty($price)) {
|
31 |
+
return $price;
|
32 |
+
}
|
33 |
+
$price = ($price / 100) * $options['single_product_regular_price_adjust'];
|
34 |
+
break;
|
35 |
+
case '$':
|
36 |
+
$price += (double) $options['single_product_regular_price_adjust'];
|
37 |
+
break;
|
38 |
+
}
|
39 |
+
$price = ((double) $price > 0) ? number_format((double) $price, 2, '.', '') : 0;
|
40 |
+
}
|
41 |
+
break;
|
42 |
+
case 'variable_sale_price':
|
43 |
+
case 'sale_price':
|
44 |
+
if (!empty($options['single_product_sale_price_adjust'])) {
|
45 |
+
switch ($options['single_product_sale_price_adjust_type']) {
|
46 |
+
case '%':
|
47 |
+
if (empty($price)) {
|
48 |
+
return $price;
|
49 |
+
}
|
50 |
+
$price = ($price / 100) * $options['single_product_sale_price_adjust'];
|
51 |
+
break;
|
52 |
+
case '$':
|
53 |
+
$price += (double) $options['single_product_sale_price_adjust'];
|
54 |
+
break;
|
55 |
+
}
|
56 |
+
$price = ((double) $price > 0) ? number_format((double) $price, 2, '.', '') : 0;
|
57 |
+
}
|
58 |
+
break;
|
59 |
+
}
|
60 |
+
return $price;
|
61 |
+
}
|
62 |
+
|
63 |
+
/**
|
64 |
+
*
|
65 |
+
* Prepare price to valid format.
|
66 |
+
*
|
67 |
+
* @param $price
|
68 |
+
* @param $disable_prepare_price
|
69 |
+
* @param $prepare_price_to_woo_format
|
70 |
+
* @param $convert_decimal_separator
|
71 |
+
*
|
72 |
+
* @return float|int|string
|
73 |
+
*/
|
74 |
+
public function preparePrice($price, $disable_prepare_price, $prepare_price_to_woo_format, $convert_decimal_separator) {
|
75 |
+
|
76 |
+
if ($disable_prepare_price) {
|
77 |
+
$price = preg_replace("/[^0-9\.,]/", "", $price);
|
78 |
+
}
|
79 |
+
|
80 |
+
if ($convert_decimal_separator && strlen($price) > 3) {
|
81 |
+
$comma_position = strrpos($price, ",", strlen($price) - 3);
|
82 |
+
if ($comma_position !== FALSE) {
|
83 |
+
$price = str_replace(".", "", $price);
|
84 |
+
$comma_position = strrpos($price, ",");
|
85 |
+
$price = str_replace(",", "", substr_replace($price, ".", $comma_position, 1));
|
86 |
+
}
|
87 |
+
else {
|
88 |
+
$comma_position = strrpos($price, ".", strlen($price) - 3);
|
89 |
+
if ($comma_position !== FALSE) {
|
90 |
+
$price = str_replace(",", "", $price);
|
91 |
+
}
|
92 |
+
elseif (strlen($price) > 4) {
|
93 |
+
$comma_position = strrpos($price, ",", strlen($price) - 4);
|
94 |
+
if ($comma_position and strlen($price) - $comma_position == 4) {
|
95 |
+
$price = str_replace(",", "", $price);
|
96 |
+
}
|
97 |
+
else {
|
98 |
+
$comma_position = strrpos($price, ".", strlen($price) - 4);
|
99 |
+
if ($comma_position and strlen($price) - $comma_position == 4) {
|
100 |
+
$price = str_replace(".", "", $price);
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
|
107 |
+
if ($prepare_price_to_woo_format) {
|
108 |
+
$price = str_replace(",", ".", $price);
|
109 |
+
$price = str_replace(",", ".", str_replace(".", "", preg_replace("%\.([0-9]){1,2}?$%", ",$0", $price)));
|
110 |
+
$price = ("" != $price) ? number_format((double) $price, 2, '.', '') : "";
|
111 |
+
}
|
112 |
+
return apply_filters('pmxi_price', $price);
|
113 |
+
}
|
114 |
+
}
|
libraries/services/XmlImportWooServiceBase.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class XmlImportWooService
|
5 |
+
*/
|
6 |
+
abstract class XmlImportWooServiceBase {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* @var \PMXI_Image_Record
|
10 |
+
*/
|
11 |
+
public $import;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var \wpdb
|
15 |
+
*/
|
16 |
+
public $wpdb;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* XmlImportWooService constructor.
|
20 |
+
*
|
21 |
+
* @param $import
|
22 |
+
*/
|
23 |
+
public function __construct($import) {
|
24 |
+
global $wpdb;
|
25 |
+
$this->wpdb = $wpdb;
|
26 |
+
$this->import = $import;
|
27 |
+
}
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @return \PMXI_Image_Record
|
31 |
+
*/
|
32 |
+
public function getImport() {
|
33 |
+
return $this->import;
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* @return array
|
38 |
+
*/
|
39 |
+
public function getImportOptions() {
|
40 |
+
return $this->import->options;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* @return bool|\Closure
|
45 |
+
*/
|
46 |
+
public function getLogger() {
|
47 |
+
$logger = FALSE;
|
48 |
+
if (PMXI_Plugin::is_ajax()) {
|
49 |
+
$logger = function($m) {echo "<div class='progress-msg'>[". date("H:i:s") ."] $m</div>\n";flush();};
|
50 |
+
}
|
51 |
+
return $logger;
|
52 |
+
}
|
53 |
+
}
|
libraries/services/XmlImportWooTaxonomyService.php
ADDED
@@ -0,0 +1,141 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once dirname(__FILE__) . '/XmlImportWooServiceBase.php';
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Class XmlImportWooTaxonomyService
|
7 |
+
*/
|
8 |
+
class XmlImportWooTaxonomyService extends XmlImportWooServiceBase {
|
9 |
+
|
10 |
+
/**
|
11 |
+
* @var array
|
12 |
+
*/
|
13 |
+
public $reserved_terms = array(
|
14 |
+
'attachment', 'attachment_id', 'author', 'author_name', 'calendar', 'cat', 'category', 'category__and',
|
15 |
+
'category__in', 'category__not_in', 'category_name', 'comments_per_page', 'comments_popup', 'cpage', 'day',
|
16 |
+
'debug', 'error', 'exact', 'feed', 'hour', 'link_category', 'm', 'minute', 'monthnum', 'more', 'name',
|
17 |
+
'nav_menu', 'nopaging', 'offset', 'order', 'orderby', 'p', 'page', 'page_id', 'paged', 'pagename', 'pb', 'perm',
|
18 |
+
'post', 'post__in', 'post__not_in', 'post_format', 'post_mime_type', 'post_status', 'post_tag', 'post_type',
|
19 |
+
'posts', 'posts_per_archive_page', 'posts_per_page', 'preview', 'robots', 's', 'search', 'second', 'sentence',
|
20 |
+
'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id',
|
21 |
+
'tag_slug__and', 'tag_slug__in', 'taxonomy', 'tb', 'term', 'type', 'w', 'withcomments', 'withoutcomments', 'year',
|
22 |
+
);
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
* Associate terms with product.
|
27 |
+
*
|
28 |
+
* @param $pid
|
29 |
+
* @param $termIDs
|
30 |
+
* @param $txName
|
31 |
+
*/
|
32 |
+
public function associateTerms($pid, $termIDs, $txName) {
|
33 |
+
$terms = wp_get_object_terms($pid, $txName);
|
34 |
+
$term_ids = array();
|
35 |
+
$assign_taxes = (is_array($termIDs)) ? array_filter($termIDs) : false;
|
36 |
+
if (!empty($terms)) {
|
37 |
+
if (!is_wp_error($terms)) {
|
38 |
+
foreach ($terms as $term_info) {
|
39 |
+
$term_ids[] = $term_info->term_taxonomy_id;
|
40 |
+
$this->wpdb->query( $this->wpdb->prepare("UPDATE {$this->wpdb->term_taxonomy} SET count = count - 1 WHERE term_taxonomy_id = %d", $term_info->term_taxonomy_id) );
|
41 |
+
}
|
42 |
+
$in_tt_ids = "'" . implode( "', '", $term_ids ) . "'";
|
43 |
+
$this->wpdb->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->term_relationships} WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $pid ) );
|
44 |
+
}
|
45 |
+
}
|
46 |
+
|
47 |
+
if (empty($assign_taxes)) return;
|
48 |
+
|
49 |
+
$values = array();
|
50 |
+
$term_order = 0;
|
51 |
+
foreach ($assign_taxes as $tt) {
|
52 |
+
do_action('wp_all_import_associate_term', $pid, $tt, $txName);
|
53 |
+
$values[] = $this->wpdb->prepare( "(%d, %d, %d)", $pid, $tt, ++$term_order);
|
54 |
+
$this->wpdb->query( "UPDATE {$this->wpdb->term_taxonomy} SET count = count + 1 WHERE term_taxonomy_id = $tt" );
|
55 |
+
}
|
56 |
+
if ($values) {
|
57 |
+
if ( false === $this->wpdb->query( "INSERT INTO {$this->wpdb->term_relationships} (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)" ) ){
|
58 |
+
$this->getLogger() and call_user_func($this->getLogger(), __('<b>ERROR</b> Could not insert term relationship into the database', \PMWI_Plugin::TEXT_DOMAIN) . ': '. $this->wpdb->last_error);
|
59 |
+
}
|
60 |
+
}
|
61 |
+
wp_cache_delete($pid, $txName . '_relationships');
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
*
|
66 |
+
* Create new taxonomy.
|
67 |
+
*
|
68 |
+
* @param $attr_name
|
69 |
+
* @param int $prefix
|
70 |
+
* @return string
|
71 |
+
*/
|
72 |
+
public function createTaxonomy($attr_name, $prefix = 1) {
|
73 |
+
$attr_name_real = $prefix > 1 ? $attr_name . " " . $prefix : $attr_name;
|
74 |
+
$attribute_name = wc_sanitize_taxonomy_name( stripslashes( (string) $attr_name_real ) );
|
75 |
+
$args = array(
|
76 |
+
'attribute_label' => stripslashes( (string) $attr_name ),
|
77 |
+
'attribute_name' => $attribute_name,
|
78 |
+
'attribute_type' => 'select',
|
79 |
+
'attribute_orderby' => 'menu_order',
|
80 |
+
'attribute_public' => 1
|
81 |
+
);
|
82 |
+
|
83 |
+
if ( ! taxonomy_exists( wc_attribute_taxonomy_name( $attr_name_real ) ) ) {
|
84 |
+
if ( in_array( wc_sanitize_taxonomy_name( stripslashes( (string) $attr_name_real)), $this->reserved_terms ) ) {
|
85 |
+
$prefix++;
|
86 |
+
return $this->createTaxonomy($attr_name, $prefix);
|
87 |
+
}
|
88 |
+
else {
|
89 |
+
// Register the taxonomy now so that the import works!
|
90 |
+
$domain = wc_attribute_taxonomy_name( $attr_name_real );
|
91 |
+
if (strlen($domain) < 31){
|
92 |
+
register_taxonomy( $domain,
|
93 |
+
apply_filters( 'woocommerce_taxonomy_objects_' . $domain, array('product') ),
|
94 |
+
apply_filters( 'woocommerce_taxonomy_args_' . $domain, array(
|
95 |
+
'hierarchical' => true,
|
96 |
+
'show_ui' => false,
|
97 |
+
'query_var' => true,
|
98 |
+
'rewrite' => false,
|
99 |
+
) )
|
100 |
+
);
|
101 |
+
$this->createWooCommerceAttribute($args);
|
102 |
+
$this->getLogger() and call_user_func($this->getLogger(), sprintf(__('- <b>CREATED</b>: Taxonomy attribute “%s” have been successfully created.', \PMWI_Plugin::TEXT_DOMAIN), wc_attribute_taxonomy_name( $attribute_name )));
|
103 |
+
}
|
104 |
+
else {
|
105 |
+
$this->getLogger() and call_user_func($this->getLogger(), sprintf(__('- <b>WARNING</b>: Taxonomy “%s” name is more than 28 characters. Change it, please.', \PMWI_Plugin::TEXT_DOMAIN), $attr_name));
|
106 |
+
}
|
107 |
+
}
|
108 |
+
}
|
109 |
+
else {
|
110 |
+
if ( in_array( wc_sanitize_taxonomy_name( stripslashes( (string) $attr_name_real)), $this->reserved_terms ) ) {
|
111 |
+
$prefix++;
|
112 |
+
return $this->createTaxonomy($attr_name, $prefix);
|
113 |
+
}
|
114 |
+
}
|
115 |
+
|
116 |
+
// Clear WooCommerce attributes cache.
|
117 |
+
$prefix = WC_Cache_Helper::get_cache_prefix( 'woocommerce-attributes' );
|
118 |
+
foreach (['ids', 'attributes'] as $cache_key) {
|
119 |
+
wp_cache_delete( $prefix . $cache_key, 'woocommerce-attributes' );
|
120 |
+
}
|
121 |
+
delete_transient( 'wc_attribute_taxonomies' );
|
122 |
+
|
123 |
+
if (!wc_attribute_taxonomy_id_by_name($attr_name_real) && strlen($attribute_name) < 31) {
|
124 |
+
$this->createWooCommerceAttribute($args);
|
125 |
+
}
|
126 |
+
|
127 |
+
return $attr_name_real;
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* @param $args
|
132 |
+
*/
|
133 |
+
public function createWooCommerceAttribute($args) {
|
134 |
+
$this->wpdb->insert(
|
135 |
+
$this->wpdb->prefix . 'woocommerce_attribute_taxonomies',
|
136 |
+
$args
|
137 |
+
);
|
138 |
+
$attribute_taxonomies = $this->wpdb->get_results( "SELECT * FROM " . $this->wpdb->prefix . "woocommerce_attribute_taxonomies" );
|
139 |
+
set_transient( 'wc_attribute_taxonomies', $attribute_taxonomies );
|
140 |
+
}
|
141 |
+
}
|
models/import/record.php
CHANGED
@@ -1,1738 +1,175 @@
|
|
1 |
<?php
|
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 |
-
|
27 |
-
|
28 |
-
'posts', 'posts_per_archive_page', 'posts_per_page', 'preview', 'robots', 's', 'search', 'second', 'sentence',
|
29 |
-
'showposts', 'static', 'subpost', 'subpost_id', 'tag', 'tag__and', 'tag__in', 'tag__not_in', 'tag_id',
|
30 |
-
'tag_slug__and', 'tag_slug__in', 'taxonomy', 'tb', 'term', 'type', 'w', 'withcomments', 'withoutcomments', 'year',
|
31 |
-
);
|
32 |
-
|
33 |
-
/**
|
34 |
-
* Initialize model instance
|
35 |
-
* @param array[optional] $data Array of record data to initialize object with
|
36 |
-
*/
|
37 |
-
public function __construct($data = array()) {
|
38 |
-
parent::__construct($data);
|
39 |
-
$this->setTable(PMXI_Plugin::getInstance()->getTablePrefix() . 'imports');
|
40 |
-
}
|
41 |
-
|
42 |
-
/**
|
43 |
-
* Perform import operation
|
44 |
-
* @param string $xml XML string to import
|
45 |
-
* @param callback[optional] $logger Method where progress messages are submmitted
|
46 |
-
* @return PMWI_Import_Record
|
47 |
-
* @chainable
|
48 |
-
*/
|
49 |
-
public function parse($parsing_data = array()) { //$import, $count, $xml, $logger = NULL, $chunk = false, $xpath_prefix = ""
|
50 |
-
|
51 |
-
if ($parsing_data['import']->options['custom_type'] != 'product') return;
|
52 |
-
|
53 |
-
extract($parsing_data);
|
54 |
-
|
55 |
-
add_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // do not perform special filtering for imported content
|
56 |
-
|
57 |
-
$this->options = $import->options;
|
58 |
-
|
59 |
-
$cxpath = $xpath_prefix . $import->xpath;
|
60 |
-
|
61 |
-
$this->data = array();
|
62 |
-
$records = array();
|
63 |
-
$tmp_files = array();
|
64 |
-
|
65 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing product data...', 'wpai_woocommerce_addon_plugin'));
|
66 |
-
|
67 |
-
// Composing product types
|
68 |
-
if ($import->options['is_multiple_product_type'] != 'yes' and "" != $import->options['single_product_type']){
|
69 |
-
$this->data['product_types'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_type'], $file)->parse($records); $tmp_files[] = $file;
|
70 |
-
}
|
71 |
-
else{
|
72 |
-
$count and $this->data['product_types'] = array_fill(0, $count, $import->options['multiple_product_type']);
|
73 |
-
}
|
74 |
-
|
75 |
-
// Composing product is Virtual
|
76 |
-
if ($import->options['is_product_virtual'] == 'xpath' and "" != $import->options['single_product_virtual']){
|
77 |
-
$this->data['product_virtual'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_virtual'], $file)->parse($records); $tmp_files[] = $file;
|
78 |
-
}
|
79 |
-
else{
|
80 |
-
$count and $this->data['product_virtual'] = array_fill(0, $count, $import->options['is_product_virtual']);
|
81 |
-
}
|
82 |
-
|
83 |
-
// Composing product is Downloadable
|
84 |
-
if ($import->options['is_product_downloadable'] == 'xpath' and "" != $import->options['single_product_downloadable']){
|
85 |
-
$this->data['product_downloadable'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_downloadable'], $file)->parse($records); $tmp_files[] = $file;
|
86 |
-
}
|
87 |
-
else{
|
88 |
-
$count and $this->data['product_downloadable'] = array_fill(0, $count, $import->options['is_product_downloadable']);
|
89 |
-
}
|
90 |
-
|
91 |
-
// Composing product is Variable Enabled
|
92 |
-
if ($import->options['is_product_enabled'] == 'xpath' and "" != $import->options['single_product_enabled']){
|
93 |
-
$this->data['product_enabled'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_enabled'], $file)->parse($records); $tmp_files[] = $file;
|
94 |
-
}
|
95 |
-
else{
|
96 |
-
$count and $this->data['product_enabled'] = array_fill(0, $count, $import->options['is_product_enabled']);
|
97 |
-
}
|
98 |
-
|
99 |
-
// Composing product is Featured
|
100 |
-
if ($import->options['is_product_featured'] == 'xpath' and "" != $import->options['single_product_featured']){
|
101 |
-
$this->data['product_featured'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_featured'], $file)->parse($records); $tmp_files[] = $file;
|
102 |
-
}
|
103 |
-
else{
|
104 |
-
$count and $this->data['product_featured'] = array_fill(0, $count, $import->options['is_product_featured']);
|
105 |
-
}
|
106 |
-
|
107 |
-
// Composing product is Visibility
|
108 |
-
if ($import->options['is_product_visibility'] == 'xpath' and "" != $import->options['single_product_visibility']){
|
109 |
-
$this->data['product_visibility'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_visibility'], $file)->parse($records); $tmp_files[] = $file;
|
110 |
-
}
|
111 |
-
else{
|
112 |
-
$count and $this->data['product_visibility'] = array_fill(0, $count, $import->options['is_product_visibility']);
|
113 |
-
}
|
114 |
-
|
115 |
-
if ("" != $import->options['single_product_sku']){
|
116 |
-
$this->data['product_sku'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_sku'], $file)->parse($records); $tmp_files[] = $file;
|
117 |
-
}
|
118 |
-
else{
|
119 |
-
$count and $this->data['product_sku'] = array_fill(0, $count, "");
|
120 |
-
}
|
121 |
-
|
122 |
-
if ("" != $import->options['single_product_variation_description']){
|
123 |
-
$this->data['product_variation_description'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_variation_description'], $file)->parse($records); $tmp_files[] = $file;
|
124 |
-
}
|
125 |
-
else{
|
126 |
-
$count and $this->data['product_variation_description'] = array_fill(0, $count, "");
|
127 |
-
}
|
128 |
-
|
129 |
-
if ("" != $import->options['single_product_url']){
|
130 |
-
$this->data['product_url'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_url'], $file)->parse($records); $tmp_files[] = $file;
|
131 |
-
}
|
132 |
-
else{
|
133 |
-
$count and $this->data['product_url'] = array_fill(0, $count, "");
|
134 |
-
}
|
135 |
-
|
136 |
-
if ("" != $import->options['single_product_button_text']){
|
137 |
-
$this->data['product_button_text'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_button_text'], $file)->parse($records); $tmp_files[] = $file;
|
138 |
-
}
|
139 |
-
else{
|
140 |
-
$count and $this->data['product_button_text'] = array_fill(0, $count, "");
|
141 |
-
}
|
142 |
-
|
143 |
-
if ("" != $import->options['single_product_regular_price']){
|
144 |
-
$this->data['product_regular_price'] = array_map(array($this, 'adjust_price'), array_map(array($this, 'prepare_price'), XmlImportParser::factory($xml, $cxpath, $import->options['single_product_regular_price'], $file)->parse($records)), array_fill(0, $count, "regular_price")); $tmp_files[] = $file;
|
145 |
-
}
|
146 |
-
else{
|
147 |
-
$count and $this->data['product_regular_price'] = array_fill(0, $count, "");
|
148 |
-
}
|
149 |
-
|
150 |
-
if ($import->options['is_regular_price_shedule'] and "" != $import->options['single_sale_price_dates_from']){
|
151 |
-
$this->data['product_sale_price_dates_from'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_sale_price_dates_from'], $file)->parse($records); $tmp_files[] = $file;
|
152 |
-
}
|
153 |
-
else{
|
154 |
-
$count and $this->data['product_sale_price_dates_from'] = array_fill(0, $count, "");
|
155 |
-
}
|
156 |
-
|
157 |
-
if ($import->options['is_regular_price_shedule'] and "" != $import->options['single_sale_price_dates_to']){
|
158 |
-
$this->data['product_sale_price_dates_to'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_sale_price_dates_to'], $file)->parse($records); $tmp_files[] = $file;
|
159 |
-
}
|
160 |
-
else{
|
161 |
-
$count and $this->data['product_sale_price_dates_to'] = array_fill(0, $count, "");
|
162 |
-
}
|
163 |
-
|
164 |
-
if ("" != $import->options['single_product_sale_price']){
|
165 |
-
$this->data['product_sale_price'] = array_map(array($this, 'adjust_price'), array_map(array($this, 'prepare_price'), XmlImportParser::factory($xml, $cxpath, $import->options['single_product_sale_price'], $file)->parse($records)), array_fill(0, $count, "sale_price")); $tmp_files[] = $file;
|
166 |
-
}
|
167 |
-
else{
|
168 |
-
$count and $this->data['product_sale_price'] = array_fill(0, $count, "");
|
169 |
-
}
|
170 |
-
|
171 |
-
if ("" != $import->options['single_product_whosale_price']){
|
172 |
-
$this->data['product_whosale_price'] = array_map(array($this, 'prepare_price'), XmlImportParser::factory($xml, $cxpath, $import->options['single_product_whosale_price'], $file)->parse($records)); $tmp_files[] = $file;
|
173 |
-
}
|
174 |
-
else{
|
175 |
-
$count and $this->data['product_whosale_price'] = array_fill(0, $count, "");
|
176 |
-
}
|
177 |
-
|
178 |
-
if ("" != $import->options['single_product_files']){
|
179 |
-
$this->data['product_files'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_files'], $file)->parse($records); $tmp_files[] = $file;
|
180 |
-
}
|
181 |
-
else{
|
182 |
-
$count and $this->data['product_files'] = array_fill(0, $count, "");
|
183 |
-
}
|
184 |
-
|
185 |
-
if ("" != $import->options['single_product_files_names']){
|
186 |
-
$this->data['product_files_names'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_files_names'], $file)->parse($records); $tmp_files[] = $file;
|
187 |
-
}
|
188 |
-
else{
|
189 |
-
$count and $this->data['product_files_names'] = array_fill(0, $count, "");
|
190 |
-
}
|
191 |
-
|
192 |
-
if ("" != $import->options['single_product_download_limit']){
|
193 |
-
$this->data['product_download_limit'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_download_limit'], $file)->parse($records); $tmp_files[] = $file;
|
194 |
-
}
|
195 |
-
else{
|
196 |
-
$count and $this->data['product_download_limit'] = array_fill(0, $count, "");
|
197 |
-
}
|
198 |
-
|
199 |
-
if ("" != $import->options['single_product_download_expiry']){
|
200 |
-
$this->data['product_download_expiry'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_download_expiry'], $file)->parse($records); $tmp_files[] = $file;
|
201 |
-
}
|
202 |
-
else{
|
203 |
-
$count and $this->data['product_download_expiry'] = array_fill(0, $count, "");
|
204 |
-
}
|
205 |
-
|
206 |
-
if ("" != $import->options['single_product_download_type']){
|
207 |
-
$this->data['product_download_type'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_download_type'], $file)->parse($records); $tmp_files[] = $file;
|
208 |
-
}
|
209 |
-
else{
|
210 |
-
$count and $this->data['product_download_type'] = array_fill(0, $count, "");
|
211 |
-
}
|
212 |
-
|
213 |
-
// Composing product Tax Status
|
214 |
-
if ($import->options['is_multiple_product_tax_status'] != 'yes' and "" != $import->options['single_product_tax_status']){
|
215 |
-
$this->data['product_tax_status'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_tax_status'], $file)->parse($records); $tmp_files[] = $file;
|
216 |
-
}
|
217 |
-
else{
|
218 |
-
$count and $this->data['product_tax_status'] = array_fill(0, $count, $import->options['multiple_product_tax_status']);
|
219 |
-
}
|
220 |
-
|
221 |
-
// Composing product Tax Class
|
222 |
-
if ($import->options['is_multiple_product_tax_class'] != 'yes' and "" != $import->options['single_product_tax_class']){
|
223 |
-
$this->data['product_tax_class'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_tax_class'], $file)->parse($records); $tmp_files[] = $file;
|
224 |
-
}
|
225 |
-
else{
|
226 |
-
$count and $this->data['product_tax_class'] = array_fill(0, $count, $import->options['multiple_product_tax_class']);
|
227 |
-
}
|
228 |
-
|
229 |
-
// Composing product Manage stock?
|
230 |
-
if ($import->options['is_product_manage_stock'] == 'xpath' and "" != $import->options['single_product_manage_stock']){
|
231 |
-
$this->data['product_manage_stock'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_manage_stock'], $file)->parse($records); $tmp_files[] = $file;
|
232 |
-
}
|
233 |
-
else{
|
234 |
-
$count and $this->data['product_manage_stock'] = array_fill(0, $count, $import->options['is_product_manage_stock']);
|
235 |
-
}
|
236 |
-
|
237 |
-
if ("" != $import->options['single_product_stock_qty']){
|
238 |
-
$this->data['product_stock_qty'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_stock_qty'], $file)->parse($records); $tmp_files[] = $file;
|
239 |
-
}
|
240 |
-
else{
|
241 |
-
$count and $this->data['product_stock_qty'] = array_fill(0, $count, "");
|
242 |
-
}
|
243 |
-
|
244 |
-
// Composing product Stock status
|
245 |
-
if ($import->options['product_stock_status'] == 'xpath' and "" != $import->options['single_product_stock_status'])
|
246 |
-
{
|
247 |
-
$this->data['product_stock_status'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_stock_status'], $file)->parse($records); $tmp_files[] = $file;
|
248 |
-
}
|
249 |
-
elseif($import->options['product_stock_status'] == 'auto')
|
250 |
-
{
|
251 |
-
$count and $this->data['product_stock_status'] = array_fill(0, $count, $import->options['product_stock_status']);
|
252 |
-
|
253 |
-
$nostock = absint( max( get_option( 'woocommerce_notify_no_stock_amount' ), 0 ) );
|
254 |
-
|
255 |
-
foreach ($this->data['product_stock_qty'] as $key => $value)
|
256 |
-
{
|
257 |
-
if ($this->data['product_manage_stock'][$key] == 'yes')
|
258 |
-
{
|
259 |
-
$this->data['product_stock_status'][$key] = (( (int) $value === 0 or (int) $value <= $nostock ) and $value != "") ? 'outofstock' : 'instock';
|
260 |
-
}
|
261 |
-
else{
|
262 |
-
$this->data['product_stock_status'][$key] = 'instock';
|
263 |
-
}
|
264 |
-
}
|
265 |
-
}
|
266 |
-
else
|
267 |
-
{
|
268 |
-
$count and $this->data['product_stock_status'] = array_fill(0, $count, $import->options['product_stock_status']);
|
269 |
-
}
|
270 |
-
|
271 |
-
// Composing product Allow Backorders?
|
272 |
-
if ($import->options['product_allow_backorders'] == 'xpath' and "" != $import->options['single_product_allow_backorders']){
|
273 |
-
$this->data['product_allow_backorders'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_allow_backorders'], $file)->parse($records); $tmp_files[] = $file;
|
274 |
-
}
|
275 |
-
else{
|
276 |
-
$count and $this->data['product_allow_backorders'] = array_fill(0, $count, $import->options['product_allow_backorders']);
|
277 |
-
}
|
278 |
-
|
279 |
-
// Composing product Sold Individually?
|
280 |
-
if ($import->options['product_sold_individually'] == 'xpath' and "" != $import->options['single_product_sold_individually']){
|
281 |
-
$this->data['product_sold_individually'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_sold_individually'], $file)->parse($records); $tmp_files[] = $file;
|
282 |
-
}
|
283 |
-
else{
|
284 |
-
$count and $this->data['product_sold_individually'] = array_fill(0, $count, $import->options['product_sold_individually']);
|
285 |
-
}
|
286 |
-
|
287 |
-
if ("" != $import->options['single_product_weight']){
|
288 |
-
$this->data['product_weight'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_weight'], $file)->parse($records); $tmp_files[] = $file;
|
289 |
-
}
|
290 |
-
else{
|
291 |
-
$count and $this->data['product_weight'] = array_fill(0, $count, "");
|
292 |
-
}
|
293 |
-
if ("" != $import->options['single_product_length']){
|
294 |
-
$this->data['product_length'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_length'], $file)->parse($records); $tmp_files[] = $file;
|
295 |
-
}
|
296 |
-
else{
|
297 |
-
$count and $this->data['product_length'] = array_fill(0, $count, "");
|
298 |
-
}
|
299 |
-
if ("" != $import->options['single_product_width']){
|
300 |
-
$this->data['product_width'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_width'], $file)->parse($records); $tmp_files[] = $file;
|
301 |
-
}
|
302 |
-
else{
|
303 |
-
$count and $this->data['product_width'] = array_fill(0, $count, "");
|
304 |
-
}
|
305 |
-
if ("" != $import->options['single_product_height']){
|
306 |
-
$this->data['product_height'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_height'], $file)->parse($records); $tmp_files[] = $file;
|
307 |
-
}
|
308 |
-
else{
|
309 |
-
$count and $this->data['product_height'] = array_fill(0, $count, "");
|
310 |
-
}
|
311 |
-
|
312 |
-
// Composing product Shipping Class
|
313 |
-
if ($import->options['is_multiple_product_shipping_class'] != 'yes' and "" != $import->options['single_product_shipping_class']){
|
314 |
-
$this->data['product_shipping_class'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_shipping_class'], $file)->parse($records); $tmp_files[] = $file;
|
315 |
-
}
|
316 |
-
else{
|
317 |
-
$count and $this->data['product_shipping_class'] = array_fill(0, $count, $import->options['multiple_product_shipping_class']);
|
318 |
-
}
|
319 |
-
|
320 |
-
if ("" != $import->options['single_product_up_sells']){
|
321 |
-
$this->data['product_up_sells'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_up_sells'], $file)->parse($records); $tmp_files[] = $file;
|
322 |
-
}
|
323 |
-
else{
|
324 |
-
$count and $this->data['product_up_sells'] = array_fill(0, $count, "");
|
325 |
-
}
|
326 |
-
if ("" != $import->options['single_product_cross_sells']){
|
327 |
-
$this->data['product_cross_sells'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_cross_sells'], $file)->parse($records); $tmp_files[] = $file;
|
328 |
-
}
|
329 |
-
else{
|
330 |
-
$count and $this->data['product_cross_sells'] = array_fill(0, $count, "");
|
331 |
-
}
|
332 |
-
|
333 |
-
if ($import->options['is_multiple_grouping_product'] != 'yes'){
|
334 |
-
|
335 |
-
if ($import->options['grouping_indicator'] == 'xpath'){
|
336 |
-
|
337 |
-
if ("" != $import->options['single_grouping_product']){
|
338 |
-
$this->data['product_grouping_parent'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_grouping_product'], $file)->parse($records); $tmp_files[] = $file;
|
339 |
-
}
|
340 |
-
else{
|
341 |
-
$count and $this->data['product_grouping_parent'] = array_fill(0, $count, $import->options['multiple_grouping_product']);
|
342 |
-
}
|
343 |
-
|
344 |
-
}
|
345 |
-
else{
|
346 |
-
if ("" != $import->options['custom_grouping_indicator_name'] and "" != $import->options['custom_grouping_indicator_value'] ){
|
347 |
-
$this->data['custom_grouping_indicator_name'] = XmlImportParser::factory($xml, $cxpath, $import->options['custom_grouping_indicator_name'], $file)->parse($records); $tmp_files[] = $file;
|
348 |
-
$this->data['custom_grouping_indicator_value'] = XmlImportParser::factory($xml, $cxpath, $import->options['custom_grouping_indicator_value'], $file)->parse($records); $tmp_files[] = $file;
|
349 |
-
}
|
350 |
-
else{
|
351 |
-
$count and $this->data['custom_grouping_indicator_name'] = array_fill(0, $count, "");
|
352 |
-
$count and $this->data['custom_grouping_indicator_value'] = array_fill(0, $count, "");
|
353 |
-
}
|
354 |
-
}
|
355 |
-
}
|
356 |
-
else{
|
357 |
-
$count and $this->data['product_grouping_parent'] = array_fill(0, $count, $import->options['multiple_grouping_product']);
|
358 |
-
}
|
359 |
-
|
360 |
-
if ("" != $import->options['single_product_purchase_note']){
|
361 |
-
$this->data['product_purchase_note'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_purchase_note'], $file)->parse($records); $tmp_files[] = $file;
|
362 |
-
}
|
363 |
-
else{
|
364 |
-
$count and $this->data['product_purchase_note'] = array_fill(0, $count, "");
|
365 |
-
}
|
366 |
-
if ("" != $import->options['single_product_menu_order']){
|
367 |
-
$this->data['product_menu_order'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_menu_order'], $file)->parse($records); $tmp_files[] = $file;
|
368 |
-
}
|
369 |
-
else{
|
370 |
-
$count and $this->data['product_menu_order'] = array_fill(0, $count, "");
|
371 |
-
}
|
372 |
-
|
373 |
-
// Composing product Enable reviews
|
374 |
-
if ($import->options['is_product_enable_reviews'] == 'xpath' and "" != $import->options['single_product_enable_reviews']){
|
375 |
-
$this->data['product_enable_reviews'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_enable_reviews'], $file)->parse($records); $tmp_files[] = $file;
|
376 |
-
}
|
377 |
-
else{
|
378 |
-
$count and $this->data['product_enable_reviews'] = array_fill(0, $count, $import->options['is_product_enable_reviews']);
|
379 |
-
}
|
380 |
-
|
381 |
-
if ("" != $import->options['single_product_id']){
|
382 |
-
$this->data['single_product_ID'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_id'], $file)->parse($records); $tmp_files[] = $file;
|
383 |
-
}
|
384 |
-
else{
|
385 |
-
$count and $this->data['single_product_ID'] = array_fill(0, $count, "");
|
386 |
-
}
|
387 |
-
if ("" != $import->options['single_product_parent_id']){
|
388 |
-
$this->data['single_product_parent_ID'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_parent_id'], $file)->parse($records); $tmp_files[] = $file;
|
389 |
-
}
|
390 |
-
else{
|
391 |
-
$count and $this->data['single_product_parent_ID'] = array_fill(0, $count, "");
|
392 |
-
}
|
393 |
-
if ("" != $import->options['single_product_id_first_is_parent_id']){
|
394 |
-
$this->data['single_product_id_first_is_parent_ID'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_id_first_is_parent_id'], $file)->parse($records); $tmp_files[] = $file;
|
395 |
-
}
|
396 |
-
else{
|
397 |
-
$count and $this->data['single_product_id_first_is_parent_ID'] = array_fill(0, $count, "");
|
398 |
-
}
|
399 |
-
if ("" != $import->options['single_product_id_first_is_parent_title']){
|
400 |
-
$this->data['single_product_id_first_is_parent_title'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_id_first_is_parent_title'], $file)->parse($records); $tmp_files[] = $file;
|
401 |
-
}
|
402 |
-
else{
|
403 |
-
$count and $this->data['single_product_id_first_is_parent_title'] = array_fill(0, $count, "");
|
404 |
-
}
|
405 |
-
if ("" != $import->options['single_product_id_first_is_variation']){
|
406 |
-
$this->data['single_product_id_first_is_variation'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_product_id_first_is_variation'], $file)->parse($records); $tmp_files[] = $file;
|
407 |
-
}
|
408 |
-
else{
|
409 |
-
$count and $this->data['single_product_id_first_is_variation'] = array_fill(0, $count, "");
|
410 |
-
}
|
411 |
-
|
412 |
-
// Composing product is Manage stock
|
413 |
-
if ($import->options['is_variation_product_manage_stock'] == 'xpath' and "" != $import->options['single_variation_product_manage_stock']){
|
414 |
-
|
415 |
-
$this->data['v_product_manage_stock'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_variation_product_manage_stock'], $file)->parse($records); $tmp_files[] = $file;
|
416 |
-
|
417 |
-
}
|
418 |
-
else{
|
419 |
-
$count and $this->data['v_product_manage_stock'] = array_fill(0, $count, $import->options['is_variation_product_manage_stock']);
|
420 |
-
}
|
421 |
-
|
422 |
-
// Stock Qty
|
423 |
-
if ($import->options['variation_stock'] != ""){
|
424 |
-
|
425 |
-
$this->data['v_stock'] = XmlImportParser::factory($xml, $cxpath, $import->options['variation_stock'], $file)->parse($records); $tmp_files[] = $file;
|
426 |
-
|
427 |
-
}
|
428 |
-
else{
|
429 |
-
$count and $this->data['v_stock'] = array_fill(0, $count, '');
|
430 |
-
}
|
431 |
-
|
432 |
-
// Stock Status
|
433 |
-
if ($import->options['variation_stock_status'] == 'xpath' and "" != $import->options['single_variation_stock_status']){
|
434 |
-
$this->data['v_stock_status'] = XmlImportParser::factory($xml, $cxpath, $import->options['single_variation_stock_status'], $file)->parse($records); $tmp_files[] = $file;
|
435 |
-
}
|
436 |
-
elseif($import->options['variation_stock_status'] == 'auto'){
|
437 |
-
$count and $this->data['v_stock_status'] = array_fill(0, $count, $import->options['variation_stock_status']);
|
438 |
-
foreach ($this->data['v_stock'] as $key => $value) {
|
439 |
-
if ($this->data['v_product_manage_stock'][$key] == 'yes'){
|
440 |
-
$this->data['v_stock_status'][$key] = ( ( (int) $value === 0 or (int) $value < 0 ) and $value != "") ? 'outofstock' : 'instock';
|
441 |
-
}
|
442 |
-
else{
|
443 |
-
$this->data['v_stock_status'][$key] = 'instock';
|
444 |
-
}
|
445 |
-
}
|
446 |
-
}
|
447 |
-
else{
|
448 |
-
$count and $this->data['v_stock_status'] = array_fill(0, $count, $import->options['variation_stock_status']);
|
449 |
-
}
|
450 |
-
|
451 |
-
if ($import->options['matching_parent'] != "auto") {
|
452 |
-
switch ($import->options['matching_parent']) {
|
453 |
-
case 'first_is_parent_id':
|
454 |
-
$this->data['single_product_parent_ID'] = $this->data['single_product_ID'] = $this->data['single_product_id_first_is_parent_ID'];
|
455 |
-
break;
|
456 |
-
case 'first_is_parent_title':
|
457 |
-
$this->data['single_product_parent_ID'] = $this->data['single_product_ID'] = $this->data['single_product_id_first_is_parent_title'];
|
458 |
-
break;
|
459 |
-
case 'first_is_variation':
|
460 |
-
$this->data['single_product_parent_ID'] = $this->data['single_product_ID'] = $this->data['single_product_id_first_is_variation'];
|
461 |
-
break;
|
462 |
-
}
|
463 |
-
}
|
464 |
-
|
465 |
-
if ($import->options['matching_parent'] == 'manual' and $import->options['parent_indicator'] == "custom field"){
|
466 |
-
if ("" != $import->options['custom_parent_indicator_name']){
|
467 |
-
$this->data['custom_parent_indicator_name'] = XmlImportParser::factory($xml, $cxpath, $import->options['custom_parent_indicator_name'], $file)->parse($records); $tmp_files[] = $file;
|
468 |
-
}
|
469 |
-
else{
|
470 |
-
$count and $this->data['custom_parent_indicator_name'] = array_fill(0, $count, "");
|
471 |
-
}
|
472 |
-
if ("" != $import->options['custom_parent_indicator_value']){
|
473 |
-
$this->data['custom_parent_indicator_value'] = XmlImportParser::factory($xml, $cxpath, $import->options['custom_parent_indicator_value'], $file)->parse($records); $tmp_files[] = $file;
|
474 |
-
}
|
475 |
-
else{
|
476 |
-
$count and $this->data['custom_parent_indicator_value'] = array_fill(0, $count, "");
|
477 |
-
}
|
478 |
-
}
|
479 |
-
|
480 |
-
// Composing variations attributes
|
481 |
-
$chunk == 1 and $logger and call_user_func($logger, __('Composing variations attributes...', 'wpai_woocommerce_addon_plugin'));
|
482 |
-
$attribute_keys = array();
|
483 |
-
$attribute_values = array();
|
484 |
-
$attribute_in_variation = array();
|
485 |
-
$attribute_is_visible = array();
|
486 |
-
$attribute_is_taxonomy = array();
|
487 |
-
$attribute_create_taxonomy_terms = array();
|
488 |
-
|
489 |
-
if (!empty($import->options['attribute_name'][0])){
|
490 |
-
foreach ($import->options['attribute_name'] as $j => $attribute_name) { if ($attribute_name == "") continue;
|
491 |
-
|
492 |
-
$attribute_keys[$j] = XmlImportParser::factory($xml, $cxpath, $attribute_name, $file)->parse($records); $tmp_files[] = $file;
|
493 |
-
$attribute_values[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['attribute_value'][$j], $file)->parse($records); $tmp_files[] = $file;
|
494 |
-
|
495 |
-
if (empty($import->options['is_advanced'][$j]))
|
496 |
-
{
|
497 |
-
$attribute_in_variation[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['in_variations'][$j], $file)->parse($records); $tmp_files[] = $file;
|
498 |
-
$attribute_is_visible[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['is_visible'][$j], $file)->parse($records); $tmp_files[] = $file;
|
499 |
-
$attribute_is_taxonomy[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['is_taxonomy'][$j], $file)->parse($records); $tmp_files[] = $file;
|
500 |
-
$attribute_create_taxonomy_terms[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['create_taxonomy_in_not_exists'][$j], $file)->parse($records); $tmp_files[] = $file;
|
501 |
-
}
|
502 |
-
else
|
503 |
-
{
|
504 |
-
// Is attribute In Variations
|
505 |
-
if ($import->options['advanced_in_variations'][$j] == 'xpath' and "" != $import->options['advanced_in_variations_xpath'][$j])
|
506 |
-
{
|
507 |
-
$attribute_in_variation[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['advanced_in_variations_xpath'][$j], $file)->parse($records); $tmp_files[] = $file;
|
508 |
-
}
|
509 |
-
else
|
510 |
-
{
|
511 |
-
$attribute_in_variation[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['advanced_in_variations'][$j], $file)->parse($records); $tmp_files[] = $file;
|
512 |
-
}
|
513 |
-
|
514 |
-
foreach ($attribute_in_variation[$j] as $key => $value) {
|
515 |
-
if ( ! in_array($value, array('yes', 'no')))
|
516 |
-
{
|
517 |
-
$attribute_in_variation[$j][$key] = 1;
|
518 |
-
}
|
519 |
-
else
|
520 |
-
{
|
521 |
-
$attribute_in_variation[$j][$key] = ($value == 'yes') ? 1 : 0;
|
522 |
-
}
|
523 |
-
}
|
524 |
-
|
525 |
-
// Is attribute Visible
|
526 |
-
if ($import->options['advanced_is_visible'][$j] == 'xpath' and "" != $import->options['advanced_is_visible_xpath'][$j])
|
527 |
-
{
|
528 |
-
$attribute_is_visible[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['advanced_is_visible_xpath'][$j], $file)->parse($records); $tmp_files[] = $file;
|
529 |
-
}
|
530 |
-
else
|
531 |
-
{
|
532 |
-
$attribute_is_visible[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['advanced_is_visible'][$j], $file)->parse($records); $tmp_files[] = $file;
|
533 |
-
}
|
534 |
-
|
535 |
-
foreach ($attribute_is_visible[$j] as $key => $value) {
|
536 |
-
if ( ! in_array($value, array('yes', 'no')))
|
537 |
-
{
|
538 |
-
$attribute_is_visible[$j][$key] = 1;
|
539 |
-
}
|
540 |
-
else
|
541 |
-
{
|
542 |
-
$attribute_is_visible[$j][$key] = ($value == 'yes') ? 1 : 0;
|
543 |
-
}
|
544 |
-
}
|
545 |
-
|
546 |
-
// Is attribute Taxonomy
|
547 |
-
if ($import->options['advanced_is_taxonomy'][$j] == 'xpath' and "" != $import->options['advanced_is_taxonomy_xpath'][$j])
|
548 |
-
{
|
549 |
-
$attribute_is_taxonomy[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['advanced_is_taxonomy_xpath'][$j], $file)->parse($records); $tmp_files[] = $file;
|
550 |
-
}
|
551 |
-
else
|
552 |
-
{
|
553 |
-
$attribute_is_taxonomy[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['advanced_is_taxonomy'][$j], $file)->parse($records); $tmp_files[] = $file;
|
554 |
-
}
|
555 |
-
|
556 |
-
foreach ($attribute_is_taxonomy[$j] as $key => $value) {
|
557 |
-
if ( ! in_array($value, array('yes', 'no')))
|
558 |
-
{
|
559 |
-
$attribute_is_taxonomy[$j][$key] = 1;
|
560 |
-
}
|
561 |
-
else
|
562 |
-
{
|
563 |
-
$attribute_is_taxonomy[$j][$key] = ($value == 'yes') ? 1 : 0;
|
564 |
-
}
|
565 |
-
}
|
566 |
-
|
567 |
-
// Is auto-create terms
|
568 |
-
if ($import->options['advanced_is_create_terms'][$j] == 'xpath' and "" != $import->options['advanced_is_create_terms_xpath'][$j])
|
569 |
-
{
|
570 |
-
$attribute_create_taxonomy_terms[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['advanced_is_create_terms_xpath'][$j], $file)->parse($records); $tmp_files[] = $file;
|
571 |
-
}
|
572 |
-
else
|
573 |
-
{
|
574 |
-
$attribute_create_taxonomy_terms[$j] = XmlImportParser::factory($xml, $cxpath, $import->options['advanced_is_create_terms'][$j], $file)->parse($records); $tmp_files[] = $file;
|
575 |
-
}
|
576 |
-
|
577 |
-
foreach ($attribute_create_taxonomy_terms[$j] as $key => $value) {
|
578 |
-
if ( ! in_array($value, array('yes', 'no')))
|
579 |
-
{
|
580 |
-
$attribute_create_taxonomy_terms[$j][$key] = 1;
|
581 |
-
}
|
582 |
-
else
|
583 |
-
{
|
584 |
-
$attribute_create_taxonomy_terms[$j][$key] = ($value == 'yes') ? 1 : 0;
|
585 |
-
}
|
586 |
-
}
|
587 |
-
}
|
588 |
-
}
|
589 |
-
}
|
590 |
-
|
591 |
-
// serialized attributes for product variations
|
592 |
-
$this->data['serialized_attributes'] = array();
|
593 |
-
if (!empty($attribute_keys)){
|
594 |
-
foreach ($attribute_keys as $j => $attribute_name) {
|
595 |
-
|
596 |
-
$this->data['serialized_attributes'][] = array(
|
597 |
-
'names' => $attribute_name,
|
598 |
-
'value' => $attribute_values[$j],
|
599 |
-
'is_visible' => $attribute_is_visible[$j],
|
600 |
-
'in_variation' => $attribute_in_variation[$j],
|
601 |
-
'in_taxonomy' => $attribute_is_taxonomy[$j],
|
602 |
-
'is_create_taxonomy_terms' => $attribute_create_taxonomy_terms[$j]
|
603 |
-
);
|
604 |
-
|
605 |
-
}
|
606 |
-
}
|
607 |
-
|
608 |
-
remove_filter('user_has_cap', array($this, '_filter_has_cap_unfiltered_html')); kses_init(); // return any filtering rules back if they has been disabled for import procedure
|
609 |
-
|
610 |
-
foreach ($tmp_files as $file) { // remove all temporary files created
|
611 |
-
unlink($file);
|
612 |
-
}
|
613 |
-
|
614 |
-
return $this->data;
|
615 |
-
}
|
616 |
-
|
617 |
-
public function filtering($var){
|
618 |
-
return ("" == $var) ? false : true;
|
619 |
-
}
|
620 |
-
|
621 |
-
public function is_update_data_allowed($option = '')
|
622 |
-
{
|
623 |
-
if ($this->options['is_keep_former_posts'] == 'yes') return false;
|
624 |
-
if ($this->options['update_all_data'] == 'yes') return true;
|
625 |
-
return (!empty($this->options[$option])) ? true : false;
|
626 |
-
}
|
627 |
-
|
628 |
-
public function import( $importData = array() ){
|
629 |
-
|
630 |
-
if ($importData['import']->options['custom_type'] != 'product') return;
|
631 |
-
|
632 |
-
global $wpdb;
|
633 |
-
|
634 |
-
$this->wpdb = $wpdb;
|
635 |
-
|
636 |
-
$this->import = $importData['import'];
|
637 |
-
$this->xml = $importData['xml'];
|
638 |
-
$this->logger = $importData['logger'];
|
639 |
-
$this->xpath = $importData['xpath_prefix'];
|
640 |
-
|
641 |
-
$product_taxonomies = array('post_format', 'product_type', 'product_shipping_class', 'product_visibility');
|
642 |
-
$this->product_taxonomies = array_diff_key(get_taxonomies_by_object_type(array('product'), 'object'), array_flip($product_taxonomies));
|
643 |
-
|
644 |
-
extract($importData);
|
645 |
-
|
646 |
-
$cxpath = $xpath_prefix . $this->import->xpath;
|
647 |
-
|
648 |
-
global $woocommerce;
|
649 |
-
|
650 |
-
extract($this->data);
|
651 |
-
|
652 |
-
$is_new_product = empty($articleData['ID']);
|
653 |
-
|
654 |
-
$product_type = empty( $product_types[$i] ) ? 'simple' : sanitize_title( stripslashes( $product_types[$i] ) );
|
655 |
-
|
656 |
-
$product = WC()->product_factory->get_product($pid);
|
657 |
-
|
658 |
-
if ($this->import->options['update_all_data'] == 'no' and ! $this->import->options['is_update_product_type'] and ! $is_new_product ){
|
659 |
-
if ( ! empty($product->product_type) ) $product_type = $product->product_type;
|
660 |
-
}
|
661 |
-
|
662 |
-
$this->articleData = $articleData;
|
663 |
-
|
664 |
-
$total_sales = get_post_meta($pid, 'total_sales', true);
|
665 |
-
|
666 |
-
if ( empty($total_sales)) update_post_meta($pid, 'total_sales', '0');
|
667 |
-
|
668 |
-
$is_downloadable = $product_downloadable[$i];
|
669 |
-
$is_virtual = $product_virtual[$i];
|
670 |
-
$is_featured = $product_featured[$i];
|
671 |
-
|
672 |
-
// Product type + Downloadable/Virtual
|
673 |
-
if ($is_new_product or $this->import->options['update_all_data'] == 'yes' or ($this->import->options['update_all_data'] == 'no' and $this->import->options['is_update_product_type'])) {
|
674 |
-
$product_type_term = is_exists_term($product_type, 'product_type', 0);
|
675 |
-
if ( ! empty($product_type_term) and ! is_wp_error($product_type_term) ){
|
676 |
-
$this->associate_terms( $pid, array( (int) $product_type_term['term_taxonomy_id'] ), 'product_type' );
|
677 |
-
}
|
678 |
-
}
|
679 |
-
|
680 |
-
if ( ! $is_new_product )
|
681 |
-
{
|
682 |
-
delete_post_meta($pid, '_is_first_variation_created');
|
683 |
-
}
|
684 |
|
685 |
-
|
686 |
-
|
|
|
|
|
|
|
|
|
687 |
|
688 |
-
|
689 |
-
|
690 |
-
if ( $product_sale_price[$i] != '' ){
|
691 |
-
$_regular_price = get_post_meta($pid, '_regular_price', true);
|
692 |
-
if ($product_sale_price[$i] > $_regular_price){
|
693 |
-
$product_sale_price[$i] = '';
|
694 |
-
}
|
695 |
}
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
$this->pushmeta($pid, '_length', stripslashes( $product_length[$i] ) );
|
715 |
-
$this->pushmeta($pid, '_width', stripslashes( $product_width[$i] ) );
|
716 |
-
$this->pushmeta($pid, '_height', stripslashes( $product_height[$i] ) );
|
717 |
}
|
718 |
|
719 |
-
|
720 |
-
|
721 |
-
if ($is_new_product or $this->is_update_data_allowed('is_update_menu_order')) $this->wpdb->update( $this->wpdb->posts, array('menu_order' => ($product_menu_order[$i] != '') ? (int) $product_menu_order[$i] : 0 ), array('ID' => $pid));
|
722 |
-
|
723 |
-
// Save shipping class
|
724 |
-
if ( pmwi_is_update_taxonomy($articleData, $this->import->options, 'product_shipping_class') )
|
725 |
-
{
|
726 |
-
|
727 |
-
$p_shipping_class = ($product_type != 'external') ? $product_shipping_class[$i] : '';
|
728 |
-
|
729 |
-
if ( $p_shipping_class != '' )
|
730 |
-
{
|
731 |
|
732 |
-
|
733 |
-
|
|
|
|
|
|
|
734 |
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
if ( ! empty($t_shipping_class) and ! is_wp_error($t_shipping_class) )
|
742 |
-
{
|
743 |
-
$p_shipping_class = (int) $t_shipping_class->term_id;
|
744 |
-
}
|
745 |
-
else
|
746 |
-
{
|
747 |
-
$t_shipping_class = is_exists_term( (int) $p_shipping_class, 'product_shipping_class');
|
748 |
-
|
749 |
-
if ( ! empty($t_shipping_class) and ! is_wp_error($t_shipping_class) )
|
750 |
-
{
|
751 |
-
$p_shipping_class = (int) $t_shipping_class['term_id'];
|
752 |
-
}
|
753 |
-
else
|
754 |
-
{
|
755 |
-
$t_shipping_class = wp_insert_term(
|
756 |
-
$p_shipping_class, // the term
|
757 |
-
'product_shipping_class' // the taxonomy
|
758 |
-
);
|
759 |
-
|
760 |
-
if ( ! empty($t_shipping_class) and ! is_wp_error($t_shipping_class) )
|
761 |
-
{
|
762 |
-
$p_shipping_class = (int) $t_shipping_class['term_id'];
|
763 |
-
}
|
764 |
-
}
|
765 |
-
}
|
766 |
-
}
|
767 |
-
else
|
768 |
-
{
|
769 |
-
$p_shipping_class = '';
|
770 |
-
}
|
771 |
-
}
|
772 |
-
else{
|
773 |
-
|
774 |
-
$t_shipping_class = is_exists_term($product_shipping_class[$i], 'product_shipping_class');
|
775 |
-
|
776 |
-
if ( ! empty($t_shipping_class) and ! is_wp_error($t_shipping_class) )
|
777 |
-
{
|
778 |
-
$p_shipping_class = (int) $t_shipping_class['term_id'];
|
779 |
-
}
|
780 |
-
else
|
781 |
-
{
|
782 |
-
$t_shipping_class = is_exists_term(htmlspecialchars(strtolower($product_shipping_class[$i])), 'product_shipping_class');
|
783 |
-
|
784 |
-
if ( ! empty($t_shipping_class) and ! is_wp_error($t_shipping_class) )
|
785 |
-
{
|
786 |
-
$p_shipping_class = (int) $t_shipping_class['term_id'];
|
787 |
-
}
|
788 |
-
else
|
789 |
-
{
|
790 |
-
$t_shipping_class = wp_insert_term(
|
791 |
-
$product_shipping_class[$i], // the term
|
792 |
-
'product_shipping_class' // the taxonomy
|
793 |
-
);
|
794 |
-
|
795 |
-
if ( ! empty($t_shipping_class) and ! is_wp_error($t_shipping_class) )
|
796 |
-
{
|
797 |
-
$p_shipping_class = (int) $t_shipping_class['term_id'];
|
798 |
-
}
|
799 |
-
}
|
800 |
-
}
|
801 |
-
}
|
802 |
-
}
|
803 |
-
|
804 |
-
if ( $p_shipping_class !== false and ! is_wp_error($p_shipping_class)) $this->associate_terms( $pid, array( $p_shipping_class ), 'product_shipping_class' );
|
805 |
-
|
806 |
-
}
|
807 |
-
|
808 |
-
// Unique SKU
|
809 |
-
$sku = ($is_new_product) ? '' : get_post_meta($pid, '_sku', true);
|
810 |
-
$new_sku = wc_clean(addslashes($product_sku[$i]));
|
811 |
-
|
812 |
-
if ( ( in_array($product_type, array('variation', 'variable')) or $product_types[$i] == "variable" ) and ! $this->import->options['link_all_variations'] ){
|
813 |
-
switch ($this->import->options['matching_parent']){
|
814 |
-
case 'first_is_parent_id':
|
815 |
-
if (!empty($single_product_first_is_parent_id_parent_sku[$i])){
|
816 |
-
update_post_meta($pid, '_parent_sku', $single_product_first_is_parent_id_parent_sku[$i]);
|
817 |
-
}
|
818 |
-
break;
|
819 |
-
case 'first_is_variation':
|
820 |
-
if (!empty($single_product_first_is_parent_title_parent_sku[$i])){
|
821 |
-
update_post_meta($pid, '_parent_sku', $single_product_first_is_parent_title_parent_sku[$i]);
|
822 |
-
}
|
823 |
-
break;
|
824 |
-
}
|
825 |
}
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
if ($is_new_product or $this->is_update_cf('_sku')){
|
832 |
-
$unique_keys = XmlImportParser::factory($xml, $cxpath, $this->import->options['unique_key'], $file)->parse(); $tmp_files[] = $file;
|
833 |
-
foreach ($tmp_files as $file) { // remove all temporary files created
|
834 |
-
@unlink($file);
|
835 |
-
}
|
836 |
-
$new_sku = substr(md5($unique_keys[$i]), 0, 12);
|
837 |
-
|
838 |
-
if ( ( in_array($product_type, array('variation', 'variable')) or $product_types[$i] == "variable" ) and ! $this->import->options['link_all_variations'] ){
|
839 |
-
switch ($this->import->options['matching_parent']){
|
840 |
-
case 'first_is_parent_id':
|
841 |
-
if (empty($single_product_first_is_parent_id_parent_sku[$i])){
|
842 |
-
update_post_meta($pid, '_parent_sku', strrev($new_sku));
|
843 |
-
}
|
844 |
-
break;
|
845 |
-
case 'first_is_variation':
|
846 |
-
if (empty($single_product_first_is_parent_title_parent_sku[$i])){
|
847 |
-
update_post_meta($pid, '_parent_sku', strrev($new_sku));
|
848 |
-
}
|
849 |
-
break;
|
850 |
-
}
|
851 |
-
}
|
852 |
-
}
|
853 |
-
}
|
854 |
-
if ( $new_sku != '' and $new_sku !== $sku ) {
|
855 |
-
if ( ! empty( $new_sku ) ) {
|
856 |
-
if ( ! $this->import->options['disable_sku_matching'] and
|
857 |
-
$this->wpdb->get_var( $this->wpdb->prepare("
|
858 |
-
SELECT ".$this->wpdb->posts.".ID
|
859 |
-
FROM ".$this->wpdb->posts."
|
860 |
-
LEFT JOIN ".$this->wpdb->postmeta." ON (".$this->wpdb->posts.".ID = ".$this->wpdb->postmeta.".post_id)
|
861 |
-
WHERE (".$this->wpdb->posts.".post_type = 'product'
|
862 |
-
OR ".$this->wpdb->posts.".post_type = 'product_variation')
|
863 |
-
AND ".$this->wpdb->posts.".post_status = 'publish'
|
864 |
-
AND ".$this->wpdb->postmeta.".meta_key = '_sku' AND ".$this->wpdb->postmeta.".meta_value = '%s'
|
865 |
-
", $new_sku ) )
|
866 |
-
) {
|
867 |
-
$logger and call_user_func($logger, sprintf(__('<b>WARNING</b>: Product SKU must be unique.', 'wpai_woocommerce_addon_plugin')));
|
868 |
-
|
869 |
-
} else {
|
870 |
-
$this->pushmeta($pid, '_sku', $new_sku );
|
871 |
-
}
|
872 |
-
} else {
|
873 |
-
$this->pushmeta($pid, '_sku', '' );
|
874 |
-
}
|
875 |
-
}
|
876 |
-
|
877 |
-
$this->pushmeta($pid, '_variation_description', $product_variation_description[$i] );
|
878 |
-
|
879 |
-
// Save Attributes
|
880 |
-
$attributes = array();
|
881 |
-
|
882 |
-
$is_variation_attributes_defined = false;
|
883 |
-
|
884 |
-
$max_attribute_length = apply_filters('wp_all_import_max_woo_attribute_term_length', 199);
|
885 |
-
|
886 |
-
if ( $this->import->options['update_all_data'] == "yes" or ( $this->import->options['update_all_data'] == "no" and $this->import->options['is_update_attributes']) or $is_new_product){ // Update Product Attributes
|
887 |
-
|
888 |
-
$is_update_attributes = true;
|
889 |
-
|
890 |
-
if ( !empty($serialized_attributes) ) {
|
891 |
-
|
892 |
-
$attribute_position = 0;
|
893 |
-
|
894 |
-
foreach ($serialized_attributes as $anum => $attr_data) { $attr_name = $attr_data['names'][$i];
|
895 |
-
|
896 |
-
if (empty($attr_name)) continue;
|
897 |
-
|
898 |
-
// $attr_names[] = $attr_name;
|
899 |
-
|
900 |
-
$is_visible = intval( $attr_data['is_visible'][$i] );
|
901 |
-
$is_variation = intval( $attr_data['in_variation'][$i] );
|
902 |
-
$is_taxonomy = intval( $attr_data['in_taxonomy'][$i] );
|
903 |
-
|
904 |
-
if ( $is_variation and $attr_data['value'][$i] != "" ) {
|
905 |
-
$is_variation_attributes_defined = true;
|
906 |
-
}
|
907 |
-
|
908 |
-
// Update only these Attributes, leave the rest alone
|
909 |
-
if ( ! $is_new_product and $this->import->options['update_all_data'] == "no" and $this->import->options['is_update_attributes'] and $this->import->options['update_attributes_logic'] == 'only'){
|
910 |
-
if ( ! empty($this->import->options['attributes_list']) and is_array($this->import->options['attributes_list'])) {
|
911 |
-
if ( ! in_array( ( ($is_taxonomy) ? wc_attribute_taxonomy_name( $attr_name ) : $attr_name ) , array_filter($this->import->options['attributes_list'], 'trim'))){
|
912 |
-
$attribute_position++;
|
913 |
-
continue;
|
914 |
-
}
|
915 |
-
}
|
916 |
-
else {
|
917 |
-
$is_update_attributes = false;
|
918 |
-
break;
|
919 |
-
}
|
920 |
-
}
|
921 |
-
|
922 |
-
// Leave these attributes alone, update all other Attributes
|
923 |
-
if ( ! $is_new_product and $this->import->options['update_all_data'] == "no" and $this->import->options['is_update_attributes'] and $this->import->options['update_attributes_logic'] == 'all_except'){
|
924 |
-
if ( ! empty($this->import->options['attributes_list']) and is_array($this->import->options['attributes_list'])) {
|
925 |
-
if ( in_array( ( ($is_taxonomy) ? wc_attribute_taxonomy_name( $attr_name ) : $attr_name ) , array_filter($this->import->options['attributes_list'], 'trim'))){
|
926 |
-
$attribute_position++;
|
927 |
-
continue;
|
928 |
-
}
|
929 |
-
}
|
930 |
-
}
|
931 |
-
|
932 |
-
if ( $is_taxonomy ) {
|
933 |
-
|
934 |
-
if ( isset( $attr_data['value'][$i] ) ) {
|
935 |
-
|
936 |
-
$values = array_map( 'stripslashes', explode( '|', $attr_data['value'][$i] ) );
|
937 |
-
|
938 |
-
// Remove empty items in the array
|
939 |
-
$values = array_filter( $values, array($this, "filtering") );
|
940 |
-
|
941 |
-
if (intval($attr_data['is_create_taxonomy_terms'][$i])){
|
942 |
-
$attr_name = $this->create_taxonomy($attr_name, $logger);
|
943 |
-
}
|
944 |
-
|
945 |
-
if ( ! empty($values) and taxonomy_exists( wc_attribute_taxonomy_name( $attr_name ) )){
|
946 |
-
|
947 |
-
$attr_values = array();
|
948 |
-
|
949 |
-
foreach ($values as $key => $val) {
|
950 |
-
|
951 |
-
$value = substr($val, 0, $max_attribute_length);
|
952 |
-
|
953 |
-
$term = get_term_by('name', $value, wc_attribute_taxonomy_name( $attr_name ), ARRAY_A);
|
954 |
-
|
955 |
-
// For compatibility with WPML plugin
|
956 |
-
$term = apply_filters('wp_all_import_term_exists', $term, wc_attribute_taxonomy_name( $attr_name ), $value, null);
|
957 |
-
|
958 |
-
if ( empty($term) and !is_wp_error($term) ){
|
959 |
-
|
960 |
-
$term = is_exists_term($value, wc_attribute_taxonomy_name( $attr_name ));
|
961 |
-
|
962 |
-
if ( empty($term) and !is_wp_error($term) ){
|
963 |
-
$term = is_exists_term(htmlspecialchars($value), wc_attribute_taxonomy_name( $attr_name ));
|
964 |
-
if ( empty($term) and !is_wp_error($term) and intval($attr_data['is_create_taxonomy_terms'][$i])){
|
965 |
-
|
966 |
-
$term = wp_insert_term(
|
967 |
-
$value, // the term
|
968 |
-
wc_attribute_taxonomy_name( $attr_name ) // the taxonomy
|
969 |
-
);
|
970 |
-
}
|
971 |
-
}
|
972 |
-
}
|
973 |
-
|
974 |
-
if ( ! is_wp_error($term) )
|
975 |
-
{
|
976 |
-
$attr_values[] = (int) $term['term_taxonomy_id'];
|
977 |
-
}
|
978 |
-
|
979 |
-
}
|
980 |
-
|
981 |
-
$values = $attr_values;
|
982 |
-
$values = array_map( 'intval', $values );
|
983 |
-
$values = array_unique( $values );
|
984 |
-
}
|
985 |
-
else $values = array();
|
986 |
-
|
987 |
-
}
|
988 |
-
|
989 |
-
// Update post terms
|
990 |
-
if ( taxonomy_exists( wc_attribute_taxonomy_name( $attr_name ) ))
|
991 |
-
$this->associate_terms( $pid, $values, wc_attribute_taxonomy_name( $attr_name ) );
|
992 |
-
|
993 |
-
if ( !empty($values) ) {
|
994 |
-
// Add attribute to array, but don't set values
|
995 |
-
$attributes[ sanitize_title(wc_attribute_taxonomy_name( $attr_name )) ] = array(
|
996 |
-
'name' => wc_attribute_taxonomy_name( $attr_name ),
|
997 |
-
'value' => $attr_data['value'][$i],
|
998 |
-
'position' => $attribute_position,
|
999 |
-
'is_visible' => $is_visible,
|
1000 |
-
'is_variation' => $is_variation,
|
1001 |
-
'is_taxonomy' => 1,
|
1002 |
-
'is_create_taxonomy_terms' => (!empty($attr_data['is_create_taxonomy_terms'][$i])) ? 1 : 0
|
1003 |
-
);
|
1004 |
-
|
1005 |
-
}
|
1006 |
-
|
1007 |
-
} else {
|
1008 |
-
|
1009 |
-
if ( taxonomy_exists( wc_attribute_taxonomy_name( $attr_name ) )){
|
1010 |
-
//wp_set_object_terms( $pid, NULL, wc_attribute_taxonomy_name( $attr_name ) );
|
1011 |
-
$this->associate_terms( $pid, NULL, wc_attribute_taxonomy_name( $attr_name ) );
|
1012 |
-
}
|
1013 |
-
|
1014 |
-
if (trim($attr_data['value'][$i]) != ""){
|
1015 |
-
|
1016 |
-
// Custom attribute - Add attribute to array and set the values
|
1017 |
-
$attributes[ sanitize_title( $attr_name ) ] = array(
|
1018 |
-
'name' => sanitize_text_field( $attr_name ),
|
1019 |
-
'value' => trim($attr_data['value'][$i]),
|
1020 |
-
'position' => $attribute_position,
|
1021 |
-
'is_visible' => $is_visible,
|
1022 |
-
'is_variation' => $is_variation,
|
1023 |
-
'is_taxonomy' => 0
|
1024 |
-
);
|
1025 |
-
}
|
1026 |
-
|
1027 |
-
}
|
1028 |
-
|
1029 |
-
$attribute_position++;
|
1030 |
-
}
|
1031 |
-
}
|
1032 |
-
|
1033 |
-
if ($is_new_product or $is_update_attributes) {
|
1034 |
-
|
1035 |
-
$current_product_attributes = get_post_meta($pid, '_product_attributes', true);
|
1036 |
-
|
1037 |
-
update_post_meta($pid, '_product_attributes', ( ! empty($current_product_attributes)) ? array_merge($current_product_attributes, $attributes) : $attributes );
|
1038 |
-
}
|
1039 |
-
|
1040 |
-
}else{
|
1041 |
-
|
1042 |
-
$is_variation_attributes_defined = true;
|
1043 |
-
|
1044 |
-
} // is update attributes
|
1045 |
-
|
1046 |
-
// Sales and prices
|
1047 |
-
if ( ! in_array( $product_type, array( 'grouped' ) ) ) {
|
1048 |
-
|
1049 |
-
$date_from = isset( $product_sale_price_dates_from[$i] ) ? $product_sale_price_dates_from[$i] : '';
|
1050 |
-
$date_to = isset( $product_sale_price_dates_to[$i] ) ? $product_sale_price_dates_to[$i] : '';
|
1051 |
-
|
1052 |
-
// Dates
|
1053 |
-
if ( $date_from ){
|
1054 |
-
$this->pushmeta($pid, '_sale_price_dates_from', strtotime( $date_from ));
|
1055 |
-
}
|
1056 |
-
else{
|
1057 |
-
$this->pushmeta($pid, '_sale_price_dates_from', '');
|
1058 |
-
}
|
1059 |
-
|
1060 |
-
if ( $date_to ){
|
1061 |
-
$this->pushmeta($pid, '_sale_price_dates_to', strtotime( $date_to ));
|
1062 |
-
}
|
1063 |
-
else{
|
1064 |
-
$this->pushmeta($pid, '_sale_price_dates_to', '');
|
1065 |
-
}
|
1066 |
-
|
1067 |
-
if ( $date_to && ! $date_from ){
|
1068 |
-
$this->pushmeta($pid, '_sale_price_dates_from', strtotime( 'NOW', current_time( 'timestamp' ) ) );
|
1069 |
-
}
|
1070 |
-
|
1071 |
-
// Update price if on sale
|
1072 |
-
if ( ! empty($this->articleData['ID']) and ! $this->is_update_cf('_sale_price') )
|
1073 |
-
{
|
1074 |
-
$product_sale_price[$i] = get_post_meta($pid, '_sale_price', true);
|
1075 |
-
}
|
1076 |
-
|
1077 |
-
if ( $product_sale_price[$i] != '' && $date_to == '' && $date_from == '' ){
|
1078 |
-
|
1079 |
-
$this->pushmeta($pid, '_price', ($product_sale_price[$i] == "") ? '' : stripslashes( $product_sale_price[$i] ));
|
1080 |
-
|
1081 |
-
}
|
1082 |
-
else{
|
1083 |
-
|
1084 |
-
// Update price if on sale
|
1085 |
-
if ( ! empty($this->articleData['ID']) and ! $this->is_update_cf('_regular_price') )
|
1086 |
-
{
|
1087 |
-
$product_regular_price[$i] = get_post_meta($pid, '_regular_price', true);
|
1088 |
-
}
|
1089 |
-
|
1090 |
-
$this->pushmeta($pid, '_price', ($product_regular_price[$i] == "") ? '' : stripslashes( $product_regular_price[$i] ));
|
1091 |
-
}
|
1092 |
-
|
1093 |
-
if ( $product_sale_price[$i] != '' && $date_from && strtotime( $date_from ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ){
|
1094 |
-
$this->pushmeta($pid, '_price', ($product_sale_price[$i] == "") ? '' : stripslashes( $product_sale_price[$i] ));
|
1095 |
-
}
|
1096 |
-
|
1097 |
-
if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) {
|
1098 |
-
$this->pushmeta($pid, '_price', ($product_regular_price[$i] == "") ? '' : stripslashes( $product_regular_price[$i] ));
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
-
|
1102 |
-
if (in_array( $product_type, array( 'simple', 'external', 'variable' ) )) {
|
1103 |
-
|
1104 |
-
if ($this->import->options['is_multiple_grouping_product'] != 'yes'){
|
1105 |
-
if ($this->import->options['grouping_indicator'] == 'xpath' and ! preg_match("%^[0-9]*$%", $product_grouping_parent[$i])){
|
1106 |
-
$dpost = pmxi_findDuplicates(array(
|
1107 |
-
'post_type' => 'product',
|
1108 |
-
'ID' => $pid,
|
1109 |
-
'post_parent' => $articleData['post_parent'],
|
1110 |
-
'post_title' => $product_grouping_parent[$i]
|
1111 |
-
));
|
1112 |
-
if (!empty($dpost))
|
1113 |
-
$product_grouping_parent[$i] = $dpost[0];
|
1114 |
-
else
|
1115 |
-
$product_grouping_parent[$i] = 0;
|
1116 |
-
}
|
1117 |
-
elseif ($this->import->options['grouping_indicator'] != 'xpath'){
|
1118 |
-
$dpost = pmxi_findDuplicates($articleData, $custom_grouping_indicator_name[$i], $custom_grouping_indicator_value[$i], 'custom field');
|
1119 |
-
if (!empty($dpost))
|
1120 |
-
$product_grouping_parent[$i] = array_shift($dpost);
|
1121 |
-
else
|
1122 |
-
$product_grouping_parent[$i] = 0;
|
1123 |
-
}
|
1124 |
-
}
|
1125 |
-
|
1126 |
-
if ( "" != $product_grouping_parent[$i] and absint($product_grouping_parent[$i]) > 0){
|
1127 |
-
|
1128 |
-
$this->wpdb->update( $this->wpdb->posts, array('post_parent' => absint( $product_grouping_parent[$i] ) ), array('ID' => $pid));
|
1129 |
-
|
1130 |
-
$all_grouped_products = get_post_meta($product_grouping_parent[$i], '_children', true);
|
1131 |
-
|
1132 |
-
if (empty($all_grouped_products)) $all_grouped_products = array();
|
1133 |
-
|
1134 |
-
if (!empty($all_grouped_products) & !is_array($all_grouped_products)){
|
1135 |
-
$all_grouped_products = array($all_grouped_products);
|
1136 |
-
}
|
1137 |
-
|
1138 |
-
if ( ! in_array($pid, $all_grouped_products) ){
|
1139 |
-
$all_grouped_products[] = $pid;
|
1140 |
-
update_post_meta($product_grouping_parent[$i], '_children', $all_grouped_products);
|
1141 |
-
}
|
1142 |
-
}
|
1143 |
-
}
|
1144 |
-
|
1145 |
-
// Update parent if grouped so price sorting works and stays in sync with the cheapest child
|
1146 |
-
if ( $product_type == 'grouped' || ( "" != $product_grouping_parent[$i] and absint($product_grouping_parent[$i]) > 0)) {
|
1147 |
-
|
1148 |
-
$clear_parent_ids = array();
|
1149 |
-
|
1150 |
-
if ( $product_type == 'grouped' )
|
1151 |
-
$clear_parent_ids[] = $pid;
|
1152 |
-
|
1153 |
-
if ( "" != $product_grouping_parent[$i] and absint($product_grouping_parent[$i]) > 0 )
|
1154 |
-
$clear_parent_ids[] = absint( $product_grouping_parent[$i] );
|
1155 |
-
|
1156 |
-
if ( $clear_parent_ids ) {
|
1157 |
-
foreach( $clear_parent_ids as $clear_id ) {
|
1158 |
-
|
1159 |
-
$children_by_price = get_posts( array(
|
1160 |
-
'post_parent' => $clear_id,
|
1161 |
-
'orderby' => 'meta_value_num',
|
1162 |
-
'order' => 'asc',
|
1163 |
-
'meta_key' => '_price',
|
1164 |
-
'posts_per_page'=> 1,
|
1165 |
-
'post_type' => 'product',
|
1166 |
-
'fields' => 'ids'
|
1167 |
-
) );
|
1168 |
-
if ( $children_by_price ) {
|
1169 |
-
foreach ( $children_by_price as $child ) {
|
1170 |
-
$child_price = get_post_meta( $child, '_price', true );
|
1171 |
-
update_post_meta( $clear_id, '_price', $child_price );
|
1172 |
-
}
|
1173 |
-
}
|
1174 |
-
|
1175 |
-
// Clear cache/transients
|
1176 |
-
//wc_delete_product_transients( $clear_id );
|
1177 |
-
}
|
1178 |
-
}
|
1179 |
-
}
|
1180 |
-
|
1181 |
-
// Sold Individuall
|
1182 |
-
if ( "yes" == $product_sold_individually[$i] ) {
|
1183 |
-
$this->pushmeta($pid, '_sold_individually', 'yes');
|
1184 |
-
} else {
|
1185 |
-
$this->pushmeta($pid, '_sold_individually', '');
|
1186 |
-
}
|
1187 |
-
|
1188 |
-
// Stock Data
|
1189 |
-
$stock_data_args = array(
|
1190 |
-
'stock_status' => $product_stock_status[$i],
|
1191 |
-
'manage_stock' => $product_manage_stock[$i],
|
1192 |
-
'allow_backorders' => $product_allow_backorders[$i],
|
1193 |
-
'qty' => $product_stock_qty[$i]
|
1194 |
-
);
|
1195 |
-
$this->import_stock_data($pid, $product_type, $stock_data_args );
|
1196 |
-
|
1197 |
-
// Upsells
|
1198 |
-
$this->import_linked_products($pid, $product_up_sells[$i], '_upsell_ids', $is_new_product);
|
1199 |
-
|
1200 |
-
// Cross sells
|
1201 |
-
$this->import_linked_products($pid, $product_cross_sells[$i], '_crosssell_ids', $is_new_product);
|
1202 |
-
|
1203 |
-
// Downloadable options
|
1204 |
-
if ( $is_downloadable == 'yes' ) {
|
1205 |
-
|
1206 |
-
$_download_limit = absint( $product_download_limit[$i] );
|
1207 |
-
if ( ! $_download_limit )
|
1208 |
-
$_download_limit = ''; // 0 or blank = unlimited
|
1209 |
-
|
1210 |
-
$_download_expiry = absint( $product_download_expiry[$i] );
|
1211 |
-
if ( ! $_download_expiry )
|
1212 |
-
$_download_expiry = ''; // 0 or blank = unlimited
|
1213 |
-
|
1214 |
-
// file paths will be stored in an array keyed off md5(file path)
|
1215 |
-
if ( !empty( $product_files[$i] ) ) {
|
1216 |
-
$_file_paths = array();
|
1217 |
-
|
1218 |
-
$file_paths = explode( $this->import->options['product_files_delim'] , $product_files[$i] );
|
1219 |
-
$file_names = explode( $this->import->options['product_files_names_delim'] , $product_files_names[$i] );
|
1220 |
-
|
1221 |
-
foreach ( $file_paths as $fn => $file_path ) {
|
1222 |
-
$file_path = trim( $file_path );
|
1223 |
-
$_file_paths[ md5( $file_path ) ] = array('name' => ((!empty($file_names[$fn])) ? $file_names[$fn] : basename($file_path)), 'file' => $file_path);
|
1224 |
-
}
|
1225 |
-
|
1226 |
-
$this->pushmeta($pid, '_downloadable_files', $_file_paths);
|
1227 |
-
|
1228 |
-
}
|
1229 |
-
if ( isset( $product_download_limit[$i] ) )
|
1230 |
-
$this->pushmeta($pid, '_download_limit', esc_attr( $_download_limit ));
|
1231 |
-
|
1232 |
-
if ( isset( $product_download_expiry[$i] ) )
|
1233 |
-
$this->pushmeta($pid, '_download_expiry', esc_attr( $_download_expiry ));
|
1234 |
-
|
1235 |
-
if ( isset( $product_download_type[$i] ) )
|
1236 |
-
$this->pushmeta($pid, '_download_type', esc_attr( $product_download_type[$i] ));
|
1237 |
-
|
1238 |
-
}
|
1239 |
-
|
1240 |
-
// Update product visibility term WC 3.0.0
|
1241 |
-
if ( version_compare(WOOCOMMERCE_VERSION, '3.0') >= 0 ) {
|
1242 |
-
|
1243 |
-
$associate_terms = array();
|
1244 |
-
|
1245 |
-
$term_ids = wp_get_object_terms($pid, 'product_visibility', array('fields' => 'ids'));
|
1246 |
-
|
1247 |
-
// If Not Update Featured Status checking for current featured status
|
1248 |
-
if ( ! empty($articleData['ID']) && ( ! $this->is_update_data_allowed('is_update_advanced_options') || ! $this->is_update_data_allowed('is_update_featured_status'))) {
|
1249 |
-
$featured_term = get_term_by( 'name', 'featured', 'product_visibility' );
|
1250 |
-
if ( ! empty($featured_term) && ! is_wp_error($featured_term) && in_array($featured_term->term_id, $term_ids) ){
|
1251 |
-
$associate_terms[] = $featured_term->term_taxonomy_id;
|
1252 |
-
}
|
1253 |
-
}
|
1254 |
-
else{
|
1255 |
-
if ($is_featured == "yes"){
|
1256 |
-
$featured_term = get_term_by( 'name', 'featured', 'product_visibility' );
|
1257 |
-
if ( ! empty($featured_term) && !is_wp_error($featured_term)){
|
1258 |
-
$associate_terms[] = $featured_term->term_taxonomy_id;
|
1259 |
-
}
|
1260 |
-
}
|
1261 |
-
}
|
1262 |
-
|
1263 |
-
// If Not Update Product Visibility checking for current product visibility
|
1264 |
-
if ( ! empty($articleData['ID']) && ( ! $this->is_update_data_allowed('is_update_advanced_options') || ! $this->is_update_data_allowed('is_update_catalog_visibility'))) {
|
1265 |
-
$exclude_search_term = get_term_by( 'name', 'exclude-from-search', 'product_visibility' );
|
1266 |
-
if (!empty($exclude_search_term) && !is_wp_error($exclude_search_term) && in_array($exclude_search_term->term_id, $term_ids)){
|
1267 |
-
$associate_terms[] = $exclude_search_term->term_taxonomy_id;
|
1268 |
-
}
|
1269 |
-
$exclude_catalog_term = get_term_by( 'name', 'exclude-from-catalog', 'product_visibility' );
|
1270 |
-
if (!empty($exclude_catalog_term) && !is_wp_error($exclude_catalog_term) && in_array($exclude_catalog_term->term_id, $term_ids)){
|
1271 |
-
$associate_terms[] = $exclude_catalog_term->term_taxonomy_id;
|
1272 |
-
}
|
1273 |
-
}
|
1274 |
-
else{
|
1275 |
-
if (in_array($product_visibility[$i], array('hidden', 'search'))){
|
1276 |
-
$exclude_search_term = get_term_by( 'name', 'exclude-from-catalog', 'product_visibility' );
|
1277 |
-
if (!empty($exclude_search_term) && !is_wp_error($exclude_search_term)){
|
1278 |
-
$associate_terms[] = $exclude_search_term->term_taxonomy_id;
|
1279 |
-
}
|
1280 |
-
}
|
1281 |
-
if (in_array($product_visibility[$i], array('hidden', 'catalog'))){
|
1282 |
-
$exclude_catalog_term = get_term_by( 'name', 'exclude-from-search', 'product_visibility' );
|
1283 |
-
if (!empty($exclude_catalog_term) && !is_wp_error($exclude_catalog_term)){
|
1284 |
-
$associate_terms[] = $exclude_catalog_term->term_taxonomy_id;
|
1285 |
-
}
|
1286 |
-
}
|
1287 |
-
}
|
1288 |
-
|
1289 |
-
$_stock_status = get_post_meta( $pid, '_stock_status', true);
|
1290 |
-
if ( $_stock_status == 'outofstock' ){
|
1291 |
-
$outofstock_term = get_term_by( 'name', 'outofstock', 'product_visibility' );
|
1292 |
-
if (!empty($outofstock_term) && !is_wp_error($outofstock_term)){
|
1293 |
-
$associate_terms[] = $outofstock_term->term_taxonomy_id;
|
1294 |
-
}
|
1295 |
-
}
|
1296 |
-
|
1297 |
-
$this->associate_terms( $pid, $associate_terms, 'product_visibility' );
|
1298 |
}
|
|
|
|
|
1299 |
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
-
$table = $this->wpdb->posts;
|
1313 |
-
|
1314 |
-
$p = $this->wpdb->get_row($this->wpdb->prepare("SELECT * FROM $table WHERE ID = %d;", $importData['pid']));
|
1315 |
-
|
1316 |
-
if ($p)
|
1317 |
-
{
|
1318 |
-
$post_to_update_id = false;
|
1319 |
-
|
1320 |
-
if ($p->post_type != 'product_variation')
|
1321 |
-
{
|
1322 |
-
update_post_meta( $importData['pid'], '_product_version', WC_VERSION );
|
1323 |
-
$post_to_update_id = $importData['pid'];
|
1324 |
-
|
1325 |
-
// [associate linked products]
|
1326 |
-
$wp_all_import_not_linked_products = get_option('wp_all_import_not_linked_products_' . $importData['import']->id );
|
1327 |
-
|
1328 |
-
if ( ! empty($wp_all_import_not_linked_products) )
|
1329 |
-
{
|
1330 |
-
$post_to_update_sku = get_post_meta($post_to_update_id, '_sku', true);
|
1331 |
-
|
1332 |
-
foreach ($wp_all_import_not_linked_products as $product)
|
1333 |
-
{
|
1334 |
-
if ( $product['pid'] != $post_to_update_id && ! empty($product['not_linked_products']) )
|
1335 |
-
{
|
1336 |
-
if ( in_array($post_to_update_sku, $product['not_linked_products'])
|
1337 |
-
or in_array( (string) $post_to_update_id, $product['not_linked_products'])
|
1338 |
-
or in_array($p->post_title, $product['not_linked_products'])
|
1339 |
-
or in_array($p->post_name, $product['not_linked_products'])
|
1340 |
-
)
|
1341 |
-
{
|
1342 |
-
$linked_products = get_post_meta($product['pid'], $product['type'], true);
|
1343 |
-
|
1344 |
-
if (empty($linked_products)) $linked_products = array();
|
1345 |
-
|
1346 |
-
if ( ! in_array($post_to_update_id, $linked_products))
|
1347 |
-
{
|
1348 |
-
$linked_products[] = $post_to_update_id;
|
1349 |
-
|
1350 |
-
$importData['logger'] and call_user_func($importData['logger'], sprintf(__('Added to %s list of product ID %d.', 'wpai_woocommerce_addon_plugin'), $product['type'] == '_upsell_ids' ? 'Up-Sells' : 'Cross-Sells', $product['pid']) );
|
1351 |
-
|
1352 |
-
update_post_meta($product['pid'], $product['type'], $linked_products);
|
1353 |
-
|
1354 |
-
}
|
1355 |
-
}
|
1356 |
-
}
|
1357 |
-
}
|
1358 |
-
}
|
1359 |
-
// [\associate linked products]
|
1360 |
-
}
|
1361 |
-
|
1362 |
-
// [update product gallery]
|
1363 |
-
$tmp_gallery = explode(",", get_post_meta( $post_to_update_id, '_product_image_gallery_tmp', true));
|
1364 |
-
$gallery = explode(",", get_post_meta( $post_to_update_id, '_product_image_gallery', true));
|
1365 |
-
if (is_array($gallery)){
|
1366 |
-
$gallery = array_filter($gallery);
|
1367 |
-
if ( ! empty($tmp_gallery))
|
1368 |
-
{
|
1369 |
-
$gallery = array_unique(array_merge($gallery, $tmp_gallery));
|
1370 |
-
}
|
1371 |
-
}
|
1372 |
-
elseif ( ! empty($tmp_gallery))
|
1373 |
-
{
|
1374 |
-
$gallery = $tmp_gallery;
|
1375 |
-
}
|
1376 |
-
$this->pushmeta( $post_to_update_id, '_product_image_gallery', implode(",", $gallery) );
|
1377 |
-
// [\update product gallery]
|
1378 |
-
|
1379 |
-
wc_delete_product_transients($importData['pid']);
|
1380 |
-
}
|
1381 |
-
}
|
1382 |
-
|
1383 |
-
function import_stock_data($pid, $product_type, $stock_data_args){
|
1384 |
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1389 |
|
1390 |
-
|
|
|
|
|
|
|
|
|
|
|
1391 |
|
1392 |
-
|
1393 |
|
1394 |
-
|
1395 |
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
1399 |
-
|
|
|
|
|
1400 |
}
|
1401 |
-
|
1402 |
-
} elseif ( 'grouped' !== $product_type && $stock_data_args['manage_stock'] == 'yes' ) {
|
1403 |
-
$manage_stock = 'yes';
|
1404 |
-
$backorders = wc_clean( $stock_data_args['allow_backorders'] );
|
1405 |
-
}
|
1406 |
-
|
1407 |
-
$this->pushmeta($pid, '_manage_stock', $manage_stock);
|
1408 |
-
|
1409 |
-
$current_manage_stock = get_post_meta( $pid, '_manage_stock', true );
|
1410 |
-
|
1411 |
-
if ($current_manage_stock == 'yes' && ! in_array($product_type, array('external', 'grouped')) ){
|
1412 |
-
$backorders = wc_clean( $stock_data_args['allow_backorders'] );
|
1413 |
}
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
// Set Stock Status to instock if backorders are enabled #24
|
1418 |
-
$_backorders = get_post_meta( $pid, '_backorders', true );
|
1419 |
-
if ( in_array($_backorders, array('notify', 'yes')) ) {
|
1420 |
-
$stock_status = 'instock';
|
1421 |
}
|
1422 |
-
|
1423 |
-
if ( $this->is_update_cf('_stock') && $stock_status ) {
|
1424 |
-
update_post_meta( $pid, '_stock_status', $stock_status );
|
1425 |
-
}
|
1426 |
-
|
1427 |
-
if ( $stock_data_args['manage_stock'] == 'yes' || ! $this->is_update_cf('_manage_stock') && $current_manage_stock == 'yes') {
|
1428 |
-
$this->pushmeta( $pid, '_stock', wc_stock_amount( $stock_data_args['qty'] ) );
|
1429 |
-
} else {
|
1430 |
-
$this->pushmeta($pid, '_stock', '');
|
1431 |
-
}
|
1432 |
-
|
1433 |
-
} else {
|
1434 |
-
update_post_meta( $pid, '_stock_status', wc_clean( $stock_data_args['stock_status'] ) );
|
1435 |
}
|
1436 |
}
|
1437 |
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
$values[] = '(' . $value['pid'] . ',"' . $value['meta_key'] . '",\'' . maybe_serialize($value['meta_value']) .'\')';
|
1450 |
-
}
|
1451 |
-
}
|
1452 |
-
|
1453 |
-
$this->wpdb->query("INSERT INTO $table (`post_id`, `meta_key`, `meta_value`) VALUES " . implode(',', $values));
|
1454 |
-
$this->post_meta_to_insert = array();
|
1455 |
-
}
|
1456 |
-
}
|
1457 |
-
|
1458 |
-
protected function pushmeta($pid, $meta_key, $meta_value){
|
1459 |
-
|
1460 |
-
if (empty($meta_key)) return;
|
1461 |
-
|
1462 |
-
if ( empty($this->articleData['ID']) or $this->is_update_cf($meta_key)){
|
1463 |
-
|
1464 |
-
update_post_meta($pid, $meta_key, $meta_value);
|
1465 |
-
|
1466 |
-
}
|
1467 |
-
}
|
1468 |
-
|
1469 |
-
/**
|
1470 |
-
*
|
1471 |
-
* Is update allowed according to import record matching setting
|
1472 |
-
*
|
1473 |
-
*/
|
1474 |
-
protected function is_update_cf( $meta_key ){
|
1475 |
-
|
1476 |
-
if ( $this->options['update_all_data'] == 'yes') return true;
|
1477 |
-
|
1478 |
-
if ( ! $this->options['is_update_custom_fields'] ) return false;
|
1479 |
-
|
1480 |
-
if ( $this->options['update_custom_fields_logic'] == "full_update" ) return true;
|
1481 |
-
if ( $this->options['update_custom_fields_logic'] == "only" and ! empty($this->options['custom_fields_list']) and is_array($this->options['custom_fields_list']) and in_array($meta_key, $this->options['custom_fields_list']) ) return true;
|
1482 |
-
if ( $this->options['update_custom_fields_logic'] == "all_except" and ( empty($this->options['custom_fields_list']) or ! in_array($meta_key, $this->options['custom_fields_list']) )) return true;
|
1483 |
-
|
1484 |
-
return false;
|
1485 |
-
|
1486 |
-
}
|
1487 |
-
|
1488 |
-
protected function associate_terms($pid, $assign_taxes, $tx_name, $logger = false){
|
1489 |
-
|
1490 |
-
$terms = wp_get_object_terms( $pid, $tx_name );
|
1491 |
-
$term_ids = array();
|
1492 |
-
|
1493 |
-
$assign_taxes = (is_array($assign_taxes)) ? array_filter($assign_taxes) : false;
|
1494 |
-
|
1495 |
-
if ( ! empty($terms) ){
|
1496 |
-
if ( ! is_wp_error( $terms ) ) {
|
1497 |
-
foreach ($terms as $term_info) {
|
1498 |
-
$term_ids[] = $term_info->term_taxonomy_id;
|
1499 |
-
$this->wpdb->query( $this->wpdb->prepare("UPDATE {$this->wpdb->term_taxonomy} SET count = count - 1 WHERE term_taxonomy_id = %d", $term_info->term_taxonomy_id) );
|
1500 |
-
}
|
1501 |
-
$in_tt_ids = "'" . implode( "', '", $term_ids ) . "'";
|
1502 |
-
$this->wpdb->query( $this->wpdb->prepare( "DELETE FROM {$this->wpdb->term_relationships} WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $pid ) );
|
1503 |
}
|
1504 |
-
|
1505 |
-
|
1506 |
-
if (empty($assign_taxes)) return;
|
1507 |
-
|
1508 |
-
// foreach ($assign_taxes as $tt) {
|
1509 |
-
// $this->wpdb->insert( $this->wpdb->term_relationships, array( 'object_id' => $pid, 'term_taxonomy_id' => $tt ) );
|
1510 |
-
// $this->wpdb->query( "UPDATE {$this->wpdb->term_taxonomy} SET count = count + 1 WHERE term_taxonomy_id = $tt" );
|
1511 |
-
// }
|
1512 |
-
|
1513 |
-
$values = array();
|
1514 |
-
$term_order = 0;
|
1515 |
-
foreach ( $assign_taxes as $tt )
|
1516 |
-
{
|
1517 |
-
do_action('wp_all_import_associate_term', $pid, $tt, $tx_name);
|
1518 |
-
$values[] = $this->wpdb->prepare( "(%d, %d, %d)", $pid, $tt, ++$term_order);
|
1519 |
-
$this->wpdb->query( "UPDATE {$this->wpdb->term_taxonomy} SET count = count + 1 WHERE term_taxonomy_id = $tt" );
|
1520 |
-
}
|
1521 |
-
|
1522 |
-
|
1523 |
-
if ( $values ){
|
1524 |
-
if ( false === $this->wpdb->query( "INSERT INTO {$this->wpdb->term_relationships} (object_id, term_taxonomy_id, term_order) VALUES " . join( ',', $values ) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)" ) ){
|
1525 |
-
$logger and call_user_func($logger, __('<b>ERROR</b> Could not insert term relationship into the database', 'wp_all_import_plugin') . ': '. $this->wpdb->last_error);
|
1526 |
}
|
1527 |
}
|
1528 |
-
|
1529 |
-
wp_cache_delete( $pid, $tx_name . '_relationships' );
|
1530 |
-
|
1531 |
}
|
1532 |
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
// Grab the submitted data
|
1542 |
-
$attribute_name = ( isset( $attr_name ) ) ? wc_sanitize_taxonomy_name( stripslashes( (string) $attr_name_real ) ) : '';
|
1543 |
-
$attribute_label = stripslashes( (string) $attr_name );
|
1544 |
-
$attribute_type = 'select';
|
1545 |
-
$attribute_orderby = 'menu_order';
|
1546 |
-
|
1547 |
-
if ( in_array( wc_sanitize_taxonomy_name( stripslashes( (string) $attr_name_real)), $this->reserved_terms ) ) {
|
1548 |
-
$prefix++;
|
1549 |
-
return $this->create_taxonomy($attr_name, $logger, $prefix);
|
1550 |
-
//$logger and call_user_func($logger, sprintf(__('- <b>WARNING</b>: Slug “%s” is not allowed because it is a reserved term. Change it, please.', 'wpai_woocommerce_addon_plugin'), wc_attribute_taxonomy_name( $attribute_name )));
|
1551 |
-
}
|
1552 |
-
else{
|
1553 |
-
|
1554 |
-
// Register the taxonomy now so that the import works!
|
1555 |
-
$domain = wc_attribute_taxonomy_name( $attr_name_real );
|
1556 |
-
if (strlen($domain) < 31){
|
1557 |
-
|
1558 |
-
$this->wpdb->insert(
|
1559 |
-
$this->wpdb->prefix . 'woocommerce_attribute_taxonomies',
|
1560 |
-
array(
|
1561 |
-
'attribute_label' => $attribute_label,
|
1562 |
-
'attribute_name' => $attribute_name,
|
1563 |
-
'attribute_type' => $attribute_type,
|
1564 |
-
'attribute_orderby' => $attribute_orderby,
|
1565 |
-
'attribute_public' => 1
|
1566 |
-
)
|
1567 |
-
);
|
1568 |
-
|
1569 |
-
register_taxonomy( $domain,
|
1570 |
-
apply_filters( 'woocommerce_taxonomy_objects_' . $domain, array('product') ),
|
1571 |
-
apply_filters( 'woocommerce_taxonomy_args_' . $domain, array(
|
1572 |
-
'hierarchical' => true,
|
1573 |
-
'show_ui' => false,
|
1574 |
-
'query_var' => true,
|
1575 |
-
'rewrite' => false,
|
1576 |
-
) )
|
1577 |
-
);
|
1578 |
-
|
1579 |
-
delete_transient( 'wc_attribute_taxonomies' );
|
1580 |
-
$attribute_taxonomies = $this->wpdb->get_results( "SELECT * FROM " . $this->wpdb->prefix . "woocommerce_attribute_taxonomies" );
|
1581 |
-
set_transient( 'wc_attribute_taxonomies', $attribute_taxonomies );
|
1582 |
-
|
1583 |
-
$logger and call_user_func($logger, sprintf(__('- <b>CREATED</b>: Taxonomy attribute “%s” have been successfully created.', 'wpai_woocommerce_addon_plugin'), wc_attribute_taxonomy_name( $attribute_name )));
|
1584 |
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
|
|
|
1597 |
}
|
1598 |
-
|
1599 |
-
|
1600 |
-
|
1601 |
-
|
1602 |
-
public function _filter_has_cap_unfiltered_html($caps)
|
1603 |
-
{
|
1604 |
-
$caps['unfiltered_html'] = true;
|
1605 |
-
return $caps;
|
1606 |
-
}
|
1607 |
-
|
1608 |
-
function import_linked_products( $pid, $products, $type, $is_new_product )
|
1609 |
-
{
|
1610 |
-
if ( ! $is_new_product and ! $this->is_update_cf($type) ) return;
|
1611 |
-
|
1612 |
-
if ( ! empty( $products ) )
|
1613 |
-
{
|
1614 |
-
$not_found = array();
|
1615 |
-
|
1616 |
-
$linked_products = array();
|
1617 |
-
|
1618 |
-
$ids = array_filter(explode(',', $products), 'trim');
|
1619 |
-
|
1620 |
-
foreach ( $ids as $id )
|
1621 |
-
{
|
1622 |
-
// search linked product by _SKU
|
1623 |
-
$args = array(
|
1624 |
-
'post_type' => 'product',
|
1625 |
-
'meta_query' => array(
|
1626 |
-
array(
|
1627 |
-
'key' => '_sku',
|
1628 |
-
'value' => $id,
|
1629 |
-
)
|
1630 |
-
)
|
1631 |
-
);
|
1632 |
-
$query = new WP_Query( $args );
|
1633 |
-
|
1634 |
-
$linked_product = false;
|
1635 |
-
|
1636 |
-
if ( $query->have_posts() )
|
1637 |
-
{
|
1638 |
-
$linked_product = get_post($query->post->ID);
|
1639 |
-
}
|
1640 |
-
|
1641 |
-
wp_reset_postdata();
|
1642 |
-
|
1643 |
-
if ( ! $linked_product )
|
1644 |
-
{
|
1645 |
-
if (is_numeric($id))
|
1646 |
-
{
|
1647 |
-
// search linked product by ID
|
1648 |
-
$query = new WP_Query( array( 'post_type' => 'product', 'post__in' => array( $id ) ) );
|
1649 |
-
if ( $query->have_posts() )
|
1650 |
-
{
|
1651 |
-
$linked_product = get_post($query->post->ID);
|
1652 |
-
}
|
1653 |
-
wp_reset_postdata();
|
1654 |
-
}
|
1655 |
-
if ( ! $linked_product )
|
1656 |
-
{
|
1657 |
-
// search linked product by slug
|
1658 |
-
$args = array(
|
1659 |
-
'name' => $id,
|
1660 |
-
'post_type' => 'product',
|
1661 |
-
'post_status' => 'publish',
|
1662 |
-
'numberposts' => 1
|
1663 |
-
);
|
1664 |
-
$query = get_posts($args);
|
1665 |
-
if( $query )
|
1666 |
-
{
|
1667 |
-
$linked_product = $query[0];
|
1668 |
-
}
|
1669 |
-
wp_reset_postdata();
|
1670 |
-
if (!$linked_product) {
|
1671 |
-
// Search linked product by title.
|
1672 |
-
$linked_product = get_page_by_title( $id, OBJECT, 'product' );
|
1673 |
-
}
|
1674 |
-
}
|
1675 |
-
}
|
1676 |
-
|
1677 |
-
if ($linked_product)
|
1678 |
-
{
|
1679 |
-
$linked_products[] = $linked_product->ID;
|
1680 |
-
|
1681 |
-
$this->logger and call_user_func($this->logger, sprintf(__('Product `%s` with ID `%d` added to %s list.', 'wpai_woocommerce_addon_plugin'), $linked_product->post_title, $linked_product->ID, $type == '_upsell_ids' ? 'Up-Sells' : 'Cross-Sells') );
|
1682 |
-
}
|
1683 |
-
else
|
1684 |
-
{
|
1685 |
-
$not_found[] = $id;
|
1686 |
-
}
|
1687 |
-
}
|
1688 |
-
|
1689 |
-
// not all linked products founded
|
1690 |
-
if ( ! empty($not_found))
|
1691 |
-
{
|
1692 |
-
$not_founded_linked_products = get_option( 'wp_all_import_not_linked_products_' . $this->import->id );
|
1693 |
-
|
1694 |
-
if (empty($not_founded_linked_products)) $not_founded_linked_products = array();
|
1695 |
-
|
1696 |
-
$not_founded_linked_products[] = array(
|
1697 |
-
'pid' => $pid,
|
1698 |
-
'type' => $type,
|
1699 |
-
'not_linked_products' => $not_found
|
1700 |
-
);
|
1701 |
-
|
1702 |
-
update_option( 'wp_all_import_not_linked_products_' . $this->import->id, $not_founded_linked_products );
|
1703 |
-
}
|
1704 |
-
|
1705 |
-
$this->pushmeta($pid, $type, $linked_products);
|
1706 |
-
|
1707 |
-
}
|
1708 |
-
else
|
1709 |
-
{
|
1710 |
-
delete_post_meta( $pid, $type );
|
1711 |
-
}
|
1712 |
-
}
|
1713 |
-
|
1714 |
-
function is_update_custom_field($existing_meta_keys, $options, $meta_key){
|
1715 |
-
|
1716 |
-
if ($options['update_all_data'] == 'yes') return true;
|
1717 |
-
|
1718 |
-
if ( ! $options['is_update_custom_fields'] ) return false;
|
1719 |
-
|
1720 |
-
if ($options['update_custom_fields_logic'] == "full_update") return true;
|
1721 |
-
if ($options['update_custom_fields_logic'] == "only" and ! empty($options['custom_fields_list']) and is_array($options['custom_fields_list']) and in_array($meta_key, $options['custom_fields_list']) ) return true;
|
1722 |
-
if ($options['update_custom_fields_logic'] == "all_except" and ( empty($options['custom_fields_list']) or ! in_array($meta_key, $options['custom_fields_list']) )) return true;
|
1723 |
-
|
1724 |
-
return false;
|
1725 |
-
}
|
1726 |
-
|
1727 |
-
function prepare_price( $price ){
|
1728 |
-
|
1729 |
-
return pmwi_prepare_price( $price, $this->options['disable_prepare_price'], $this->options['prepare_price_to_woo_format'], $this->options['convert_decimal_separator'] );
|
1730 |
-
|
1731 |
-
}
|
1732 |
-
|
1733 |
-
function adjust_price( $price, $field ){
|
1734 |
-
|
1735 |
-
return pmwi_adjust_price( $price, $field, $this->options);
|
1736 |
-
|
1737 |
-
}
|
1738 |
-
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Class PMWI_Import_Record
|
5 |
+
*/
|
6 |
+
class PMWI_Import_Record extends PMWI_Model_Record {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Associative array of data which will be automatically available as variables when template is rendered
|
10 |
+
* @var array
|
11 |
+
*/
|
12 |
+
public $data = array();
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var XmlImportWooCommerce
|
16 |
+
*/
|
17 |
+
public $engine = FALSE;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Initialize model instance
|
21 |
+
* @param array [optional] $data Array of record data to initialize object with
|
22 |
+
*/
|
23 |
+
public function __construct($data = array()) {
|
24 |
+
parent::__construct($data);
|
25 |
+
$this->setTable(PMXI_Plugin::getInstance()
|
26 |
+
->getTablePrefix() . 'imports');
|
27 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
/**
|
30 |
+
* Perform import operation
|
31 |
+
* @param array $parsingData XML string to import
|
32 |
+
* @return array|bool
|
33 |
+
*/
|
34 |
+
public function parse($parsingData = array()) {
|
35 |
|
36 |
+
if (!$this->isImportAllowed($parsingData)) {
|
37 |
+
return FALSE;
|
|
|
|
|
|
|
|
|
|
|
38 |
}
|
39 |
+
add_filter('user_has_cap', array(
|
40 |
+
$this,
|
41 |
+
'_filter_has_cap_unfiltered_html'
|
42 |
+
));
|
43 |
+
kses_init(); // do not perform special filtering for imported content
|
44 |
+
|
45 |
+
$this->options = $parsingData['import']->options;
|
46 |
+
|
47 |
+
switch ($parsingData['import']->options['custom_type']) {
|
48 |
+
case 'product':
|
49 |
+
$this->engine = new XmlImportWooCommerceProduct($parsingData);
|
50 |
+
break;
|
51 |
+
case 'shop_order':
|
52 |
+
$this->engine = new XmlImportWooCommerceShopOrder($parsingData);
|
53 |
+
break;
|
54 |
+
default:
|
55 |
+
# code...
|
56 |
+
break;
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
+
$this->data = $this->engine->parse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
+
remove_filter('user_has_cap', array(
|
62 |
+
$this,
|
63 |
+
'_filter_has_cap_unfiltered_html'
|
64 |
+
));
|
65 |
+
kses_init(); // return any filtering rules back if they has been disabled for import procedure
|
66 |
|
67 |
+
if (!empty($this->options['put_variation_image_to_gallery'])) {
|
68 |
+
add_action('pmxi_gallery_image', array(
|
69 |
+
$this,
|
70 |
+
'action_wpai_gallery_image'
|
71 |
+
), 10, 3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
}
|
73 |
+
if (!empty($this->options['import_additional_variation_images'])) {
|
74 |
+
add_action('pmxi_saved_post', array(
|
75 |
+
$this,
|
76 |
+
'action_wpai_additional_variation_images'
|
77 |
+
), 11, 3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
+
return $this->data;
|
80 |
+
}
|
81 |
|
82 |
+
/**
|
83 |
+
* @param array $importData
|
84 |
+
*
|
85 |
+
* @return bool
|
86 |
+
*/
|
87 |
+
public function import($importData = array()) {
|
88 |
+
if (!$this->isImportAllowed($importData)) {
|
89 |
+
return FALSE;
|
90 |
+
}
|
91 |
+
$this->engine->import($importData);
|
92 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
+
/**
|
95 |
+
* @param $importData
|
96 |
+
*
|
97 |
+
* @return bool
|
98 |
+
*/
|
99 |
+
public function saved_post($importData) {
|
100 |
+
if (!$this->isImportAllowed($importData)) {
|
101 |
+
return FALSE;
|
102 |
+
}
|
103 |
+
$this->engine->after_save_post($importData);
|
104 |
+
}
|
105 |
|
106 |
+
/**
|
107 |
+
* @param $pid
|
108 |
+
* @param $attid
|
109 |
+
* @param $image_filepath
|
110 |
+
*/
|
111 |
+
public function action_wpai_gallery_image($pid, $attid, $image_filepath) {
|
112 |
|
113 |
+
$table = $this->wpdb->posts;
|
114 |
|
115 |
+
$p = $this->wpdb->get_row($this->wpdb->prepare("SELECT * FROM $table WHERE ID = %d;", (int) $pid));
|
116 |
|
117 |
+
if ($p && $p->post_parent) {
|
118 |
+
$gallery = explode(",", get_post_meta($p->post_parent, '_product_image_gallery_tmp', TRUE));
|
119 |
+
if (is_array($gallery)) {
|
120 |
+
$gallery = array_filter($gallery);
|
121 |
+
if (!in_array($attid, $gallery)) {
|
122 |
+
$gallery[] = $attid;
|
123 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
+
else {
|
126 |
+
$gallery = array($attid);
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
+
update_post_meta($p->post_parent, '_product_image_gallery_tmp', implode(',', $gallery));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
}
|
130 |
}
|
131 |
|
132 |
+
/**
|
133 |
+
* @param $pid
|
134 |
+
* @param $xml
|
135 |
+
* @param $update
|
136 |
+
*/
|
137 |
+
public function action_wpai_additional_variation_images($pid, $xml, $update) {
|
138 |
+
$product = wc_get_product($pid);
|
139 |
+
$variationID = get_post_meta($product->get_id(), XmlImportWooCommerceService::FIRST_VARIATION, TRUE);
|
140 |
+
if ($product->is_type('variation') || !empty($variationID)) {
|
141 |
+
if (empty($variationID)) {
|
142 |
+
$variationID = $pid;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
144 |
+
if ($gallery = get_post_meta($product->get_id(), '_product_image_gallery', TRUE)) {
|
145 |
+
update_post_meta($variationID, '_wc_additional_variation_images', $gallery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
}
|
|
|
|
|
|
|
148 |
}
|
149 |
|
150 |
+
/**
|
151 |
+
* @param $caps
|
152 |
+
* @return mixed
|
153 |
+
*/
|
154 |
+
public function _filter_has_cap_unfiltered_html($caps) {
|
155 |
+
$caps['unfiltered_html'] = TRUE;
|
156 |
+
return $caps;
|
157 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
+
/**
|
160 |
+
* @param $importData
|
161 |
+
*
|
162 |
+
* @return bool
|
163 |
+
*/
|
164 |
+
private function isImportAllowed($importData) {
|
165 |
+
if (!in_array($importData['import']->options['custom_type'], array(
|
166 |
+
'product',
|
167 |
+
'product_variation',
|
168 |
+
'shop_order'
|
169 |
+
))
|
170 |
+
) {
|
171 |
+
return FALSE;
|
172 |
}
|
173 |
+
return TRUE;
|
174 |
+
}
|
175 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plugin.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP All Import - WooCommerce Add-On
|
4 |
-
Plugin URI: http://www.wpallimport.com/
|
5 |
Description: An extremely easy, drag & drop importer to import WooCommerce simple products. A paid upgrade is available for premium support and support for Variable, Grouped, and External/Affiliate products
|
6 |
-
Version: 1.4.
|
7 |
Author: Soflyy
|
8 |
-
WC tested up to: 3.6.
|
9 |
*/
|
10 |
|
11 |
if ( ! function_exists( 'is_plugin_active' ) ) {
|
@@ -25,7 +25,7 @@ if ( is_plugin_active('wpai-woocommerce-add-on/wpai-woocommerce-add-on.php') ) {
|
|
25 |
}
|
26 |
else {
|
27 |
|
28 |
-
define('PMWI_FREE_VERSION', '1.4.
|
29 |
|
30 |
define('PMWI_EDITION', 'free');
|
31 |
|
@@ -182,6 +182,10 @@ else {
|
|
182 |
require_once $filePath;
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
185 |
register_activation_hook(self::FILE, array($this, 'activation'));
|
186 |
|
187 |
// register action handlers
|
@@ -330,9 +334,9 @@ else {
|
|
330 |
*/
|
331 |
public function load_plugin_textdomain() {
|
332 |
|
333 |
-
$locale = apply_filters( 'plugin_locale', get_locale(),
|
334 |
|
335 |
-
load_plugin_textdomain(
|
336 |
}
|
337 |
|
338 |
/**
|
@@ -461,7 +465,7 @@ else {
|
|
461 |
if ( ! $is_prefix) { // also check file with original letter case
|
462 |
$filePathAlt = $className . '.php';
|
463 |
}
|
464 |
-
foreach ($is_prefix ? array('models', 'controllers', 'shortcodes', 'classes') : array() as $subdir) {
|
465 |
$path = self::ROOT_DIR . '/' . $subdir . '/' . $filePath;
|
466 |
if (is_file($path)) {
|
467 |
require $path;
|
@@ -487,11 +491,10 @@ else {
|
|
487 |
set_exception_handler(function($e){trigger_error($e->getMessage(), E_USER_ERROR);});
|
488 |
}
|
489 |
|
490 |
-
public function plugin_row_meta($links, $file)
|
491 |
-
{
|
492 |
if ( $file == plugin_basename( __FILE__ ) ) {
|
493 |
$row_meta = array(
|
494 |
-
'pro' => '<a href="http://www.wpallimport.com/woocommerce-product-import
|
495 |
);
|
496 |
|
497 |
return array_merge( $links, $row_meta );
|
@@ -515,6 +518,8 @@ else {
|
|
515 |
'single_product_downloadable' => '',
|
516 |
'is_product_enabled' => 'yes',
|
517 |
'single_product_enabled' => '',
|
|
|
|
|
518 |
'is_product_featured' => 'no',
|
519 |
'single_product_featured' => '',
|
520 |
'is_product_visibility' => 'visible',
|
@@ -580,7 +585,9 @@ else {
|
|
580 |
'single_product_id' => '',
|
581 |
'single_product_parent_id' => '',
|
582 |
'single_product_id_first_is_parent_id' => '',
|
|
|
583 |
'single_product_id_first_is_parent_title' => '',
|
|
|
584 |
'single_product_id_first_is_variation' => '',
|
585 |
'_virtual' => 0,
|
586 |
'_downloadable' => 0,
|
@@ -695,10 +702,119 @@ else {
|
|
695 |
'variation_stock' => '',
|
696 |
'variation_stock_status' => 'auto',
|
697 |
'put_variation_image_to_gallery' => 0,
|
|
|
698 |
'single_variation_stock_status' => '',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
699 |
'is_update_advanced_options' => 1,
|
700 |
'is_update_catalog_visibility' => 1,
|
701 |
-
'is_update_featured_status' => 1
|
|
|
|
|
|
|
|
|
702 |
);
|
703 |
}
|
704 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: WP All Import - WooCommerce Add-On
|
4 |
+
Plugin URI: http://www.wpallimport.com/woocommerce-product-import/?utm_source=import-wooco-products-addon-free&utm_medium=wp-plugins-page&utm_campaign=upgrade-to-pro
|
5 |
Description: An extremely easy, drag & drop importer to import WooCommerce simple products. A paid upgrade is available for premium support and support for Variable, Grouped, and External/Affiliate products
|
6 |
+
Version: 1.4.2
|
7 |
Author: Soflyy
|
8 |
+
WC tested up to: 3.6.5
|
9 |
*/
|
10 |
|
11 |
if ( ! function_exists( 'is_plugin_active' ) ) {
|
25 |
}
|
26 |
else {
|
27 |
|
28 |
+
define('PMWI_FREE_VERSION', '1.4.2');
|
29 |
|
30 |
define('PMWI_EDITION', 'free');
|
31 |
|
182 |
require_once $filePath;
|
183 |
}
|
184 |
|
185 |
+
if (is_dir(self::ROOT_DIR . '/libraries')) foreach (PMWI_Helper::safe_glob(self::ROOT_DIR . '/libraries/*.php', PMWI_Helper::GLOB_RECURSE | PMWI_Helper::GLOB_PATH | PMWI_Helper::GLOB_NOSORT) as $filePath) {
|
186 |
+
require_once $filePath;
|
187 |
+
}
|
188 |
+
|
189 |
register_activation_hook(self::FILE, array($this, 'activation'));
|
190 |
|
191 |
// register action handlers
|
334 |
*/
|
335 |
public function load_plugin_textdomain() {
|
336 |
|
337 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), self::TEXT_DOMAIN );
|
338 |
|
339 |
+
load_plugin_textdomain( self::TEXT_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . "/i18n/languages" );
|
340 |
}
|
341 |
|
342 |
/**
|
465 |
if ( ! $is_prefix) { // also check file with original letter case
|
466 |
$filePathAlt = $className . '.php';
|
467 |
}
|
468 |
+
foreach ($is_prefix ? array('models', 'controllers', 'shortcodes', 'classes') : array('libraries') as $subdir) {
|
469 |
$path = self::ROOT_DIR . '/' . $subdir . '/' . $filePath;
|
470 |
if (is_file($path)) {
|
471 |
require $path;
|
491 |
set_exception_handler(function($e){trigger_error($e->getMessage(), E_USER_ERROR);});
|
492 |
}
|
493 |
|
494 |
+
public function plugin_row_meta($links, $file){
|
|
|
495 |
if ( $file == plugin_basename( __FILE__ ) ) {
|
496 |
$row_meta = array(
|
497 |
+
'pro' => '<a href="http://www.wpallimport.com/woocommerce-product-import/?utm_source=import-wooco-products-addon-free&utm_medium=wp-plugins-page&utm_campaign=upgrade-to-pro" target="_blank" title="' . esc_attr( __( 'WP All Import - WooCommerce Add-On Pro Version', self::TEXT_DOMAIN ) ) . '">' . __( 'Pro Version', self::TEXT_DOMAIN ) . '</a>',
|
498 |
);
|
499 |
|
500 |
return array_merge( $links, $row_meta );
|
518 |
'single_product_downloadable' => '',
|
519 |
'is_product_enabled' => 'yes',
|
520 |
'single_product_enabled' => '',
|
521 |
+
'is_variation_enabled' => 'yes',
|
522 |
+
'single_variation_enabled' => '',
|
523 |
'is_product_featured' => 'no',
|
524 |
'single_product_featured' => '',
|
525 |
'is_product_visibility' => 'visible',
|
585 |
'single_product_id' => '',
|
586 |
'single_product_parent_id' => '',
|
587 |
'single_product_id_first_is_parent_id' => '',
|
588 |
+
'single_product_first_is_parent_id_parent_sku' => '',
|
589 |
'single_product_id_first_is_parent_title' => '',
|
590 |
+
'single_product_first_is_parent_title_parent_sku' => '',
|
591 |
'single_product_id_first_is_variation' => '',
|
592 |
'_virtual' => 0,
|
593 |
'_downloadable' => 0,
|
702 |
'variation_stock' => '',
|
703 |
'variation_stock_status' => 'auto',
|
704 |
'put_variation_image_to_gallery' => 0,
|
705 |
+
'import_additional_variation_images' => 0,
|
706 |
'single_variation_stock_status' => '',
|
707 |
+
'single_product_low_stock_amount' => '',
|
708 |
+
'pmwi_order' => array(
|
709 |
+
'status' => 'wc-pending',
|
710 |
+
'status_xpath' => '',
|
711 |
+
'date' => 'now',
|
712 |
+
'billing_source' => 'guest',
|
713 |
+
'billing_source_match_by' => 'username',
|
714 |
+
'billing_source_username' => '',
|
715 |
+
'billing_source_email' => '',
|
716 |
+
'billing_source_id' => '',
|
717 |
+
'billing_source_cf_name' => '',
|
718 |
+
'billing_source_cf_value' => '',
|
719 |
+
'billing_first_name' => '',
|
720 |
+
'billing_last_name' => '',
|
721 |
+
'billing_company' => '',
|
722 |
+
'billing_address_1' => '',
|
723 |
+
'billing_address_2' => '',
|
724 |
+
'billing_city' => '',
|
725 |
+
'billing_postcode' => '',
|
726 |
+
'billing_country' => '',
|
727 |
+
'billing_state' => '',
|
728 |
+
'billing_email' => '',
|
729 |
+
'billing_phone' => '',
|
730 |
+
'guest_billing_first_name' => '',
|
731 |
+
'guest_billing_last_name' => '',
|
732 |
+
'guest_billing_company' => '',
|
733 |
+
'guest_billing_address_1' => '',
|
734 |
+
'guest_billing_address_2' => '',
|
735 |
+
'guest_billing_city' => '',
|
736 |
+
'guest_billing_postcode' => '',
|
737 |
+
'guest_billing_country' => '',
|
738 |
+
'guest_billing_state' => '',
|
739 |
+
'guest_billing_email' => '',
|
740 |
+
'guest_billing_phone' => '',
|
741 |
+
'is_guest_matching' => 0,
|
742 |
+
'shipping_source' => 'copy',
|
743 |
+
'shipping_first_name' => '',
|
744 |
+
'shipping_last_name' => '',
|
745 |
+
'shipping_company' => '',
|
746 |
+
'shipping_address_1' => '',
|
747 |
+
'shipping_address_2' => '',
|
748 |
+
'shipping_city' => '',
|
749 |
+
'shipping_postcode' => '',
|
750 |
+
'shipping_country' => '',
|
751 |
+
'shipping_state' => '',
|
752 |
+
'shipping_email' => '',
|
753 |
+
'shipping_phone' => '',
|
754 |
+
'copy_from_billing' => 0,
|
755 |
+
'customer_provided_note' => '',
|
756 |
+
'payment_method' => '',
|
757 |
+
'payment_method_xpath' => '',
|
758 |
+
'transaction_id' => '',
|
759 |
+
'products_repeater_mode' => 'csv',
|
760 |
+
'products_repeater_mode_separator' => '|',
|
761 |
+
'products_repeater_mode_foreach' => '',
|
762 |
+
'products_source' => 'existing',
|
763 |
+
'products' => array(),
|
764 |
+
'manual_products' => array(),
|
765 |
+
'fees_repeater_mode' => 'csv',
|
766 |
+
'fees_repeater_mode_separator' => '|',
|
767 |
+
'fees_repeater_mode_foreach' => '',
|
768 |
+
'fees' => array(),
|
769 |
+
'coupons_repeater_mode' => 'csv',
|
770 |
+
'coupons_repeater_mode_separator' => '|',
|
771 |
+
'coupons_repeater_mode_foreach' => '',
|
772 |
+
'coupons' => array(),
|
773 |
+
'shipping_repeater_mode' => 'csv',
|
774 |
+
'shipping_repeater_mode_separator' => '|',
|
775 |
+
'shipping_repeater_mode_foreach' => '',
|
776 |
+
'shipping' => array(),
|
777 |
+
'taxes_repeater_mode' => 'csv',
|
778 |
+
'taxes_repeater_mode_separator' => '|',
|
779 |
+
'taxes_repeater_mode_foreach' => '',
|
780 |
+
'taxes' => array(),
|
781 |
+
'order_total_logic' => 'auto',
|
782 |
+
'order_total_xpath' => '',
|
783 |
+
'order_refund_amount' => '',
|
784 |
+
'order_refund_reason' => '',
|
785 |
+
'order_refund_date' => 'now',
|
786 |
+
'order_refund_issued_source' => 'existing',
|
787 |
+
'order_refund_issued_match_by' => 'username',
|
788 |
+
'order_refund_issued_username' => '',
|
789 |
+
'order_refund_issued_email' => '',
|
790 |
+
'order_refund_issued_cf_name' => '',
|
791 |
+
'order_refund_issued_cf_value' => '',
|
792 |
+
'order_refund_issued_id' => '',
|
793 |
+
'notes_repeater_mode' => 'csv',
|
794 |
+
'notes_repeater_mode_separator' => '|',
|
795 |
+
'notes_repeater_mode_foreach' => '',
|
796 |
+
'notes' => array(),
|
797 |
+
),
|
798 |
+
'is_update_billing_details' => 1,
|
799 |
+
'is_update_shipping_details' => 1,
|
800 |
+
'is_update_payment' => 1,
|
801 |
+
'is_update_notes' => 1,
|
802 |
+
'is_update_products' => 1,
|
803 |
+
'update_products_logic' => 'full_update',
|
804 |
+
'is_update_fees' => 1,
|
805 |
+
'is_update_coupons' => 1,
|
806 |
+
'is_update_shipping' => 1,
|
807 |
+
'is_update_taxes' => 1,
|
808 |
+
'is_update_refunds' => 1,
|
809 |
+
'is_update_total' => 1,
|
810 |
+
'do_not_send_order_notifications' => 1,
|
811 |
'is_update_advanced_options' => 1,
|
812 |
'is_update_catalog_visibility' => 1,
|
813 |
+
'is_update_featured_status' => 1,
|
814 |
+
'existing_parent_product_matching_logic' => 'custom field',
|
815 |
+
'existing_parent_product_title' => '',
|
816 |
+
'existing_parent_product_cf_name' => '_sku',
|
817 |
+
'existing_parent_product_cf_value' => ''
|
818 |
);
|
819 |
}
|
820 |
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 4.1
|
4 |
Tested up to: 5.2
|
5 |
-
Stable tag: 1.4.
|
6 |
License: GPLv2 or later
|
7 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
Tags: woocommerce xml import, woocommerce csv import, woocommerce, import, xml, csv, wp all import, csv import, import csv, xml import, import xml, woocommerce csv importer, woocommerce xml importer, csv importer, csv import suite
|
@@ -34,7 +34,7 @@ Here's why you should use the WooCommerce add-on for WP All Import:
|
|
34 |
|
35 |
The Pro edition of *WP All Import + the WooCommerce add-on* is a paid upgrade that includes premium support and adds the following features:
|
36 |
|
37 |
-
* [In-depth support for Variable products](http://www.wpallimport.com/documentation/woocommerce/variable-products/?utm_source=free
|
38 |
|
39 |
* Import External/Affiliate products
|
40 |
|
@@ -48,7 +48,7 @@ The Pro edition of *WP All Import + the WooCommerce add-on* is a paid upgrade th
|
|
48 |
|
49 |
* Get access to our customer portal with documentation and tutorials, and e-mail technical support.
|
50 |
|
51 |
-
[Upgrade to the Pro edition of WP All Import + the WooCommerce add-on now.](http://www.wpallimport.com/woocommerce-product-import
|
52 |
|
53 |
You need the WooCommerce add-on if you need to:
|
54 |
|
@@ -83,26 +83,30 @@ The WooCommerce add-on will appear in the Step 4 of WP All Import.
|
|
83 |
|
84 |
== Changelog ==
|
85 |
|
|
|
|
|
|
|
|
|
86 |
= 1.4.1 =
|
87 |
-
bug fix: re-import options not rendering correctly
|
88 |
|
89 |
= 1.4.0 =
|
90 |
-
improvement: notice on plugin activation when WooCommerce Add-On Pro installed
|
91 |
-
improvement: match cross-sell products by title
|
92 |
-
bug fix: shipping class not imported properly in some cases
|
93 |
|
94 |
= 1.3.9 =
|
95 |
-
bug fix: do not execute product import code when importing other post types
|
96 |
|
97 |
= 1.3.8 =
|
98 |
-
bug fix: stock status not importing properly when _backorders custom field is not set
|
99 |
-
bug fix: product dimensions won't import if 'Virtual' field is not set
|
100 |
-
bug fix: compatibility fix WooCommerce 2.6.x
|
101 |
-
bug fix: remove deprecated function calls for PHP 7.2 compatibility
|
102 |
-
bug fix: unable to import 0 as a value for attributes
|
103 |
-
bug fix: mirror new WooCommerce core behavior that forces all uncategorized products to be assigned to the Uncategorized category
|
104 |
-
bug fix: import attributes with special characters
|
105 |
-
bug fix: recount product terms when updating post status
|
106 |
|
107 |
= 1.3.7 =
|
108 |
* improvement: added new filter wp_all_import_recount_terms_after_import
|
@@ -226,10 +230,6 @@ bug fix: recount product terms when updating post status
|
|
226 |
|
227 |
== Support ==
|
228 |
|
229 |
-
|
230 |
-
|
231 |
-
We do try to handle support for our free version users at the following e-mail address:
|
232 |
-
|
233 |
-
E-mail: support@wpallimport.com
|
234 |
|
235 |
-
Support
|
2 |
Contributors: soflyy, wpallimport
|
3 |
Requires at least: 4.1
|
4 |
Tested up to: 5.2
|
5 |
+
Stable tag: 1.4.2
|
6 |
License: GPLv2 or later
|
7 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
8 |
Tags: woocommerce xml import, woocommerce csv import, woocommerce, import, xml, csv, wp all import, csv import, import csv, xml import, import xml, woocommerce csv importer, woocommerce xml importer, csv importer, csv import suite
|
34 |
|
35 |
The Pro edition of *WP All Import + the WooCommerce add-on* is a paid upgrade that includes premium support and adds the following features:
|
36 |
|
37 |
+
* [In-depth support for Variable products](http://www.wpallimport.com/documentation/woocommerce/variable-products/?utm_source=import-wooco-products-addon-free&utm_medium=readme&utm_campaign=import-variable-wooco-products) - example CSV files, ability to import variations from properly formatted XML, and much more.
|
38 |
|
39 |
* Import External/Affiliate products
|
40 |
|
48 |
|
49 |
* Get access to our customer portal with documentation and tutorials, and e-mail technical support.
|
50 |
|
51 |
+
[Upgrade to the Pro edition of WP All Import + the WooCommerce add-on now.](http://www.wpallimport.com/woocommerce-product-import/?utm_source=import-wooco-products-addon-free&utm_medium=wp-plugins-page&utm_campaign=upgrade-to-pro "WooCommerce XML & CSV Import")
|
52 |
|
53 |
You need the WooCommerce add-on if you need to:
|
54 |
|
83 |
|
84 |
== Changelog ==
|
85 |
|
86 |
+
= 1.4.2 =
|
87 |
+
* bug fix: grant incorrect downloadable product permissions
|
88 |
+
* bug fix: update attributes with non utf-8 characters
|
89 |
+
|
90 |
= 1.4.1 =
|
91 |
+
* bug fix: re-import options not rendering correctly
|
92 |
|
93 |
= 1.4.0 =
|
94 |
+
* improvement: notice on plugin activation when WooCommerce Add-On Pro installed
|
95 |
+
* improvement: match cross-sell products by title
|
96 |
+
* bug fix: shipping class not imported properly in some cases
|
97 |
|
98 |
= 1.3.9 =
|
99 |
+
* bug fix: do not execute product import code when importing other post types
|
100 |
|
101 |
= 1.3.8 =
|
102 |
+
* bug fix: stock status not importing properly when _backorders custom field is not set
|
103 |
+
* bug fix: product dimensions won't import if 'Virtual' field is not set
|
104 |
+
* bug fix: compatibility fix WooCommerce 2.6.x
|
105 |
+
* bug fix: remove deprecated function calls for PHP 7.2 compatibility
|
106 |
+
* bug fix: unable to import 0 as a value for attributes
|
107 |
+
* bug fix: mirror new WooCommerce core behavior that forces all uncategorized products to be assigned to the Uncategorized category
|
108 |
+
* bug fix: import attributes with special characters
|
109 |
+
* bug fix: recount product terms when updating post status
|
110 |
|
111 |
= 1.3.7 =
|
112 |
* improvement: added new filter wp_all_import_recount_terms_after_import
|
230 |
|
231 |
== Support ==
|
232 |
|
233 |
+
Support for the free version of WP All Import is handled through the WordPress.org community forums.
|
|
|
|
|
|
|
|
|
234 |
|
235 |
+
Support is not guaranteed and is based on ability. For premium support over email, [purchase WP All Import and the WooCommerce add-on.](https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=readme&utm_campaign=premium-support)
|
static/css/admin.css
CHANGED
@@ -5,6 +5,15 @@
|
|
5 |
width: 580px;
|
6 |
height:200px;
|
7 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
.pmxi_checkbox{
|
9 |
position: relative;
|
10 |
top: -2px;
|
@@ -40,10 +49,13 @@
|
|
40 |
padding-top: 0 !important;
|
41 |
margin-top: 0 !important;
|
42 |
}
|
43 |
-
.wpallimport-plugin #woocommerce-product-data
|
|
|
44 |
overflow: hidden;
|
|
|
45 |
}
|
46 |
-
.wpallimport-plugin #woocommerce-product-data .hndle
|
|
|
47 |
margin-bottom: 0px;
|
48 |
cursor: default;
|
49 |
padding: 10px;
|
@@ -94,10 +106,9 @@
|
|
94 |
float: left;
|
95 |
}
|
96 |
.wpallimport-plugin #woocommerce_attributes{
|
97 |
-
/*padding-left: 2%;*/
|
98 |
float: right !important;
|
99 |
padding-top: 10px;
|
100 |
-
width:75% !important;
|
101 |
}
|
102 |
.wpallimport-plugin .variations_tree{
|
103 |
font-family: sans-serif;
|
@@ -291,10 +302,12 @@
|
|
291 |
.wpallimport-plugin #add_on_options .form-field label{
|
292 |
width: 350px;
|
293 |
}
|
294 |
-
.wpallimport-plugin #woocommerce-product-data .wc-tabs-back
|
|
|
295 |
height: 2200px;
|
296 |
}
|
297 |
-
.wpallimport-plugin #woocommerce-product-data .form-field
|
|
|
298 |
padding-left: 20px;
|
299 |
}
|
300 |
.wpallimport-plugin .pmwi_percentage_prices_note,
|
@@ -308,28 +321,6 @@
|
|
308 |
cursor: pointer;
|
309 |
width: 330px;
|
310 |
}
|
311 |
-
.wpallimport-plugin .woo-add-on-free-edition-notice{
|
312 |
-
display: none;
|
313 |
-
margin: 10px;
|
314 |
-
padding: 20px;
|
315 |
-
background-color: #FFB8B8;
|
316 |
-
border: 1px solid #FF8383;
|
317 |
-
text-align:center;
|
318 |
-
}
|
319 |
-
.wpallimport-plugin .form-table td .woo-add-on-free-edition-notice p{
|
320 |
-
color: #000 !important;
|
321 |
-
font-size: 1.3em !important;
|
322 |
-
}
|
323 |
-
.wpallimport-plugin .upgrade_woo_link{
|
324 |
-
color: #000 !important;
|
325 |
-
font-size: 1.3em;
|
326 |
-
text-decoration: underline !important;
|
327 |
-
}
|
328 |
-
.wpallimport-plugin .animate_upgrade{
|
329 |
-
position: relative;
|
330 |
-
z-index: 9999999;
|
331 |
-
display: block;
|
332 |
-
}
|
333 |
.wpallimport-plugin .advanced_attributes{
|
334 |
display: inline-block;
|
335 |
float: left;
|
@@ -374,7 +365,10 @@
|
|
374 |
.wpallimport-plugin .advanced_attribute_settings>div.input:nth-child(4){
|
375 |
margin-top: 15px;
|
376 |
}
|
|
|
377 |
.wpallimport-plugin .advanced_attribute_settings div.input label{
|
|
|
|
|
378 |
top: -7px !important;
|
379 |
}
|
380 |
.wpallimport-plugin .advanced_attribute_settings input[type="text"]{
|
@@ -383,6 +377,164 @@
|
|
383 |
/*float: right;*/
|
384 |
/*width: 120px;*/
|
385 |
}
|
|
|
386 |
.wpallimport-plugin .advanced_attribute_settings input[type="radio"]{
|
387 |
float: left;
|
388 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
width: 580px;
|
6 |
height:200px;
|
7 |
}
|
8 |
+
|
9 |
+
.wpallimport-plugin #woocommerce-coupon-data ul.wc-tabs li a::before,
|
10 |
+
.wpallimport-plugin #woocommerce-product-data ul.wc-tabs li a::before,
|
11 |
+
.wpallimport-plugin .woocommerce ul.wc-tabs li a::before {
|
12 |
+
top: 2px;
|
13 |
+
right: 4px;
|
14 |
+
position: relative;
|
15 |
+
}
|
16 |
+
|
17 |
.pmxi_checkbox{
|
18 |
position: relative;
|
19 |
top: -2px;
|
49 |
padding-top: 0 !important;
|
50 |
margin-top: 0 !important;
|
51 |
}
|
52 |
+
.wpallimport-plugin #woocommerce-product-data,
|
53 |
+
.wpallimport-plugin .woocommerce-order-data{
|
54 |
overflow: hidden;
|
55 |
+
box-shadow:none;
|
56 |
}
|
57 |
+
.wpallimport-plugin #woocommerce-product-data .hndle,
|
58 |
+
.wpallimport-plugin .woocommerce-order-data .hndle{
|
59 |
margin-bottom: 0px;
|
60 |
cursor: default;
|
61 |
padding: 10px;
|
106 |
float: left;
|
107 |
}
|
108 |
.wpallimport-plugin #woocommerce_attributes{
|
|
|
109 |
float: right !important;
|
110 |
padding-top: 10px;
|
111 |
+
width: 75% !important;
|
112 |
}
|
113 |
.wpallimport-plugin .variations_tree{
|
114 |
font-family: sans-serif;
|
302 |
.wpallimport-plugin #add_on_options .form-field label{
|
303 |
width: 350px;
|
304 |
}
|
305 |
+
.wpallimport-plugin #woocommerce-product-data .wc-tabs-back,
|
306 |
+
.wpallimport-plugin .woocommerce-order-data .wc-tabs-back{
|
307 |
height: 2200px;
|
308 |
}
|
309 |
+
.wpallimport-plugin #woocommerce-product-data .form-field,
|
310 |
+
.wpallimport-plugin .woocommerce-order-data .form-field{
|
311 |
padding-left: 20px;
|
312 |
}
|
313 |
.wpallimport-plugin .pmwi_percentage_prices_note,
|
321 |
cursor: pointer;
|
322 |
width: 330px;
|
323 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
.wpallimport-plugin .advanced_attributes{
|
325 |
display: inline-block;
|
326 |
float: left;
|
365 |
.wpallimport-plugin .advanced_attribute_settings>div.input:nth-child(4){
|
366 |
margin-top: 15px;
|
367 |
}
|
368 |
+
|
369 |
.wpallimport-plugin .advanced_attribute_settings div.input label{
|
370 |
+
/*width: 100%;*/
|
371 |
+
/*float: right;*/
|
372 |
top: -7px !important;
|
373 |
}
|
374 |
.wpallimport-plugin .advanced_attribute_settings input[type="text"]{
|
377 |
/*float: right;*/
|
378 |
/*width: 120px;*/
|
379 |
}
|
380 |
+
|
381 |
.wpallimport-plugin .advanced_attribute_settings input[type="radio"]{
|
382 |
float: left;
|
383 |
+
}
|
384 |
+
/*.wpallimport-plugin .shop_order_tabs li a::before{
|
385 |
+
content: "" !important;
|
386 |
+
}*/
|
387 |
+
.wpallimport-plugin .wpallimport-order-billing-fields{
|
388 |
+
width: 98%;
|
389 |
+
}
|
390 |
+
.wpallimport-plugin .wpallimport-order-billing-fields input[type="text"]{
|
391 |
+
width: 100% !important;
|
392 |
+
}
|
393 |
+
.wpallimport-plugin a.add-new-line{
|
394 |
+
position: relative;
|
395 |
+
top:-10px;
|
396 |
+
background: rgba(0, 0, 0, 0) url("../img/add.png") no-repeat scroll 0 3px;
|
397 |
+
padding-left: 15px;
|
398 |
+
}
|
399 |
+
/*.wpallimport-plugin .woocommerce-order-data a.add-new-line::before{
|
400 |
+
content: "+ ";
|
401 |
+
color: grey;
|
402 |
+
}*/
|
403 |
+
.wpallimport-plugin .woocommerce-order-data hr{
|
404 |
+
margin: 20px 0;
|
405 |
+
}
|
406 |
+
.wpallimport-plugin .woocommerce-order-data input[type="text"],
|
407 |
+
.wpallimport-plugin .woocommerce-order-data select{
|
408 |
+
height: 40px !important;
|
409 |
+
}
|
410 |
+
/* WooCommerce Orders icons */
|
411 |
+
.wpallimport-plugin .woocommerce-order-billing-data a::before{
|
412 |
+
content:"\e02d" !important;
|
413 |
+
font-family: WooCommerce !important;
|
414 |
+
}
|
415 |
+
.wpallimport-plugin .woocommerce-order-shipping-data a::before{
|
416 |
+
content:"\e019" !important;
|
417 |
+
font-family: WooCommerce !important;
|
418 |
+
}
|
419 |
+
.wpallimport-plugin .woocommerce-order-payment-data a::before{
|
420 |
+
content:"\e01e" !important;
|
421 |
+
font-family: WooCommerce !important;
|
422 |
+
}
|
423 |
+
.wpallimport-plugin .woocommerce-order-products-data a::before{
|
424 |
+
content:"\e01d" !important;
|
425 |
+
font-family: WooCommerce !important;
|
426 |
+
}
|
427 |
+
.wpallimport-plugin .woocommerce-order-fees-data a::before{
|
428 |
+
content:"\e01f" !important;
|
429 |
+
font-family: WooCommerce !important;
|
430 |
+
}
|
431 |
+
.wpallimport-plugin .woocommerce-order-coupons-data a::before{
|
432 |
+
content:"\e600" !important;
|
433 |
+
font-family: WooCommerce !important;
|
434 |
+
}
|
435 |
+
.wpallimport-plugin .woocommerce-order-shipping-data a::before{
|
436 |
+
content:"\e019" !important;
|
437 |
+
font-family: WooCommerce !important;
|
438 |
+
}
|
439 |
+
.wpallimport-plugin .woocommerce-order-taxes-data a::before{
|
440 |
+
content:"\e00e" !important;
|
441 |
+
font-family: WooCommerce !important;
|
442 |
+
}
|
443 |
+
.wpallimport-plugin .woocommerce-order-refunds-data a::before{
|
444 |
+
content:"\e014" !important;
|
445 |
+
font-family: WooCommerce !important;
|
446 |
+
}
|
447 |
+
.wpallimport-plugin .woocommerce-order-total-data a::before{
|
448 |
+
content:"\e017" !important;
|
449 |
+
font-family: WooCommerce !important;
|
450 |
+
}
|
451 |
+
|
452 |
+
/* Repeater Styles */
|
453 |
+
|
454 |
+
.order-separator-label {
|
455 |
+
width: auto!important;
|
456 |
+
}
|
457 |
+
|
458 |
+
.order-separator-input {
|
459 |
+
margin-left: 15px!important;
|
460 |
+
}
|
461 |
+
|
462 |
+
div.wpallimport-collapsed.wpallimport-section.order-imports {
|
463 |
+
margin-top: -1px;
|
464 |
+
}
|
465 |
+
|
466 |
+
div.wpallimport-content-section.rad4.order-imports {
|
467 |
+
border-left-style: none;
|
468 |
+
border-right-style: none;
|
469 |
+
border-radius: 0;
|
470 |
+
border-color: #eee;
|
471 |
+
}
|
472 |
+
|
473 |
+
div.wpallimport-collapsed.wpallimport-section.order-imports label.foreach-do {
|
474 |
+
width: auto;
|
475 |
+
}
|
476 |
+
|
477 |
+
div#order_products.panel.woocommerce_options_panel,
|
478 |
+
div#order_fees.panel.woocommerce_options_panel,
|
479 |
+
div#order_products.panel.woocommerce_options_panel,
|
480 |
+
div#order_coupons.panel.woocommerce_options_panel,
|
481 |
+
div#order_shipping.panel.woocommerce_options_panel,
|
482 |
+
div#order_taxes.panel.woocommerce_options_panel {
|
483 |
+
padding-bottom: 0;
|
484 |
+
}
|
485 |
+
.wpallimport-plugin .is_guest_matching_notice,
|
486 |
+
.wpallimport-plugin .wpallimport-select-switcher-target{
|
487 |
+
display: none;
|
488 |
+
}
|
489 |
+
.wpallimport-plugin .wpallimport-billing-user-try-match-selector label{
|
490 |
+
line-height: 40px !important;
|
491 |
+
padding-left: 20px;
|
492 |
+
padding-right: 10px;
|
493 |
+
width: auto;
|
494 |
+
}
|
495 |
+
.wpallimport-plugin .wpallimport-billing-user-try-match-selector select{
|
496 |
+
width: 130px;
|
497 |
+
font-size: 14px !important;
|
498 |
+
}
|
499 |
+
#attributes_table .drag-attribute,
|
500 |
+
#variation_attributes_table .drag-attribute{
|
501 |
+
overflow: hidden;
|
502 |
+
background: url("../img/drag.png") top right no-repeat;
|
503 |
+
cursor: pointer;
|
504 |
+
padding-left: 25px;
|
505 |
+
background-position: 0 10px;
|
506 |
+
}
|
507 |
+
#attributes_table .ui-sortable-placeholder,
|
508 |
+
#variation_attributes_table .ui-sortable-placeholder {
|
509 |
+
border: 1px dashed #ccc;
|
510 |
+
visibility: visible !important;
|
511 |
+
height: 100px;
|
512 |
+
}
|
513 |
+
|
514 |
+
/****************/
|
515 |
+
/* Free Edition */
|
516 |
+
/****************/
|
517 |
+
|
518 |
+
.wpallimport-plugin .woo-add-on-free-edition-notice{
|
519 |
+
display: none;
|
520 |
+
margin: 10px;
|
521 |
+
padding: 20px;
|
522 |
+
background-color: #FFB8B8;
|
523 |
+
border: 1px solid #FF8383;
|
524 |
+
text-align:center;
|
525 |
+
}
|
526 |
+
.wpallimport-plugin .form-table td .woo-add-on-free-edition-notice p{
|
527 |
+
color: #000 !important;
|
528 |
+
font-size: 1.3em !important;
|
529 |
+
}
|
530 |
+
.wpallimport-plugin .upgrade_woo_link{
|
531 |
+
color: #000 !important;
|
532 |
+
font-size: 1.3em;
|
533 |
+
text-decoration: underline !important;
|
534 |
+
}
|
535 |
+
.wpallimport-plugin .animate_upgrade{
|
536 |
+
position: relative;
|
537 |
+
z-index: 9999999;
|
538 |
+
display: block;
|
539 |
+
}
|
540 |
+
|
static/img/add.png
ADDED
Binary file
|
static/img/drag.png
ADDED
Binary file
|
static/js/admin.js
CHANGED
@@ -5,9 +5,10 @@
|
|
5 |
if ( ! $('body.wpallimport-plugin').length) return; // do not execute any code if we are not on plugin page
|
6 |
|
7 |
$('.product_data_tabs').find('a').click(function(){
|
8 |
-
$(
|
|
|
9 |
$(this).parent('li').addClass('active');
|
10 |
-
$('.panel').hide();
|
11 |
$('#' + $(this).attr('rel')).show();
|
12 |
});
|
13 |
|
@@ -16,7 +17,7 @@
|
|
16 |
var is_variable = ($('#product-type').val() == 'variable');
|
17 |
var is_grouped = ($('#product-type').val() == 'grouped');
|
18 |
var is_simple = ($('#product-type').val() == 'simple');
|
19 |
-
var is_external = ($('#product-type').val() == 'external');
|
20 |
var is_downloadable = !($('input[name=is_product_downloadable]:checked').val() == 'no');
|
21 |
var is_variable_downloadable = !($('input[name=is_variable_product_downloadable]:checked').val() == 'no');
|
22 |
var is_virtual = ($('#_virtual').is(':checked'));
|
@@ -24,13 +25,17 @@
|
|
24 |
|
25 |
if (!is_multiple_product_type) $('.product_data_tabs li, .options_group').show();
|
26 |
|
|
|
|
|
|
|
|
|
27 |
$('.product_data_tabs li, .options_group').each(function(){
|
28 |
|
29 |
if (($(this).hasClass('hide_if_grouped') ||
|
30 |
$(this).hasClass('hide_if_external')) && is_multiple_product_type)
|
31 |
{
|
32 |
if ($(this).hasClass('hide_if_grouped') && is_grouped) { $(this).hide(); return true; } else if ( $(this).hasClass('hide_if_grouped') && !is_grouped ) $(this).show();
|
33 |
-
if ($(this).hasClass('hide_if_external') && is_external) { $(this).hide(); return true; } else if ( $(this).hasClass('hide_if_external') && !is_external ) $(this).show();
|
34 |
}
|
35 |
|
36 |
if (($(this).hasClass('show_if_simple') || $(this).hasClass('show_if_variable') || $(this).hasClass('show_if_grouped') || $(this).hasClass('show_if_external')) && is_multiple_product_type){
|
@@ -78,28 +83,62 @@
|
|
78 |
|
79 |
if ($('input[name=is_product_manage_stock]:checked').val() == 'no') $('.stock_fields').hide(); else $('.stock_fields').show();
|
80 |
|
81 |
-
if ($('input[name=is_variable_product_manage_stock]:checked').val() == 'no') $('.variable_stock_fields').hide(); else $('.variable_stock_fields').fadeIn();
|
82 |
|
83 |
if ($('#link_all_variations').is(':checked')) $('.variations_tab').hide(); else if (is_variable) $('.variations_tab').show();
|
84 |
|
85 |
if ($('#xml_matching_parent').is(':checked') && is_variable) $('#variations_tag').show(); else $('#variations_tag').hide();
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
90 |
}
|
91 |
-
else
|
92 |
-
$('
|
93 |
-
$('.
|
94 |
}
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
$('input[name=matching_parent]').click(function(){
|
98 |
|
99 |
-
if ($(this).val() == "xml") $(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
});
|
102 |
|
|
|
|
|
|
|
|
|
103 |
change_depencies();
|
104 |
|
105 |
$('#product-type').change(function(){
|
@@ -141,21 +180,6 @@
|
|
141 |
$('#variable_sale_price_shedule').show();
|
142 |
});
|
143 |
|
144 |
-
// $('#_variable_virtual').click(function(){
|
145 |
-
// if ($(this).is(':checked')){
|
146 |
-
// $('#variable_virtual').show();
|
147 |
-
// $('#variable_dimensions').hide();
|
148 |
-
// }
|
149 |
-
// else{
|
150 |
-
// $('#variable_virtual').hide();
|
151 |
-
// $('#variable_dimensions').show();
|
152 |
-
// }
|
153 |
-
// });
|
154 |
-
|
155 |
-
// $('#_variable_downloadable').click(function(){
|
156 |
-
// if ($(this).is(':checked')) $('.variable_downloadable').show(); else $('.variable_downloadable').hide();
|
157 |
-
// });
|
158 |
-
|
159 |
var variation_xpath = $('#variations_xpath').val();
|
160 |
|
161 |
$('#variations_xpath').blur(function(){
|
@@ -213,8 +237,9 @@
|
|
213 |
if (13 == e.keyCode) {$variation_tagno = 0; $(this).change();}
|
214 |
});
|
215 |
|
216 |
-
if ($input.val() != "")
|
217 |
-
|
|
|
218 |
|
219 |
$('#variations_xpath').mousemove(function(){
|
220 |
variationsXPathChanged();
|
@@ -223,24 +248,17 @@
|
|
223 |
|
224 |
|
225 |
$('.variation_attributes').find('label').live({
|
226 |
-
mouseenter:
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
}
|
238 |
-
},
|
239 |
-
mouseleave:
|
240 |
-
function()
|
241 |
-
{
|
242 |
-
|
243 |
-
}
|
244 |
});
|
245 |
|
246 |
$('.add-new-custom').click(function(){
|
@@ -248,11 +266,9 @@
|
|
248 |
var counter = $(this).parents('table:first').find('tr.form-field:visible').length - 1;
|
249 |
|
250 |
$('#woocommerce_attributes').find('.default_attribute_settings').find('label').each(function(){
|
251 |
-
if ( "" == $(this).attr('for') )
|
252 |
-
{
|
253 |
var $parent = $(this).parents('tr.form-field:first');
|
254 |
-
if ( ! $parent.hasClass('template'))
|
255 |
-
{
|
256 |
$(this).parents('span:first').find('input').attr('id', $(this).parents('span:first').find('input').attr('name').replace('[]','') + '_' + counter );
|
257 |
$(this).attr('for', $(this).parents('span:first').find('input').attr('id'));
|
258 |
var $create_terms = $(this).parents('.wpallimport-radio-field:first').find('.is_create_taxonomy');
|
@@ -263,8 +279,7 @@
|
|
263 |
|
264 |
$('#woocommerce_attributes').find('.advanced_settings_template').each(function(){
|
265 |
var $tpl = $(this).parents('tr.form-field:first');
|
266 |
-
if ( ! $tpl.hasClass('template'))
|
267 |
-
{
|
268 |
$(this).find('label').each(function(){
|
269 |
$(this).attr('for', $(this).attr('for').replace('00', counter));
|
270 |
});
|
@@ -305,8 +320,9 @@
|
|
305 |
$(this).parents('#product:first').find('input[name=unique_key]').val($unique_key + attrs.join('-'));
|
306 |
alert('The unique key has been successfully generated');
|
307 |
}
|
308 |
-
else
|
309 |
-
|
|
|
310 |
});
|
311 |
|
312 |
$('.pmwi_adjust_type').change(function(){
|
@@ -337,25 +353,25 @@
|
|
337 |
});
|
338 |
|
339 |
$('.pmwi_trigger_adjust_prices').click(function(){
|
340 |
-
if ($(this).find('span').html() == '-')
|
341 |
-
|
342 |
-
|
343 |
-
|
|
|
|
|
344 |
$('.pmwi_adjust_prices').slideToggle();
|
345 |
});
|
346 |
|
347 |
$('.advanced_attributes').live('click', function(){
|
348 |
var $parent = $(this).parent('div.wpallimport-radio-field:first');
|
349 |
|
350 |
-
if ($(this).find('span').html() == "+")
|
351 |
-
{
|
352 |
$parent.find('.default_attribute_settings').hide();
|
353 |
$parent.find('.advanced_attribute_settings').fadeIn();
|
354 |
$parent.find('input[name^=is_advanced]').val('1');
|
355 |
$(this).find('span').html("-");
|
356 |
}
|
357 |
-
else
|
358 |
-
{
|
359 |
$parent.find('.advanced_attribute_settings').hide();
|
360 |
$parent.find('.default_attribute_settings').fadeIn();
|
361 |
$parent.find('input[name^=is_advanced]').val('0');
|
@@ -364,11 +380,139 @@
|
|
364 |
});
|
365 |
|
366 |
$('input[name^=is_advanced]').each(function(){
|
367 |
-
if ($(this).val() == '1')
|
368 |
-
{
|
369 |
var $parent = $(this).parent('div.wpallimport-radio-field:first');
|
370 |
$parent.find('.advanced_attributes').click();
|
371 |
}
|
372 |
});
|
373 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
});})(jQuery);
|
5 |
if ( ! $('body.wpallimport-plugin').length) return; // do not execute any code if we are not on plugin page
|
6 |
|
7 |
$('.product_data_tabs').find('a').click(function(){
|
8 |
+
var $parent = $(this).parents('.product_data_tabs').first();
|
9 |
+
$parent.find('li').removeClass('active');
|
10 |
$(this).parent('li').addClass('active');
|
11 |
+
$(this).parents('.panel-wrap').first().find('.panel').hide();
|
12 |
$('#' + $(this).attr('rel')).show();
|
13 |
});
|
14 |
|
17 |
var is_variable = ($('#product-type').val() == 'variable');
|
18 |
var is_grouped = ($('#product-type').val() == 'grouped');
|
19 |
var is_simple = ($('#product-type').val() == 'simple');
|
20 |
+
var is_external = ($('#product-type').val() == 'external');
|
21 |
var is_downloadable = !($('input[name=is_product_downloadable]:checked').val() == 'no');
|
22 |
var is_variable_downloadable = !($('input[name=is_variable_product_downloadable]:checked').val() == 'no');
|
23 |
var is_virtual = ($('#_virtual').is(':checked'));
|
25 |
|
26 |
if (!is_multiple_product_type) $('.product_data_tabs li, .options_group').show();
|
27 |
|
28 |
+
if ( ! is_variable && ! is_grouped && ! is_external && is_multiple_product_type ) {
|
29 |
+
is_simple = true;
|
30 |
+
}
|
31 |
+
|
32 |
$('.product_data_tabs li, .options_group').each(function(){
|
33 |
|
34 |
if (($(this).hasClass('hide_if_grouped') ||
|
35 |
$(this).hasClass('hide_if_external')) && is_multiple_product_type)
|
36 |
{
|
37 |
if ($(this).hasClass('hide_if_grouped') && is_grouped) { $(this).hide(); return true; } else if ( $(this).hasClass('hide_if_grouped') && !is_grouped ) $(this).show();
|
38 |
+
if ($(this).hasClass('hide_if_external') && is_external) { $(this).hide(); return true; } else if ( $(this).hasClass('hide_if_external') && !is_external ) $(this).show();
|
39 |
}
|
40 |
|
41 |
if (($(this).hasClass('show_if_simple') || $(this).hasClass('show_if_variable') || $(this).hasClass('show_if_grouped') || $(this).hasClass('show_if_external')) && is_multiple_product_type){
|
83 |
|
84 |
if ($('input[name=is_product_manage_stock]:checked').val() == 'no') $('.stock_fields').hide(); else $('.stock_fields').show();
|
85 |
|
86 |
+
if ($('input[name=is_variable_product_manage_stock]:checked').val() == 'no') $('.variable_stock_fields').hide(); else $('.variable_stock_fields').fadeIn();
|
87 |
|
88 |
if ($('#link_all_variations').is(':checked')) $('.variations_tab').hide(); else if (is_variable) $('.variations_tab').show();
|
89 |
|
90 |
if ($('#xml_matching_parent').is(':checked') && is_variable) $('#variations_tag').show(); else $('#variations_tag').hide();
|
91 |
|
92 |
+
var matching_parent = $('input[name=matching_parent]:checked').val();
|
93 |
+
|
94 |
+
if (matching_parent == "xml" || matching_parent == "first_is_parent_title" || matching_parent == "auto" || matching_parent == "existing"){
|
95 |
+
$('#variations_tag').show();
|
96 |
+
$('.variations_are_not_child_elements').hide();
|
97 |
}
|
98 |
+
else{
|
99 |
+
$('#variations_tag').hide();
|
100 |
+
$('.variations_are_not_child_elements').show();
|
101 |
}
|
102 |
+
|
103 |
+
if ($('input[name=is_variation_product_manage_stock]:checked').val() == 'no' || matching_parent == "xml" || matching_parent == "first_is_parent_title" || matching_parent == "auto" || matching_parent == "existing"){
|
104 |
+
$('.variation_stock_fields').hide();
|
105 |
+
} else {
|
106 |
+
$('.variation_stock_fields').fadeIn();
|
107 |
+
}
|
108 |
+
|
109 |
+
/****************/
|
110 |
+
/* Free Edition */
|
111 |
+
/****************/
|
112 |
+
if (woo_addon_free_edition == 'free') {
|
113 |
+
if ( ! is_simple ) {
|
114 |
+
$('.woocommerce_options_panel').find('input, select').attr('disabled','disabled');
|
115 |
+
$('.upgrade_template').show();
|
116 |
+
}
|
117 |
+
else {
|
118 |
+
$('.woocommerce_options_panel').find('input, select').removeAttr('disabled');
|
119 |
+
$('.upgrade_template').hide();
|
120 |
+
}
|
121 |
+
}
|
122 |
+
};
|
123 |
|
124 |
$('input[name=matching_parent]').click(function(){
|
125 |
|
126 |
+
if ($(this).val() == "xml" || $(this).val() == "first_is_parent_title" || $(this).val() == "auto" || $(this).val() == "existing"){
|
127 |
+
$('#variations_tag').show();
|
128 |
+
$('.variations_are_not_child_elements').hide();
|
129 |
+
}
|
130 |
+
else{
|
131 |
+
$('#variations_tag').hide();
|
132 |
+
$('.variations_are_not_child_elements').show();
|
133 |
+
if ($('input[name=is_variation_product_manage_stock]:checked').val() == 'no') $('.variation_stock_fields').hide(); else $('.variation_stock_fields').fadeIn();
|
134 |
+
}
|
135 |
|
136 |
});
|
137 |
|
138 |
+
$('input[name=is_variation_product_manage_stock]').click(function(){
|
139 |
+
if ($('input[name=is_variation_product_manage_stock]:checked').val() == 'no') $('.variation_stock_fields').hide(); else $('.variation_stock_fields').fadeIn();
|
140 |
+
});
|
141 |
+
|
142 |
change_depencies();
|
143 |
|
144 |
$('#product-type').change(function(){
|
180 |
$('#variable_sale_price_shedule').show();
|
181 |
});
|
182 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
183 |
var variation_xpath = $('#variations_xpath').val();
|
184 |
|
185 |
$('#variations_xpath').blur(function(){
|
237 |
if (13 == e.keyCode) {$variation_tagno = 0; $(this).change();}
|
238 |
});
|
239 |
|
240 |
+
if ($input.val() != "") {
|
241 |
+
variationsXPathChanged();
|
242 |
+
}
|
243 |
|
244 |
$('#variations_xpath').mousemove(function(){
|
245 |
variationsXPathChanged();
|
248 |
|
249 |
|
250 |
$('.variation_attributes').find('label').live({
|
251 |
+
mouseenter: function () {
|
252 |
+
if ("" == $(this).attr('for')) {
|
253 |
+
var counter = $(this).parents('table:first').find('tr.form-field:visible').length;
|
254 |
+
|
255 |
+
$(this).parents('span:first').find('input').attr('id', $(this).parents('span:first').find('input').attr('name').replace('[]', '') + '_' + counter);
|
256 |
+
$(this).attr('for', $(this).parents('span:first').find('input').attr('id'));
|
257 |
+
var $create_terms = $(this).parents('.wpallimport-radio-field:first').find('.is_create_taxonomy');
|
258 |
+
if (!$create_terms.hasClass('switcher-target-is_taxonomy_' + counter)) $create_terms.addClass('switcher-target-is_taxonomy_' + counter);
|
259 |
+
}
|
260 |
+
},
|
261 |
+
mouseleave: function () {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
});
|
263 |
|
264 |
$('.add-new-custom').click(function(){
|
266 |
var counter = $(this).parents('table:first').find('tr.form-field:visible').length - 1;
|
267 |
|
268 |
$('#woocommerce_attributes').find('.default_attribute_settings').find('label').each(function(){
|
269 |
+
if ( "" == $(this).attr('for') ) {
|
|
|
270 |
var $parent = $(this).parents('tr.form-field:first');
|
271 |
+
if ( ! $parent.hasClass('template')) {
|
|
|
272 |
$(this).parents('span:first').find('input').attr('id', $(this).parents('span:first').find('input').attr('name').replace('[]','') + '_' + counter );
|
273 |
$(this).attr('for', $(this).parents('span:first').find('input').attr('id'));
|
274 |
var $create_terms = $(this).parents('.wpallimport-radio-field:first').find('.is_create_taxonomy');
|
279 |
|
280 |
$('#woocommerce_attributes').find('.advanced_settings_template').each(function(){
|
281 |
var $tpl = $(this).parents('tr.form-field:first');
|
282 |
+
if ( ! $tpl.hasClass('template')) {
|
|
|
283 |
$(this).find('label').each(function(){
|
284 |
$(this).attr('for', $(this).attr('for').replace('00', counter));
|
285 |
});
|
320 |
$(this).parents('#product:first').find('input[name=unique_key]').val($unique_key + attrs.join('-'));
|
321 |
alert('The unique key has been successfully generated');
|
322 |
}
|
323 |
+
else {
|
324 |
+
alert('At first, you should add minimum one attribute on the "Attributes" tab.');
|
325 |
+
}
|
326 |
});
|
327 |
|
328 |
$('.pmwi_adjust_type').change(function(){
|
353 |
});
|
354 |
|
355 |
$('.pmwi_trigger_adjust_prices').click(function(){
|
356 |
+
if ($(this).find('span').html() == '-') {
|
357 |
+
$(this).find('span').html('+');
|
358 |
+
}
|
359 |
+
else {
|
360 |
+
$(this).find('span').html('-');
|
361 |
+
}
|
362 |
$('.pmwi_adjust_prices').slideToggle();
|
363 |
});
|
364 |
|
365 |
$('.advanced_attributes').live('click', function(){
|
366 |
var $parent = $(this).parent('div.wpallimport-radio-field:first');
|
367 |
|
368 |
+
if ($(this).find('span').html() == "+") {
|
|
|
369 |
$parent.find('.default_attribute_settings').hide();
|
370 |
$parent.find('.advanced_attribute_settings').fadeIn();
|
371 |
$parent.find('input[name^=is_advanced]').val('1');
|
372 |
$(this).find('span').html("-");
|
373 |
}
|
374 |
+
else {
|
|
|
375 |
$parent.find('.advanced_attribute_settings').hide();
|
376 |
$parent.find('.default_attribute_settings').fadeIn();
|
377 |
$parent.find('input[name^=is_advanced]').val('0');
|
380 |
});
|
381 |
|
382 |
$('input[name^=is_advanced]').each(function(){
|
383 |
+
if ($(this).val() == '1') {
|
|
|
384 |
var $parent = $(this).parent('div.wpallimport-radio-field:first');
|
385 |
$parent.find('.advanced_attributes').click();
|
386 |
}
|
387 |
});
|
388 |
|
389 |
+
// [ WC Orders View ]
|
390 |
+
// swither show/hide logic
|
391 |
+
$('select.switcher').live('change', function (e) {
|
392 |
+
|
393 |
+
var $targets = $('.switcher-target-' + $(this).attr('id'));
|
394 |
+
|
395 |
+
var is_show = $(this).val() == 'xpath'; if ($(this).is('.switcher-reversed')) is_show = ! is_show;
|
396 |
+
if (is_show) {
|
397 |
+
$targets.slideDown();
|
398 |
+
} else {
|
399 |
+
$targets.slideUp().find('.clear-on-switch').add($targets.filter('.clear-on-switch')).val('');
|
400 |
+
}
|
401 |
+
|
402 |
+
}).change();
|
403 |
+
|
404 |
+
$('a.add-new-line').live('click', function(){
|
405 |
+
var $parent = $(this).parents('table').first();
|
406 |
+
var $template = $parent.children('tbody').children('tr.template');
|
407 |
+
var $clone = $template.clone(true);
|
408 |
+
var $number = parseInt($parent.find('tbody:first').children().not('.template').length) - 1;
|
409 |
+
|
410 |
+
var $cloneHtml = $clone.html().replace(/ROWNUMBER/g, $number).replace(/CELLNUMBER/g, 'ROWNUMBER').replace('date-picker', 'datepicker');
|
411 |
+
|
412 |
+
$clone.html($cloneHtml);
|
413 |
+
|
414 |
+
$clone.insertBefore($template).css('display', 'none').removeClass('template').fadeIn();
|
415 |
+
|
416 |
+
// datepicker
|
417 |
+
$parent.find('input.datepicker').removeClass('date-picker').addClass('datepicker').datepicker({
|
418 |
+
dateFormat: 'yy-mm-dd',
|
419 |
+
showOn: 'button',
|
420 |
+
buttonText: '',
|
421 |
+
constrainInput: false,
|
422 |
+
showAnim: 'fadeIn',
|
423 |
+
showOptions: 'fast'
|
424 |
+
}).bind('change', function () {
|
425 |
+
var selectedDate = $(this).val();
|
426 |
+
var instance = $(this).data('datepicker');
|
427 |
+
var date = null;
|
428 |
+
if ('' != selectedDate) {
|
429 |
+
try {
|
430 |
+
date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
|
431 |
+
} catch (e) {
|
432 |
+
date = null;
|
433 |
+
}
|
434 |
+
}
|
435 |
+
if ($(this).hasClass('range-from')) {
|
436 |
+
$(this).parent().find('.datepicker.range-to').datepicker("option", "minDate", date);
|
437 |
+
}
|
438 |
+
if ($(this).hasClass('range-to')) {
|
439 |
+
$(this).parent().find('.datepicker.range-from').datepicker("option", "maxDate", date);
|
440 |
+
}
|
441 |
+
}).change();
|
442 |
+
$('.ui-datepicker').hide(); // fix: make sure datepicker doesn't break wordpress wpallimport-layout upon initialization
|
443 |
+
|
444 |
+
return false;
|
445 |
+
});
|
446 |
+
|
447 |
+
$('a.add-new-line').each(function(){
|
448 |
+
var $parent = $(this).parents('table:first');
|
449 |
+
if ($(this).parents('table').length < 4 && $parent.children('tbody').children('tr').length == 2) {
|
450 |
+
$(this).click();
|
451 |
+
}
|
452 |
+
});
|
453 |
+
|
454 |
+
$('a.switcher').live('click', function (e) {
|
455 |
+
|
456 |
+
var $targets = $('.switcher-target-' + $(this).attr('id'));
|
457 |
+
|
458 |
+
var is_show = $(this).find('span').html() == '+'; if ($(this).is('.switcher-reversed')) is_show = ! is_show;
|
459 |
+
if (is_show) {
|
460 |
+
$(this).find('span').html('-');
|
461 |
+
|
462 |
+
if ($targets.find('a.add-new-line').length){
|
463 |
+
var $parent = $targets.find('a.add-new-line').parents('table:first');
|
464 |
+
if ($parent.children('tbody').children('tr').length == 2){
|
465 |
+
var $add_new = $targets.find('a.add-new-line');
|
466 |
+
var $taxes = $add_new.parents('table').first();
|
467 |
+
var $template = $taxes.children('tbody').children('tr.template');
|
468 |
+
var $clone = $template.clone(true);
|
469 |
+
var $number = parseInt($taxes.find('tbody:first').children().not('.template').length) - 1;
|
470 |
+
|
471 |
+
var $cloneHtml = $clone.html().replace(/ROWNUMBER/g, $number).replace(/CELLNUMBER/g, 'ROWNUMBER').replace('date-picker', 'datepicker');
|
472 |
+
|
473 |
+
$clone.html($cloneHtml);
|
474 |
+
|
475 |
+
$clone.insertBefore($template).css('display', 'none').removeClass('template').show();
|
476 |
+
}
|
477 |
+
}
|
478 |
+
$targets.slideDown('slow');
|
479 |
+
} else {
|
480 |
+
$(this).find('span').html('+');
|
481 |
+
$targets.slideUp().find('.clear-on-switch').add($targets.filter('.clear-on-switch')).val('');
|
482 |
+
}
|
483 |
+
}).click();
|
484 |
+
|
485 |
+
$('.variable_repeater_mode').live('change', function(){
|
486 |
+
// if variable mode
|
487 |
+
if ($(this).is(':checked')) {
|
488 |
+
var $parent = $(this).parents('.options_group:first');
|
489 |
+
if ($(this).val() == 'xml' || $(this).val() == 'csv') {
|
490 |
+
$parent.find('table.wpallimport_variable_table').find('tr.wpallimport-row-actions').hide();
|
491 |
+
}
|
492 |
+
else {
|
493 |
+
$parent.find('table.wpallimport_variable_table').find('tr.wpallimport-row-actions').show();
|
494 |
+
}
|
495 |
+
}
|
496 |
+
}).change();
|
497 |
+
|
498 |
+
$('#billing_source_match_by').on('change', function(){
|
499 |
+
$('.wpallimport-select-switcher-target').hide();
|
500 |
+
$('.wpallimport-select-switcher-target[rel='+ $(this).val() +']').slideDown();
|
501 |
+
}).change();
|
502 |
+
|
503 |
+
$('#billing_is_guest_matching').on('change', function(){
|
504 |
+
if ($(this).is(':checked')){
|
505 |
+
$('.is_guest_matching_notice').hide();
|
506 |
+
}
|
507 |
+
else{
|
508 |
+
$('.is_guest_matching_notice').slideDown();
|
509 |
+
}
|
510 |
+
}).change();
|
511 |
+
|
512 |
+
// Sortable product attributes.
|
513 |
+
$('#attributes_table tbody, #variation_attributes_table tbody').sortable({
|
514 |
+
items: "tr:not(.wpallimport-table-actions, .template)",
|
515 |
+
handle: ".drag-attribute",
|
516 |
+
}).disableSelection();
|
517 |
+
|
518 |
});})(jQuery);
|
views/admin/import/confirm.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<ul style="padding-left: 35px;">
|
2 |
+
<?php if ( $post['is_update_status']): ?>
|
3 |
+
<li> <?php _e('Order status', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
4 |
+
<?php endif; ?>
|
5 |
+
<?php if ( $post['is_update_excerpt']): ?>
|
6 |
+
<li> <?php _e('Customer Note', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
7 |
+
<?php endif; ?>
|
8 |
+
<?php if ( $post['is_update_dates']): ?>
|
9 |
+
<li> <?php _e('Dates', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
10 |
+
<?php endif; ?>
|
11 |
+
<?php if ( $post['is_update_billing_details']): ?>
|
12 |
+
<li> <?php _e('Billing Details', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
13 |
+
<?php endif; ?>
|
14 |
+
<?php if ( $post['is_update_shipping_details']): ?>
|
15 |
+
<li> <?php _e('Shipping Details', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
16 |
+
<?php endif; ?>
|
17 |
+
<?php if ( $post['is_update_payment']): ?>
|
18 |
+
<li> <?php _e('Payment Details', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
19 |
+
<?php endif; ?>
|
20 |
+
<?php if ( $post['is_update_notes']): ?>
|
21 |
+
<li> <?php _e('Order Notes', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
22 |
+
<?php endif; ?>
|
23 |
+
<?php if ( $post['is_update_products']): ?>
|
24 |
+
<li>
|
25 |
+
<?php
|
26 |
+
switch($post['update_products_logic']){
|
27 |
+
case 'full_update':
|
28 |
+
_e('Update all products', PMWI_Plugin::TEXT_DOMAIN);
|
29 |
+
break;
|
30 |
+
case 'add_new':
|
31 |
+
_e('Don\'t touch existing products, append new products', PMWI_Plugin::TEXT_DOMAIN);
|
32 |
+
break;
|
33 |
+
} ?>
|
34 |
+
</li>
|
35 |
+
<?php endif; ?>
|
36 |
+
<?php if ( $post['is_update_fees']): ?>
|
37 |
+
<li> <?php _e('Fees Items', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
38 |
+
<?php endif; ?>
|
39 |
+
<?php if ( $post['is_update_coupons']): ?>
|
40 |
+
<li> <?php _e('Coupon Items', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
41 |
+
<?php endif; ?>
|
42 |
+
<?php if ( $post['is_update_shipping']): ?>
|
43 |
+
<li> <?php _e('Shipping Items', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
44 |
+
<?php endif; ?>
|
45 |
+
<?php if ( $post['is_update_taxes']): ?>
|
46 |
+
<li> <?php _e('Tax Items', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
47 |
+
<?php endif; ?>
|
48 |
+
<?php if ( $post['is_update_refunds']): ?>
|
49 |
+
<li> <?php _e('Refunds', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
50 |
+
<?php endif; ?>
|
51 |
+
<?php if ( $post['is_update_total']): ?>
|
52 |
+
<li> <?php _e('Order Total', PMWI_Plugin::TEXT_DOMAIN); ?></li>
|
53 |
+
<?php endif; ?>
|
54 |
+
<?php if ( ! empty($post['is_update_acf'])): ?>
|
55 |
+
<li>
|
56 |
+
<?php
|
57 |
+
switch($post['update_acf_logic']){
|
58 |
+
case 'full_update':
|
59 |
+
_e('All advanced custom fields', PMWI_Plugin::TEXT_DOMAIN);
|
60 |
+
break;
|
61 |
+
case 'mapped':
|
62 |
+
_e('Only ACF presented in import options', PMWI_Plugin::TEXT_DOMAIN);
|
63 |
+
break;
|
64 |
+
case 'only':
|
65 |
+
printf(__('Only these ACF : %s', PMWI_Plugin::TEXT_DOMAIN), $post['acf_only_list']);
|
66 |
+
break;
|
67 |
+
case 'all_except':
|
68 |
+
printf(__('All ACF except these: %s', PMWI_Plugin::TEXT_DOMAIN), $post['acf_except_list']);
|
69 |
+
break;
|
70 |
+
} ?>
|
71 |
+
</li>
|
72 |
+
<?php endif; ?>
|
73 |
+
<?php if ( ! empty($post['is_update_custom_fields'])): ?>
|
74 |
+
<li>
|
75 |
+
<?php
|
76 |
+
switch($post['update_custom_fields_logic']){
|
77 |
+
case 'full_update':
|
78 |
+
_e('All custom fields', PMWI_Plugin::TEXT_DOMAIN);
|
79 |
+
break;
|
80 |
+
case 'only':
|
81 |
+
printf(__('Only these custom fields : %s', PMWI_Plugin::TEXT_DOMAIN), $post['custom_fields_only_list']);
|
82 |
+
break;
|
83 |
+
case 'all_except':
|
84 |
+
printf(__('All custom fields except these: %s', PMWI_Plugin::TEXT_DOMAIN), $post['custom_fields_except_list']);
|
85 |
+
break;
|
86 |
+
} ?>
|
87 |
+
</li>
|
88 |
+
<?php endif; ?>
|
89 |
+
</ul>
|
views/admin/import/options.php
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
<?php include('options/_reimport_template.php'); ?>
|
views/admin/import/options/_reimport_options.php
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php if ( ! $isWizard or ! empty(PMXI_Plugin::$session->deligate) and PMXI_Plugin::$session->deligate == 'wpallexport' or $isWizard and "new" != $post['wizard_type']): ?>
|
2 |
+
<h4><?php _e('When WP All Import finds new or changed data...', PMWI_Plugin::TEXT_DOMAIN); ?></h4>
|
3 |
+
<?php else: ?>
|
4 |
+
<h4><?php _e('If this import is run again and WP All Import finds new or changed data...', PMWI_Plugin::TEXT_DOMAIN); ?></h4>
|
5 |
+
<?php endif; ?>
|
6 |
+
<div class="input">
|
7 |
+
<input type="hidden" name="create_new_records" value="0" />
|
8 |
+
<input type="checkbox" id="create_new_records" name="create_new_records" value="1" <?php echo $post['create_new_records'] ? 'checked="checked"' : '' ?> />
|
9 |
+
<label for="create_new_records"><?php _e('Create new orders from records newly present in your file', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
10 |
+
<?php if ( ! empty(PMXI_Plugin::$session->deligate) and PMXI_Plugin::$session->deligate == 'wpallexport' ): ?>
|
11 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('New orders will only be created when ID column is present and value in ID column is unique.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="top: -1px;">?</a>
|
12 |
+
<?php endif; ?>
|
13 |
+
</div>
|
14 |
+
<div class="switcher-target-auto_matching">
|
15 |
+
<div class="input">
|
16 |
+
<input type="hidden" name="is_delete_missing" value="0" />
|
17 |
+
<input type="checkbox" id="is_delete_missing" name="is_delete_missing" value="1" <?php echo $post['is_delete_missing'] ? 'checked="checked"': '' ?> class="switcher" <?php if ( "new" != $post['wizard_type']): ?>disabled="disabled"<?php endif; ?>/>
|
18 |
+
<label for="is_delete_missing" <?php if ( "new" != $post['wizard_type']): ?>style="color:#ccc;"<?php endif; ?>><?php _e('Delete orders that are no longer present in your file', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
19 |
+
<?php if ( "new" != $post['wizard_type']): ?>
|
20 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Records removed from the import file can only be deleted when importing into New Items. This feature cannot be enabled when importing into Existing Items.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top: -1px;">?</a>
|
21 |
+
<?php endif; ?>
|
22 |
+
</div>
|
23 |
+
<div class="switcher-target-is_delete_missing" style="padding-left:17px;">
|
24 |
+
<div class="input">
|
25 |
+
<input type="hidden" name="is_keep_attachments" value="0" />
|
26 |
+
<input type="checkbox" id="is_keep_attachments" name="is_keep_attachments" value="1" <?php echo $post['is_keep_attachments'] ? 'checked="checked"': '' ?> <?php if ( "new" != $post['wizard_type']): ?>disabled="disabled"<?php endif; ?>/>
|
27 |
+
<label for="is_keep_attachments"><?php _e('Do not remove attachments', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
28 |
+
</div>
|
29 |
+
<div class="input">
|
30 |
+
<input type="hidden" name="is_keep_imgs" value="0" />
|
31 |
+
<input type="checkbox" id="is_keep_imgs" name="is_keep_imgs" value="1" <?php echo $post['is_keep_imgs'] ? 'checked="checked"': '' ?> <?php if ( "new" != $post['wizard_type']): ?>disabled="disabled"<?php endif; ?>/>
|
32 |
+
<label for="is_keep_imgs"><?php _e('Do not remove images', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
33 |
+
</div>
|
34 |
+
<div class="input">
|
35 |
+
<input type="hidden" name="is_update_missing_cf" value="0" />
|
36 |
+
<input type="checkbox" id="is_update_missing_cf" name="is_update_missing_cf" value="1" <?php echo $post['is_update_missing_cf'] ? 'checked="checked"': '' ?> class="switcher" <?php if ( "new" != $post['wizard_type']): ?>disabled="disabled"<?php endif; ?>/>
|
37 |
+
<label for="is_update_missing_cf"><?php _e('Instead of deletion, set Custom Field', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
38 |
+
<div class="switcher-target-is_update_missing_cf" style="padding-left:17px;">
|
39 |
+
<div class="input">
|
40 |
+
<?php _e('Name', PMWI_Plugin::TEXT_DOMAIN) ?>
|
41 |
+
<input type="text" name="update_missing_cf_name" value="<?php echo esc_attr($post['update_missing_cf_name']) ?>" />
|
42 |
+
<?php _e('Value', PMWI_Plugin::TEXT_DOMAIN) ?>
|
43 |
+
<input type="text" name="update_missing_cf_value" value="<?php echo esc_attr($post['update_missing_cf_value']) ?>" />
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
<div class="input">
|
48 |
+
<input type="hidden" name="set_missing_to_draft" value="0" />
|
49 |
+
<input type="checkbox" id="set_missing_to_draft" name="set_missing_to_draft" value="1" <?php echo $post['set_missing_to_draft'] ? 'checked="checked"': '' ?> <?php if ( "new" != $post['wizard_type']): ?>disabled="disabled"<?php endif; ?>/>
|
50 |
+
<label for="set_missing_to_draft"><?php _e('Instead of deletion, change post status to Draft', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
51 |
+
</div>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
<div class="input">
|
55 |
+
<input type="hidden" id="is_keep_former_posts" name="is_keep_former_posts" value="yes" />
|
56 |
+
<input type="checkbox" id="is_not_keep_former_posts" name="is_keep_former_posts" value="no" <?php echo "yes" != $post['is_keep_former_posts'] ? 'checked="checked"': '' ?> class="switcher" />
|
57 |
+
<label for="is_not_keep_former_posts"><?php _e('Update existing orders with changed data in your file', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
58 |
+
<?php if ( $isWizard and "new" == $post['wizard_type'] and empty(PMXI_Plugin::$session->deligate)): ?>
|
59 |
+
<a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('These options will only be used if you run this import again later. All data is imported the first time you run an import.<br/><br/>Note that WP All Import will only update/remove posts created by this import. If you want to match to posts that already exist on this site, use Existing Items in Step 1.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
60 |
+
<?php endif; ?>
|
61 |
+
<div class="switcher-target-is_not_keep_former_posts" style="padding-left:17px;">
|
62 |
+
<input type="radio" id="update_all_data" class="switcher" name="update_all_data" value="yes" <?php echo 'no' != $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
63 |
+
<label for="update_all_data"><?php _e('Update all data', PMWI_Plugin::TEXT_DOMAIN )?></label><br>
|
64 |
+
|
65 |
+
<input type="radio" id="update_choosen_data" class="switcher" name="update_all_data" value="no" <?php echo 'no' == $post['update_all_data'] ? 'checked="checked"': '' ?>/>
|
66 |
+
<label for="update_choosen_data"><?php _e('Choose which data to update', PMWI_Plugin::TEXT_DOMAIN )?></label><br>
|
67 |
+
<div class="switcher-target-update_choosen_data" style="padding-left:27px;">
|
68 |
+
<div class="input">
|
69 |
+
<h4 class="wpallimport-trigger-options wpallimport-select-all" rel="<?php _e("Unselect All", PMWI_Plugin::TEXT_DOMAIN); ?>"><?php _e("Select All", PMWI_Plugin::TEXT_DOMAIN); ?></h4>
|
70 |
+
</div>
|
71 |
+
<div class="input">
|
72 |
+
<input type="hidden" name="is_update_status" value="0" />
|
73 |
+
<input type="checkbox" id="is_update_status" name="is_update_status" value="1" <?php echo $post['is_update_status'] ? 'checked="checked"': '' ?> />
|
74 |
+
<label for="is_update_status"><?php _e('Order status', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
75 |
+
<a href="#help" class="wpallimport-help" style="position: relative; top: -2px;" title="<?php _e('Hint: uncheck this box to keep trashed orders in the trash.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
76 |
+
</div>
|
77 |
+
<div class="input">
|
78 |
+
<input type="hidden" name="is_update_excerpt" value="0" />
|
79 |
+
<input type="checkbox" id="is_update_excerpt" name="is_update_excerpt" value="1" <?php echo $post['is_update_excerpt'] ? 'checked="checked"': '' ?> />
|
80 |
+
<label for="is_update_excerpt"><?php _e('Customer Note', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
81 |
+
</div>
|
82 |
+
<div class="input">
|
83 |
+
<input type="hidden" name="is_update_dates" value="0" />
|
84 |
+
<input type="checkbox" id="is_update_dates" name="is_update_dates" value="1" <?php echo $post['is_update_dates'] ? 'checked="checked"': '' ?> />
|
85 |
+
<label for="is_update_dates"><?php _e('Dates', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
86 |
+
</div>
|
87 |
+
<div class="input">
|
88 |
+
<input type="hidden" name="is_update_billing_details" value="0" />
|
89 |
+
<input type="checkbox" id="is_update_billing_details" name="is_update_billing_details" value="1" <?php echo $post['is_update_billing_details'] ? 'checked="checked"': '' ?> class="switcher"/>
|
90 |
+
<label for="is_update_billing_details"><?php _e('Billing Details', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
91 |
+
</div>
|
92 |
+
<div class="input">
|
93 |
+
<input type="hidden" name="is_update_shipping_details" value="0" />
|
94 |
+
<input type="checkbox" id="is_update_shipping_details" name="is_update_shipping_details" value="1" <?php echo $post['is_update_shipping_details'] ? 'checked="checked"': '' ?> class="switcher"/>
|
95 |
+
<label for="is_update_shipping_details"><?php _e('Shipping Details', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
96 |
+
</div>
|
97 |
+
<div class="input">
|
98 |
+
<input type="hidden" name="is_update_payment" value="0" />
|
99 |
+
<input type="checkbox" id="is_update_payment" name="is_update_payment" value="1" <?php echo $post['is_update_payment'] ? 'checked="checked"': '' ?> class="switcher"/>
|
100 |
+
<label for="is_update_payment"><?php _e('Payment Details', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
101 |
+
</div>
|
102 |
+
<div class="input">
|
103 |
+
<input type="hidden" name="is_update_notes" value="0" />
|
104 |
+
<input type="checkbox" id="is_update_notes" name="is_update_notes" value="1" <?php echo $post['is_update_notes'] ? 'checked="checked"': '' ?> class="switcher"/>
|
105 |
+
<label for="is_update_notes"><?php _e('Order Notes', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
106 |
+
</div>
|
107 |
+
<div class="input">
|
108 |
+
<input type="hidden" name="is_update_products" value="0" />
|
109 |
+
<input type="checkbox" id="is_update_products" name="is_update_products" value="1" <?php echo $post['is_update_products'] ? 'checked="checked"': '' ?> class="switcher"/>
|
110 |
+
<label for="is_update_products"><?php _e('Product Items', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
111 |
+
<div class="switcher-target-is_update_products" style="padding-left:17px;">
|
112 |
+
<div class="input" style="margin-bottom:3px;">
|
113 |
+
<input type="radio" id="update_products_logic_full_update" name="update_products_logic" value="full_update" <?php echo ( "full_update" == $post['update_products_logic'] ) ? 'checked="checked"': '' ?> />
|
114 |
+
<label for="update_products_logic_full_update"><?php _e('Update all products', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
115 |
+
</div>
|
116 |
+
<div class="input" style="margin-bottom:3px;">
|
117 |
+
<input type="radio" id="update_products_logic_add_new" name="update_products_logic" value="add_new" <?php echo ( "add_new" == $post['update_products_logic'] ) ? 'checked="checked"': '' ?> />
|
118 |
+
<label for="update_products_logic_add_new"><?php _e('Don\'t touch existing products, append new products', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
<div class="input">
|
123 |
+
<input type="hidden" name="is_update_fees" value="0" />
|
124 |
+
<input type="checkbox" id="is_update_fees" name="is_update_fees" value="1" <?php echo $post['is_update_fees'] ? 'checked="checked"': '' ?> class="switcher"/>
|
125 |
+
<label for="is_update_fees"><?php _e('Fees Items', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
126 |
+
</div>
|
127 |
+
<div class="input">
|
128 |
+
<input type="hidden" name="is_update_coupons" value="0" />
|
129 |
+
<input type="checkbox" id="is_update_coupons" name="is_update_coupons" value="1" <?php echo $post['is_update_coupons'] ? 'checked="checked"': '' ?> class="switcher"/>
|
130 |
+
<label for="is_update_coupons"><?php _e('Coupon Items', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
131 |
+
</div>
|
132 |
+
<div class="input">
|
133 |
+
<input type="hidden" name="is_update_shipping" value="0" />
|
134 |
+
<input type="checkbox" id="is_update_shipping" name="is_update_shipping" value="1" <?php echo $post['is_update_shipping'] ? 'checked="checked"': '' ?> class="switcher"/>
|
135 |
+
<label for="is_update_shipping"><?php _e('Shipping Items', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
136 |
+
</div>
|
137 |
+
<div class="input">
|
138 |
+
<input type="hidden" name="is_update_taxes" value="0" />
|
139 |
+
<input type="checkbox" id="is_update_taxes" name="is_update_taxes" value="1" <?php echo $post['is_update_taxes'] ? 'checked="checked"': '' ?> class="switcher"/>
|
140 |
+
<label for="is_update_taxes"><?php _e('Tax Items', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
141 |
+
</div>
|
142 |
+
<div class="input">
|
143 |
+
<input type="hidden" name="is_update_refunds" value="0" />
|
144 |
+
<input type="checkbox" id="is_update_refunds" name="is_update_refunds" value="1" <?php echo $post['is_update_refunds'] ? 'checked="checked"': '' ?> class="switcher"/>
|
145 |
+
<label for="is_update_refunds"><?php _e('Refunds', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
146 |
+
</div>
|
147 |
+
<div class="input">
|
148 |
+
<input type="hidden" name="is_update_total" value="0" />
|
149 |
+
<input type="checkbox" id="is_update_total" name="is_update_total" value="1" <?php echo $post['is_update_total'] ? 'checked="checked"': '' ?> class="switcher"/>
|
150 |
+
<label for="is_update_total"><?php _e('Order Total', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
151 |
+
</div>
|
152 |
+
<!-- Do not update order custom fields -->
|
153 |
+
<!-- <input type="hidden" name="is_update_custom_fields" value="0" /> -->
|
154 |
+
|
155 |
+
<div class="input">
|
156 |
+
<input type="hidden" name="custom_fields_list" value="0" />
|
157 |
+
<input type="hidden" name="is_update_custom_fields" value="0" />
|
158 |
+
<input type="checkbox" id="is_update_custom_fields" name="is_update_custom_fields" value="1" <?php echo $post['is_update_custom_fields'] ? 'checked="checked"': '' ?> class="switcher"/>
|
159 |
+
<label for="is_update_custom_fields"><?php _e('Custom Fields', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
160 |
+
<!--a href="#help" class="wpallimport-help" title="<?php _e('If Keep Custom Fields box is checked, it will keep all Custom Fields, and add any new Custom Fields specified in Custom Fields section, as long as they do not overwrite existing fields. If \'Only keep this Custom Fields\' is specified, it will only keep the specified fields.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a-->
|
161 |
+
<div class="switcher-target-is_update_custom_fields" style="padding-left:17px;">
|
162 |
+
<div class="input">
|
163 |
+
<input type="radio" id="update_custom_fields_logic_full_update" name="update_custom_fields_logic" value="full_update" <?php echo ( "full_update" == $post['update_custom_fields_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
164 |
+
<label for="update_custom_fields_logic_full_update"><?php _e('Update all Custom Fields', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
165 |
+
</div>
|
166 |
+
<div class="input">
|
167 |
+
<input type="radio" id="update_custom_fields_logic_only" name="update_custom_fields_logic" value="only" <?php echo ( "only" == $post['update_custom_fields_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
168 |
+
<label for="update_custom_fields_logic_only"><?php _e('Update only these Custom Fields, leave the rest alone', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
169 |
+
<div class="switcher-target-update_custom_fields_logic_only pmxi_choosen" style="padding-left:17px;">
|
170 |
+
<span class="hidden choosen_values"><?php if (!empty($existing_meta_keys)) echo esc_html(implode(',', $existing_meta_keys));?></span>
|
171 |
+
<input class="choosen_input" value="<?php if (!empty($post['custom_fields_list']) and "only" == $post['update_custom_fields_logic']) echo esc_html(implode(',', $post['custom_fields_list'])); ?>" type="hidden" name="custom_fields_only_list"/>
|
172 |
+
</div>
|
173 |
+
</div>
|
174 |
+
<div class="input">
|
175 |
+
<input type="radio" id="update_custom_fields_logic_all_except" name="update_custom_fields_logic" value="all_except" <?php echo ( "all_except" == $post['update_custom_fields_logic'] ) ? 'checked="checked"': '' ?> class="switcher"/>
|
176 |
+
<label for="update_custom_fields_logic_all_except"><?php _e('Leave these fields alone, update all other Custom Fields', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
177 |
+
<div class="switcher-target-update_custom_fields_logic_all_except pmxi_choosen" style="padding-left:17px;">
|
178 |
+
<span class="hidden choosen_values"><?php if (!empty($existing_meta_keys)) echo esc_html(implode(',', $existing_meta_keys));?></span>
|
179 |
+
<input class="choosen_input" value="<?php if (!empty($post['custom_fields_list']) and "all_except" == $post['update_custom_fields_logic']) echo esc_html(implode(',', $post['custom_fields_list'])); ?>" type="hidden" name="custom_fields_except_list"/>
|
180 |
+
</div>
|
181 |
+
</div>
|
182 |
+
</div>
|
183 |
+
</div>
|
184 |
+
<?php
|
185 |
+
|
186 |
+
// add-ons re-import options
|
187 |
+
do_action('pmxi_reimport', $post_type, $post);
|
188 |
+
|
189 |
+
?>
|
190 |
+
</div>
|
191 |
+
</div>
|
192 |
+
</div>
|
views/admin/import/options/_reimport_template.php
ADDED
@@ -0,0 +1,147 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php $custom_type = get_post_type_object( $post['custom_type'] ); ?>
|
2 |
+
<div class="wpallimport-collapsed wpallimport-section">
|
3 |
+
<script type="text/javascript">
|
4 |
+
__META_KEYS = <?php echo json_encode($existing_meta_keys) ?>;
|
5 |
+
</script>
|
6 |
+
<div class="wpallimport-content-section">
|
7 |
+
<div class="wpallimport-collapsed-header">
|
8 |
+
<?php
|
9 |
+
if ( "new" == $post['wizard_type']):
|
10 |
+
|
11 |
+
if ( ! $isWizard )
|
12 |
+
{
|
13 |
+
?>
|
14 |
+
<h3><?php _e('Record Matching', PMWI_Plugin::TEXT_DOMAIN); ?></h3>
|
15 |
+
<?php
|
16 |
+
}
|
17 |
+
else
|
18 |
+
{
|
19 |
+
if ( ! empty(PMXI_Plugin::$session->deligate) and PMXI_Plugin::$session->deligate == 'wpallexport' )
|
20 |
+
{
|
21 |
+
?>
|
22 |
+
<h3 style="padding-left:0;"><?php _e('Choose how exported data will be re-imported.',PMWI_Plugin::TEXT_DOMAIN);?></h3>
|
23 |
+
<?php
|
24 |
+
}
|
25 |
+
else
|
26 |
+
{
|
27 |
+
?>
|
28 |
+
<h3 style="padding-left:0;"><?php printf(__('WP All Import will create new %s for each unique record in your file.',PMWI_Plugin::TEXT_DOMAIN), $custom_type->labels->name);?></h3>
|
29 |
+
<?php
|
30 |
+
}
|
31 |
+
}
|
32 |
+
|
33 |
+
?>
|
34 |
+
</div>
|
35 |
+
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
36 |
+
<div class="wpallimport-collapsed-content-inner">
|
37 |
+
<table class="form-table" style="max-width:none;">
|
38 |
+
<tr>
|
39 |
+
<td>
|
40 |
+
<input type="hidden" name="duplicate_matching" value="auto"/>
|
41 |
+
<?php if ( ! $isWizard ):?>
|
42 |
+
<h4><?php printf(__('WP All Import will associate records in your file with %s it has already created from previous runs of this import based on the Unique Identifier.',PMWI_Plugin::TEXT_DOMAIN), $custom_type->labels->name);?></h4>
|
43 |
+
<?php endif; ?>
|
44 |
+
<div class="wpallimport-unique-key-wrapper" <?php if (!empty(PMXI_Plugin::$session->deligate)):?>style="display:none;"<?php endif; ?>>
|
45 |
+
<label style="font-weight: bold;"><?php _e("Unique Identifier", "pmxi_plugin"); ?></label>
|
46 |
+
|
47 |
+
<input type="text" class="smaller-text" name="unique_key" style="width:300px;" value="<?php if ( ! $isWizard ) echo esc_attr($post['unique_key']); elseif ($post['tmp_unique_key']) echo esc_attr($post['unique_key']); ?>" <?php echo ( ! $isWizard and ! empty($post['unique_key']) ) ? 'disabled="disabled"' : '' ?>/>
|
48 |
+
|
49 |
+
<?php if ( $isWizard ): ?>
|
50 |
+
<input type="hidden" name="tmp_unique_key" value="<?php echo ($post['unique_key']) ? esc_attr($post['unique_key']) : esc_attr($post['tmp_unique_key']); ?>"/>
|
51 |
+
<a href="javascript:void(0);" class="wpallimport-auto-detect-unique-key"><?php _e('Auto-detect', PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
52 |
+
<?php else: ?>
|
53 |
+
<?php if ( ! empty($post['unique_key']) ): ?>
|
54 |
+
<a href="javascript:void(0);" class="wpallimport-change-unique-key"><?php _e('Edit', PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
55 |
+
<div id="dialog-confirm" title="<?php _e('Warning: Are you sure you want to edit the Unique Identifier?',PMWI_Plugin::TEXT_DOMAIN);?>" style="display:none;">
|
56 |
+
<p><?php printf(__('It is recommended you delete all %s associated with this import before editing the unique identifier.', PMWI_Plugin::TEXT_DOMAIN), strtolower($custom_type->labels->name)); ?></p>
|
57 |
+
<p><?php printf(__('Editing the unique identifier will dissociate all existing %s linked to this import. Future runs of the import will result in duplicates, as WP All Import will no longer be able to update these %s.', PMWI_Plugin::TEXT_DOMAIN), strtolower($custom_type->labels->name), strtolower($custom_type->labels->name)); ?></p>
|
58 |
+
<p><?php _e('You really should just re-create your import, and pick the right unique identifier to start with.', PMWI_Plugin::TEXT_DOMAIN); ?></p>
|
59 |
+
</div>
|
60 |
+
<?php else:?>
|
61 |
+
<input type="hidden" name="tmp_unique_key" value="<?php echo ($post['unique_key']) ? esc_attr($post['unique_key']) : esc_attr($post['tmp_unique_key']); ?>"/>
|
62 |
+
<a href="javascript:void(0);" class="wpallimport-auto-detect-unique-key"><?php _e('Auto-detect', PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
63 |
+
<?php endif; ?>
|
64 |
+
<?php endif; ?>
|
65 |
+
|
66 |
+
<p> </p>
|
67 |
+
<?php if ( $isWizard ):?>
|
68 |
+
<p class="drag_an_element_ico"><?php _e('Drag an element, or combo of elements, to the box above. The Unique Identifier should be unique for each record in your file, and should stay the same even if your file is updated. Things like product IDs, titles, and SKUs are good Unique Identifiers because they probably won\'t change. Don\'t use a description or price, since that might be changed.', PMWI_Plugin::TEXT_DOMAIN); ?></p>
|
69 |
+
<p class="info_ico"><?php printf(__('If you run this import again with an updated file, the Unique Identifier allows WP All Import to correctly link the records in your updated file with the %s it will create right now. If multiple records in this file have the same Unique Identifier, only the first will be created. The others will be detected as duplicates.', PMWI_Plugin::TEXT_DOMAIN), $custom_type->labels->name); ?></p>
|
70 |
+
<?php endif; ?>
|
71 |
+
</div>
|
72 |
+
|
73 |
+
<?php include( '_reimport_options.php' ); ?>
|
74 |
+
|
75 |
+
</td>
|
76 |
+
</tr>
|
77 |
+
</table>
|
78 |
+
</div>
|
79 |
+
</div>
|
80 |
+
<?php else: ?>
|
81 |
+
<?php if ( ! $isWizard ):?>
|
82 |
+
<h3><?php _e('Record Matching', PMWI_Plugin::TEXT_DOMAIN); ?></h3>
|
83 |
+
<?php else: ?>
|
84 |
+
<h3 style="padding-left:0;"><?php printf(__('WP All Import will merge data into existing %s.',PMWI_Plugin::TEXT_DOMAIN), $custom_type->labels->name);?></h3>
|
85 |
+
<?php endif; ?>
|
86 |
+
</div>
|
87 |
+
<div class="wpallimport-collapsed-content" style="padding:0;">
|
88 |
+
<div class="wpallimport-collapsed-content-inner">
|
89 |
+
<table class="form-table" style="max-width:none;">
|
90 |
+
<tr>
|
91 |
+
<td>
|
92 |
+
<div class="input" style="margin-bottom:15px; position:relative;">
|
93 |
+
<input type="hidden" name="duplicate_matching" value="manual"/>
|
94 |
+
<h4><?php printf(__('Records in your file will be matched with %ss on your site based on...', PMWI_Plugin::TEXT_DOMAIN ), $custom_type->labels->singular_name);?></h4>
|
95 |
+
<div style="margin-left: -4px;">
|
96 |
+
<div class="input">
|
97 |
+
|
98 |
+
<input type="radio" id="duplicate_indicator_title" class="switcher" name="duplicate_indicator" value="title" <?php echo 'title' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
99 |
+
<label for="duplicate_indicator_title"><?php _e('Title', PMWI_Plugin::TEXT_DOMAIN )?></label><br>
|
100 |
+
<input type="radio" id="duplicate_indicator_content" class="switcher" name="duplicate_indicator" value="content" <?php echo 'content' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
101 |
+
<label for="duplicate_indicator_content"><?php _e('Content', PMWI_Plugin::TEXT_DOMAIN )?></label><br>
|
102 |
+
<div class="input">
|
103 |
+
<input type="radio" id="duplicate_indicator_custom_field" class="switcher" name="duplicate_indicator" value="custom field" <?php echo 'custom field' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
104 |
+
<label for="duplicate_indicator_custom_field"><?php _e('Custom field', PMWI_Plugin::TEXT_DOMAIN )?></label><br>
|
105 |
+
<span class="switcher-target-duplicate_indicator_custom_field" style="vertical-align:middle; padding-left:17px;">
|
106 |
+
<?php _e('Name', PMWI_Plugin::TEXT_DOMAIN) ?>
|
107 |
+
<input type="text" name="custom_duplicate_name" value="<?php echo esc_attr($post['custom_duplicate_name']) ?>" />
|
108 |
+
<?php _e('Value', PMWI_Plugin::TEXT_DOMAIN) ?>
|
109 |
+
<input type="text" name="custom_duplicate_value" value="<?php echo esc_attr($post['custom_duplicate_value']) ?>" />
|
110 |
+
</span>
|
111 |
+
</div>
|
112 |
+
<div class="input">
|
113 |
+
<input type="radio" id="duplicate_indicator_pid" class="switcher" name="duplicate_indicator" value="pid" <?php echo 'pid' == $post['duplicate_indicator'] ? 'checked="checked"': '' ?>/>
|
114 |
+
<label for="duplicate_indicator_pid"><?php _e('Order ID', PMWI_Plugin::TEXT_DOMAIN )?></label><br>
|
115 |
+
<span class="switcher-target-duplicate_indicator_pid" style="vertical-align:middle; padding-left:17px;">
|
116 |
+
<input type="text" name="pid_xpath" value="<?php echo esc_attr($post['pid_xpath']) ?>" />
|
117 |
+
</span>
|
118 |
+
</div>
|
119 |
+
</div>
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
<?php include( '_reimport_options.php' ); ?>
|
123 |
+
</td>
|
124 |
+
</tr>
|
125 |
+
</table>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
<?php endif; ?>
|
129 |
+
</div>
|
130 |
+
</div>
|
131 |
+
<div class="wpallimport-collapsed wpallimport-section">
|
132 |
+
<div class="wpallimport-content-section">
|
133 |
+
<div class="wpallimport-collapsed-header">
|
134 |
+
<h3><?php _e('Email Notifications for Customers', PMWI_Plugin::TEXT_DOMAIN); ?></h3>
|
135 |
+
</div>
|
136 |
+
<div class="wpallimport-collapsed-content" style="padding: 0;">
|
137 |
+
<div class="wpallimport-collapsed-content-inner">
|
138 |
+
<div class="input">
|
139 |
+
<input type="hidden" name="do_not_send_order_notifications" value="0" />
|
140 |
+
<input type="checkbox" id="do_not_send_order_notifications" name="do_not_send_order_notifications" value="1" <?php echo empty($post['do_not_send_order_notifications']) ? '': 'checked="checked"' ?> class="switcher"/>
|
141 |
+
<label for="do_not_send_order_notifications"><?php _e('Block email notifications during import', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
142 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If enabled, WP All Import will prevent WordPress from sending notification emails to customers when their orders are imported or updated.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top: 0;">?</a>
|
143 |
+
</div>
|
144 |
+
</div>
|
145 |
+
</div>
|
146 |
+
</div>
|
147 |
+
</div>
|
views/admin/import/product/_tabs/_advanced.php
ADDED
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="advanced_product_data" style="display:none;">
|
2 |
+
<?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
|
3 |
+
<div class="woo-add-on-free-edition-notice upgrade_template">
|
4 |
+
<a href="https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=upgrade-notice&utm_campaign=import-variable-wooco-products" target="_blank" class="upgrade_woo_link"><?php _e('Upgrade to the Pro edition of WP All Import and the WooCommerce Add-On to import to Variable, Affiliate, and Grouped Products', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
5 |
+
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
6 |
+
</div>
|
7 |
+
<?php endif; ?>
|
8 |
+
<div class="options_group hide_if_external">
|
9 |
+
<p class="form-field">
|
10 |
+
<label><?php _e("Purchase Note", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
11 |
+
<input type="text" class="short" placeholder="" name="single_product_purchase_note" style="" value="<?php echo esc_attr($post['single_product_purchase_note']) ?>"/>
|
12 |
+
</p>
|
13 |
+
</div>
|
14 |
+
<div class="options_group">
|
15 |
+
<p class="form-field">
|
16 |
+
<label><?php _e("Menu order", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
17 |
+
<input type="text" class="short" placeholder="" name="single_product_menu_order" value="<?php echo esc_attr($post['single_product_menu_order']) ?>"/>
|
18 |
+
</p>
|
19 |
+
</div>
|
20 |
+
|
21 |
+
<div class="options_group reviews">
|
22 |
+
|
23 |
+
<p class="form-field"><?php _e('Enable reviews',PMWI_Plugin::TEXT_DOMAIN);?></p>
|
24 |
+
|
25 |
+
<p class="form-field wpallimport-radio-field">
|
26 |
+
<input type="radio" id="product_enable_reviews_yes" class="switcher" name="is_product_enable_reviews" value="yes" <?php echo 'yes' == $post['is_product_enable_reviews'] ? 'checked="checked"': '' ?>/>
|
27 |
+
<label for="product_enable_reviews_yes"><?php _e("Yes"); ?></label>
|
28 |
+
</p>
|
29 |
+
<p class="form-field wpallimport-radio-field">
|
30 |
+
<input type="radio" id="product_enable_reviews_no" class="switcher" name="is_product_enable_reviews" value="no" <?php echo 'no' == $post['is_product_enable_reviews'] ? 'checked="checked"': '' ?>/>
|
31 |
+
<label for="product_enable_reviews_no"><?php _e("No"); ?></label>
|
32 |
+
</p>
|
33 |
+
<div class="form-field wpallimport-radio-field">
|
34 |
+
<input type="radio" id="product_enable_reviews_xpath" class="switcher" name="is_product_enable_reviews" value="xpath" <?php echo 'xpath' == $post['is_product_enable_reviews'] ? 'checked="checked"': '' ?>/>
|
35 |
+
<label for="product_enable_reviews_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
36 |
+
<span class="wpallimport-clear"></span>
|
37 |
+
<div class="switcher-target-product_enable_reviews_xpath set_with_xpath">
|
38 |
+
<span class="wpallimport-slide-content" style="padding-left:0px;">
|
39 |
+
<input type="text" class="smaller-text" name="single_product_enable_reviews" style="width:300px;" value="<?php echo esc_attr($post['single_product_enable_reviews']) ?>"/>
|
40 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
41 |
+
</span>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
|
45 |
+
</div> <!-- End options group -->
|
46 |
+
|
47 |
+
<div class="options_group">
|
48 |
+
|
49 |
+
<p class="form-field"><?php _e('Featured',PMWI_Plugin::TEXT_DOMAIN);?></p>
|
50 |
+
|
51 |
+
<p class="form-field wpallimport-radio-field">
|
52 |
+
<input type="radio" id="product_featured_yes" class="switcher" name="is_product_featured" value="yes" <?php echo 'yes' == $post['is_product_featured'] ? 'checked="checked"': '' ?>/>
|
53 |
+
<label for="product_featured_yes"><?php _e("Yes"); ?></label>
|
54 |
+
</p>
|
55 |
+
<p class="form-field wpallimport-radio-field">
|
56 |
+
<input type="radio" id="product_featured_no" class="switcher" name="is_product_featured" value="no" <?php echo 'no' == $post['is_product_featured'] ? 'checked="checked"': '' ?>/>
|
57 |
+
<label for="product_featured_no"><?php _e("No"); ?></label>
|
58 |
+
</p>
|
59 |
+
<div class="form-field wpallimport-radio-field">
|
60 |
+
<input type="radio" id="product_featured_xpath" class="switcher" name="is_product_featured" value="xpath" <?php echo 'xpath' == $post['is_product_featured'] ? 'checked="checked"': '' ?>/>
|
61 |
+
<label for="product_featured_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
62 |
+
<span class="wpallimport-clear"></span>
|
63 |
+
<div class="switcher-target-product_featured_xpath set_with_xpath">
|
64 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
65 |
+
<input type="text" class="smaller-text" name="single_product_featured" style="width:300px;" value="<?php echo esc_attr($post['single_product_featured']) ?>"/>
|
66 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
67 |
+
</span>
|
68 |
+
</div>
|
69 |
+
</div>
|
70 |
+
|
71 |
+
</div> <!-- End options group -->
|
72 |
+
|
73 |
+
<div class="options_group">
|
74 |
+
|
75 |
+
<p class="form-field"><?php _e('Catalog visibility',PMWI_Plugin::TEXT_DOMAIN);?></p>
|
76 |
+
|
77 |
+
<?php if (function_exists('wc_get_product_visibility_options')): ?>
|
78 |
+
<?php $visibility_options = wc_get_product_visibility_options();?>
|
79 |
+
<?php foreach ($visibility_options as $visibility_option_key => $visibility_option_name):?>
|
80 |
+
<p class="form-field wpallimport-radio-field">
|
81 |
+
<input type="radio" id="product_visibility_<?php echo $visibility_option_key;?>" class="switcher" name="is_product_visibility" value="<?php echo $visibility_option_key; ?>" <?php echo $post['is_product_visibility'] == $visibility_option_key ? 'checked="checked"': '' ?>/>
|
82 |
+
<label for="product_visibility_<?php echo $visibility_option_key;?>"><?php echo $visibility_option_name; ?></label>
|
83 |
+
</p>
|
84 |
+
<?php endforeach; ?>
|
85 |
+
<?php else: ?>
|
86 |
+
<p class="form-field wpallimport-radio-field">
|
87 |
+
<input type="radio" id="product_visibility_visible" class="switcher" name="is_product_visibility" value="visible" <?php echo 'visible' == $post['is_product_visibility'] ? 'checked="checked"': '' ?>/>
|
88 |
+
<label for="product_visibility_visible"><?php _e("Catalog/search", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
89 |
+
</p>
|
90 |
+
<p class="form-field wpallimport-radio-field">
|
91 |
+
<input type="radio" id="product_visibility_catalog" class="switcher" name="is_product_visibility" value="catalog" <?php echo 'catalog' == $post['is_product_visibility'] ? 'checked="checked"': '' ?>/>
|
92 |
+
<label for="product_visibility_catalog"><?php _e("Catalog", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
93 |
+
</p>
|
94 |
+
<p class="form-field wpallimport-radio-field">
|
95 |
+
<input type="radio" id="product_visibility_search" class="switcher" name="is_product_visibility" value="search" <?php echo 'search' == $post['is_product_visibility'] ? 'checked="checked"': '' ?>/>
|
96 |
+
<label for="product_visibility_search"><?php _e("Search", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
97 |
+
</p>
|
98 |
+
<p class="form-field wpallimport-radio-field">
|
99 |
+
<input type="radio" id="product_visibility_hidden" class="switcher" name="is_product_visibility" value="hidden" <?php echo 'hidden' == $post['is_product_visibility'] ? 'checked="checked"': '' ?>/>
|
100 |
+
<label for="product_visibility_hidden"><?php _e("Hidden", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
101 |
+
</p>
|
102 |
+
<?php endif; ?>
|
103 |
+
<div class="form-field wpallimport-radio-field">
|
104 |
+
<input type="radio" id="product_visibility_xpath" class="switcher" name="is_product_visibility" value="xpath" <?php echo 'xpath' == $post['is_product_visibility'] ? 'checked="checked"': '' ?>/>
|
105 |
+
<label for="product_visibility_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
106 |
+
<span class="wpallimport-clear"></span>
|
107 |
+
<div class="switcher-target-product_visibility_xpath set_with_xpath">
|
108 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
109 |
+
<input type="text" class="smaller-text" name="single_product_visibility" style="width:300px;" value="<?php echo esc_attr($post['single_product_visibility']) ?>"/>
|
110 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'visible\', \'catalog\', \'search\', \'hidden\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
111 |
+
</span>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
|
115 |
+
</div> <!-- End options group -->
|
116 |
+
</div><!-- End Product Panel -->
|
views/admin/import/product/_tabs/_attributes.php
ADDED
@@ -0,0 +1,432 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="woocommerce_attributes" style="display:none;">
|
2 |
+
<?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
|
3 |
+
<div style="margin-left:-2%;">
|
4 |
+
<div class="woo-add-on-free-edition-notice upgrade_template" style="margin-top:0;">
|
5 |
+
<a href="https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=upgrade-notice&utm_campaign=import-variable-wooco-products" target="_blank" class="upgrade_woo_link"><?php _e('Upgrade to the Pro edition of WP All Import and the WooCommerce Add-On to import to Variable, Affiliate, and Grouped Products', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
6 |
+
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
7 |
+
</div>
|
8 |
+
</div>
|
9 |
+
<?php endif; ?>
|
10 |
+
<div class="input">
|
11 |
+
<table class="form-table custom-params" id="attributes_table" style="max-width:95%;">
|
12 |
+
<thead>
|
13 |
+
<tr>
|
14 |
+
<td><?php _e('Name', PMWI_Plugin::TEXT_DOMAIN); ?></td>
|
15 |
+
<td>
|
16 |
+
<?php _e('Values', PMWI_Plugin::TEXT_DOMAIN); ?>
|
17 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Separate multiple values with a |', PMWI_Plugin::TEXT_DOMAIN) ?>" style="top:-1px;">?</a>
|
18 |
+
</td>
|
19 |
+
<td></td>
|
20 |
+
</tr>
|
21 |
+
</thead>
|
22 |
+
<tbody>
|
23 |
+
<?php if (!empty($post['attribute_name'][0])):?>
|
24 |
+
<?php foreach ($post['attribute_name'] as $i => $name): if ("" == $name) continue; ?>
|
25 |
+
<tr class="form-field">
|
26 |
+
<td style="width: 50%;">
|
27 |
+
<div class="drag-attribute">
|
28 |
+
<input type="text" class="widefat" name="attribute_name[]" value="<?php echo esc_attr($name) ?>" style="width:100%;"/>
|
29 |
+
</div>
|
30 |
+
</td>
|
31 |
+
<td style="width: 50%;">
|
32 |
+
<input type="text" class="widefat" name="attribute_value[]" value="<?php echo str_replace("&","&", htmlentities(htmlentities($post['attribute_value'][$i]))); ?>" style="width:100%;"/>
|
33 |
+
<span class="wpallimport-clear"></span>
|
34 |
+
<div class="form-field wpallimport-radio-field" style="padding: 0 !important; position: relative; left: -100%; width: 200%;">
|
35 |
+
|
36 |
+
<a href="javascript:void(0);" id="advanced_attributes_<?php echo $i; ?>" class="action advanced_attributes"><span>+</span> <?php _e('Advanced', PMWI_Plugin::TEXT_DOMAIN) ?></a>
|
37 |
+
<input type="hidden" value="<?php echo (empty($post['is_advanced'][$i])) ? '0' : $post['is_advanced'][$i];?>" name="is_advanced[]">
|
38 |
+
|
39 |
+
<span class="default_attribute_settings">
|
40 |
+
<span class='in_variations'>
|
41 |
+
<input type="checkbox" name="in_variations[]" id="in_variations_<?php echo $i; ?>" <?php echo ($post['in_variations'][$i]) ? 'checked="checked"' : ''; ?> style="float: left;" value="1"/>
|
42 |
+
<label for="in_variations_<?php echo $i; ?>"><?php _e('In Variations',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
43 |
+
</span>
|
44 |
+
|
45 |
+
<span class='is_visible'>
|
46 |
+
<input type="checkbox" name="is_visible[]" id="is_visible_<?php echo $i; ?>" <?php echo ($post['is_visible'][$i]) ? 'checked="checked"' : ''; ?> style="float: left;" value="1"/>
|
47 |
+
<label for="is_visible_<?php echo $i; ?>"><?php _e('Is Visible',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
48 |
+
</span>
|
49 |
+
|
50 |
+
<span class='is_taxonomy'>
|
51 |
+
<input type="checkbox" name="is_taxonomy[]" id="is_taxonomy_<?php echo $i; ?>" <?php echo ($post['is_taxonomy'][$i]) ? 'checked="checked"' : ''; ?> style="float: left;" value="1" class="switcher"/>
|
52 |
+
<label for="is_taxonomy_<?php echo $i; ?>"><?php _e('Is Taxonomy',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
53 |
+
</span>
|
54 |
+
|
55 |
+
<span class='is_create_taxonomy switcher-target-is_taxonomy_<?php echo $i; ?>'>
|
56 |
+
<input type="checkbox" name="create_taxonomy_in_not_exists[]" id="create_taxonomy_in_not_exists_<?php echo $i; ?>" <?php echo ($post['create_taxonomy_in_not_exists'][$i]) ? 'checked="checked"' : ''; ?> style="float: left;" value="1"/>
|
57 |
+
<label for="create_taxonomy_in_not_exists_<?php echo $i; ?>"><?php _e('Auto-Create Terms',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
58 |
+
</span>
|
59 |
+
</span>
|
60 |
+
|
61 |
+
<div class="advanced_attribute_settings">
|
62 |
+
|
63 |
+
<div class="input" style="display:inline-block;">
|
64 |
+
<div class="input">
|
65 |
+
<input type="radio" id="advanced_in_variations_yes_<?php echo $i; ?>" class="switcher" name="advanced_in_variations[<?php echo $i; ?>]" value="yes" <?php echo ( empty($post['advanced_in_variations'][$i]) or ( ! empty($post['advanced_in_variations'][$i]) and ! in_array($post['advanced_in_variations'][$i], array('no', 'xpath'))) ) ? 'checked="checked"': '' ?>/>
|
66 |
+
<label for="advanced_in_variations_yes_<?php echo $i; ?>"><?php _e("In Variations", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
67 |
+
</div>
|
68 |
+
<div class="input">
|
69 |
+
<input type="radio" id="advanced_in_variations_no_<?php echo $i; ?>" class="switcher" name="advanced_in_variations[<?php echo $i; ?>]" value="no" <?php echo (!empty($post['advanced_in_variations'][$i]) and 'no' == $post['advanced_in_variations'][$i]) ? 'checked="checked"': '' ?>/>
|
70 |
+
<label for="advanced_in_variations_no_<?php echo $i; ?>"><?php _e("Not In Variations", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
71 |
+
</div>
|
72 |
+
<div class="input wpallimport-radio-field">
|
73 |
+
<input type="radio" id="advanced_in_variations_xpath_<?php echo $i; ?>" class="switcher" name="advanced_in_variations[<?php echo $i; ?>]" value="xpath" <?php echo (!empty($post['advanced_in_variations'][$i]) and 'xpath' == $post['advanced_in_variations'][$i]) ? 'checked="checked"': '' ?>/>
|
74 |
+
<label for="advanced_in_variations_xpath_<?php echo $i; ?>"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
75 |
+
<span class="wpallimport-clear"></span>
|
76 |
+
<div class="switcher-target-advanced_in_variations_xpath_<?php echo $i; ?> set_with_xpath">
|
77 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
78 |
+
<input type="text" class="smaller-text" name="advanced_in_variations_xpath[<?php echo $i; ?>]" value="<?php echo (!empty($post['advanced_in_variations_xpath'][$i])) ? esc_attr($post['advanced_in_variations_xpath'][$i]) : ''; ?>"/>
|
79 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
80 |
+
</span>
|
81 |
+
</div>
|
82 |
+
</div>
|
83 |
+
</div>
|
84 |
+
|
85 |
+
<div class="input" style="display:inline-block;">
|
86 |
+
<div class="input">
|
87 |
+
<input type="radio" id="advanced_is_visible_yes_<?php echo $i; ?>" class="switcher" name="advanced_is_visible[<?php echo $i; ?>]" value="yes" <?php echo ( empty($post['advanced_is_visible'][$i]) or ( ! empty($post['advanced_is_visible'][$i]) and ! in_array($post['advanced_is_visible'][$i], array('no', 'xpath'))) ) ? 'checked="checked"': '' ?>/>
|
88 |
+
<label for="advanced_is_visible_yes_<?php echo $i; ?>"><?php _e("Is Visible", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
89 |
+
</div>
|
90 |
+
<div class="input">
|
91 |
+
<input type="radio" id="advanced_is_visible_no_<?php echo $i; ?>" class="switcher" name="advanced_is_visible[<?php echo $i; ?>]" value="no" <?php echo (!empty($post['advanced_is_visible'][$i]) and 'no' == $post['advanced_is_visible'][$i]) ? 'checked="checked"': '' ?>/>
|
92 |
+
<label for="advanced_is_visible_no_<?php echo $i; ?>"><?php _e("Not Visible", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
93 |
+
</div>
|
94 |
+
<div class="input wpallimport-radio-field">
|
95 |
+
<input type="radio" id="advanced_is_visible_xpath_<?php echo $i; ?>" class="switcher" name="advanced_is_visible[<?php echo $i; ?>]" value="xpath" <?php echo (!empty($post['advanced_is_visible'][$i]) and 'xpath' == $post['advanced_is_visible'][$i]) ? 'checked="checked"': '' ?>/>
|
96 |
+
<label for="advanced_is_visible_xpath_<?php echo $i; ?>"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
97 |
+
<span class="wpallimport-clear"></span>
|
98 |
+
<div class="switcher-target-advanced_is_visible_xpath_<?php echo $i; ?> set_with_xpath">
|
99 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
100 |
+
<input type="text" class="smaller-text" name="advanced_is_visible_xpath[<?php echo $i; ?>]" value="<?php echo (!empty($post['advanced_is_visible_xpath'][$i])) ? esc_attr($post['advanced_is_visible_xpath'][$i]) : ''; ?>"/>
|
101 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
102 |
+
</span>
|
103 |
+
</div>
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
|
107 |
+
<div class="input" style="display:inline-block;">
|
108 |
+
<div class="input">
|
109 |
+
<input type="radio" id="advanced_is_taxonomy_yes_<?php echo $i; ?>" class="switcher" name="advanced_is_taxonomy[<?php echo $i; ?>]" value="yes" <?php echo (empty($post['advanced_is_taxonomy'][$i]) or ( !empty($post['advanced_is_taxonomy'][$i]) and ! in_array($post['advanced_is_taxonomy'][$i], array('no', 'xpath'))) ) ? 'checked="checked"': '' ?>/>
|
110 |
+
<label for="advanced_is_taxonomy_yes_<?php echo $i; ?>"><?php _e("Is Taxonomy", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
111 |
+
</div>
|
112 |
+
<div class="input">
|
113 |
+
<input type="radio" id="advanced_is_taxonomy_no_<?php echo $i; ?>" class="switcher" name="advanced_is_taxonomy[<?php echo $i; ?>]" value="no" <?php echo (!empty($post['advanced_is_taxonomy'][$i]) and 'no' == $post['advanced_is_taxonomy'][$i]) ? 'checked="checked"': '' ?>/>
|
114 |
+
<label for="advanced_is_taxonomy_no_<?php echo $i; ?>"><?php _e("Not Taxonomy", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
115 |
+
</div>
|
116 |
+
<div class="input wpallimport-radio-field">
|
117 |
+
<input type="radio" id="advanced_is_taxonomy_xpath_<?php echo $i; ?>" class="switcher" name="advanced_is_taxonomy[<?php echo $i; ?>]" value="xpath" <?php echo (!empty($post['advanced_is_taxonomy'][$i]) and 'xpath' == $post['advanced_is_taxonomy'][$i]) ? 'checked="checked"': '' ?>/>
|
118 |
+
<label for="advanced_is_taxonomy_xpath_<?php echo $i; ?>"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
119 |
+
<span class="wpallimport-clear"></span>
|
120 |
+
<div class="switcher-target-advanced_is_taxonomy_xpath_<?php echo $i; ?> set_with_xpath">
|
121 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
122 |
+
<input type="text" class="smaller-text" name="advanced_is_taxonomy_xpath[<?php echo $i; ?>]" value="<?php echo (!empty($post['advanced_is_taxonomy_xpath'][$i])) ? esc_attr($post['advanced_is_taxonomy_xpath'][$i]) : ''; ?>"/>
|
123 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
124 |
+
</span>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
</div>
|
128 |
+
|
129 |
+
<div class="input" style="display:inline-block;">
|
130 |
+
<div class="input">
|
131 |
+
<input type="radio" id="advanced_is_create_terms_yes_<?php echo $i; ?>" class="switcher" name="advanced_is_create_terms[<?php echo $i; ?>]" value="yes" <?php echo (empty($post['advanced_is_create_terms'][$i]) or ( ! empty($post['advanced_is_create_terms'][$i]) and ! in_array($post['advanced_is_create_terms'][$i], array('no', 'xpath'))) ) ? 'checked="checked"': '' ?>/>
|
132 |
+
<label for="advanced_is_create_terms_yes_<?php echo $i; ?>"><?php _e("Auto-Create Terms", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
133 |
+
</div>
|
134 |
+
<div class="input">
|
135 |
+
<input type="radio" id="advanced_is_create_terms_no_<?php echo $i; ?>" class="switcher" name="advanced_is_create_terms[<?php echo $i; ?>]" value="no" <?php echo ( ! empty($post['advanced_is_create_terms'][$i]) and 'no' == $post['advanced_is_create_terms'][$i]) ? 'checked="checked"': '' ?>/>
|
136 |
+
<label for="advanced_is_create_terms_no_<?php echo $i; ?>"><?php _e("Do Not Create Terms", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
137 |
+
</div>
|
138 |
+
<div class="input wpallimport-radio-field">
|
139 |
+
<input type="radio" id="advanced_is_create_terms_xpath_<?php echo $i; ?>" class="switcher" name="advanced_is_create_terms[<?php echo $i; ?>]" value="xpath" <?php echo (!empty($post['advanced_is_create_terms'][$i]) and 'xpath' == $post['advanced_is_create_terms'][$i]) ? 'checked="checked"': '' ?>/>
|
140 |
+
<label for="advanced_is_create_terms_xpath_<?php echo $i; ?>"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
141 |
+
<span class="wpallimport-clear"></span>
|
142 |
+
<div class="switcher-target-advanced_is_create_terms_xpath_<?php echo $i; ?> set_with_xpath">
|
143 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
144 |
+
<input type="text" class="smaller-text" name="advanced_is_create_terms_xpath[<?php echo $i; ?>]" value="<?php echo (!empty($post['advanced_is_create_terms_xpath'][$i])) ? esc_attr($post['advanced_is_create_terms_xpath'][$i]) : ''; ?>"/>
|
145 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
146 |
+
</span>
|
147 |
+
</div>
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
|
151 |
+
</div>
|
152 |
+
|
153 |
+
</div>
|
154 |
+
</td>
|
155 |
+
<td class="action remove"><a href="#remove" style="top:9px;"></a></td>
|
156 |
+
</tr>
|
157 |
+
<?php endforeach ?>
|
158 |
+
<?php else: ?>
|
159 |
+
<tr class="form-field">
|
160 |
+
<td style="width: 50%;">
|
161 |
+
<div class="drag-attribute">
|
162 |
+
<input type="text" name="attribute_name[]" value="" class="widefat" style="width:100%;"/>
|
163 |
+
</div>
|
164 |
+
</td>
|
165 |
+
<td style="width: 50%;">
|
166 |
+
<input type="text" name="attribute_value[]" class="widefat" vaalue="" style="width:100%;"/>
|
167 |
+
<span class="wpallimport-clear"></span>
|
168 |
+
<div class="form-field wpallimport-radio-field" style="padding: 0 !important; position: relative; left: -100%; width: 200%;">
|
169 |
+
|
170 |
+
<a href="javascript:void(0);" id="advanced_attributes_0" class="action advanced_attributes"><span>+</span> <?php _e('Advanced', PMWI_Plugin::TEXT_DOMAIN) ?></a>
|
171 |
+
<input type="hidden" value="0" name="is_advanced[]">
|
172 |
+
|
173 |
+
<span class="default_attribute_settings">
|
174 |
+
<span class='in_variations'>
|
175 |
+
<input type="checkbox" name="in_variations[]" id="in_variations_0" checked="checked" style="float: left;" value="1"/>
|
176 |
+
<label for="in_variations_0"><?php _e('In Variations',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
177 |
+
</span>
|
178 |
+
<span class='is_visible'>
|
179 |
+
<input type="checkbox" name="is_visible[]" id="is_visible_0" checked="checked" style="float: left;" value="1"/>
|
180 |
+
<label for="is_visible_0"><?php _e('Is Visible',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
181 |
+
</span>
|
182 |
+
<span class='is_taxonomy'>
|
183 |
+
<input type="checkbox" name="is_taxonomy[]" id="is_taxonomy_0" checked="checked" style="float: left;" value="1" class="switcher"/>
|
184 |
+
<label for="is_taxonomy_0"><?php _e('Is Taxonomy',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
185 |
+
</span>
|
186 |
+
<span class='is_create_taxonomy switcher-target-is_taxonomy_0'>
|
187 |
+
<input type="checkbox" name="create_taxonomy_in_not_exists[]" id="create_taxonomy_in_not_exists_0" checked="checked" style="float: left;" value="1"/>
|
188 |
+
<label for="create_taxonomy_in_not_exists_0"><?php _e('Auto-Create Terms',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
189 |
+
</span>
|
190 |
+
</span>
|
191 |
+
|
192 |
+
<div class="advanced_attribute_settings">
|
193 |
+
|
194 |
+
<div class="input" style="display:inline-block;">
|
195 |
+
<div class="input">
|
196 |
+
<input type="radio" id="advanced_in_variations_yes_0" class="switcher" name="advanced_in_variations[0]" value="yes" checked="checked"/>
|
197 |
+
<label for="advanced_in_variations_yes_0"><?php _e("In Variations", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
198 |
+
</div>
|
199 |
+
<div class="input">
|
200 |
+
<input type="radio" id="advanced_in_variations_no_0" class="switcher" name="advanced_in_variations[0]" value="no"/>
|
201 |
+
<label for="advanced_in_variations_no_0"><?php _e("Not In Variations", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
202 |
+
</div>
|
203 |
+
<div class="input wpallimport-radio-field">
|
204 |
+
<input type="radio" id="advanced_in_variations_xpath_0" class="switcher" name="advanced_in_variations[0]" value="xpath"/>
|
205 |
+
<label for="advanced_in_variations_xpath_0"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
206 |
+
<span class="wpallimport-clear"></span>
|
207 |
+
<div class="switcher-target-advanced_in_variations_xpath_0 set_with_xpath">
|
208 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
209 |
+
<input type="text" class="smaller-text" name="advanced_in_variations_xpath[0]" value=""/>
|
210 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
211 |
+
</span>
|
212 |
+
</div>
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
+
|
216 |
+
<div class="input" style="display:inline-block;">
|
217 |
+
<div class="input">
|
218 |
+
<input type="radio" id="advanced_is_visible_yes_0" class="switcher" name="advanced_is_visible[0]" value="yes" checked="checked"/>
|
219 |
+
<label for="advanced_is_visible_yes_0"><?php _e("Is Visible", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
220 |
+
</div>
|
221 |
+
<div class="input">
|
222 |
+
<input type="radio" id="advanced_is_visible_no_0" class="switcher" name="advanced_is_visible[0]" value="no"/>
|
223 |
+
<label for="advanced_is_visible_no_0"><?php _e("Not Visible", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
224 |
+
</div>
|
225 |
+
<div class="input wpallimport-radio-field">
|
226 |
+
<input type="radio" id="advanced_is_visible_xpath_0" class="switcher" name="advanced_is_visible[0]" value="xpath"/>
|
227 |
+
<label for="advanced_is_visible_xpath_0"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
228 |
+
<span class="wpallimport-clear"></span>
|
229 |
+
<div class="switcher-target-advanced_is_visible_xpath_0 set_with_xpath">
|
230 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
231 |
+
<input type="text" class="smaller-text" name="advanced_is_visible_xpath[0]" value=""/>
|
232 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
233 |
+
</span>
|
234 |
+
</div>
|
235 |
+
</div>
|
236 |
+
</div>
|
237 |
+
|
238 |
+
<div class="input" style="display:inline-block;">
|
239 |
+
<div class="input">
|
240 |
+
<input type="radio" id="advanced_is_taxonomy_yes_0" class="switcher" name="advanced_is_taxonomy[0]" value="yes" checked="checked"/>
|
241 |
+
<label for="advanced_is_taxonomy_yes_0"><?php _e("Is Taxonomy", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
242 |
+
</div>
|
243 |
+
<div class="input">
|
244 |
+
<input type="radio" id="advanced_is_taxonomy_no_0" class="switcher" name="advanced_is_taxonomy[0]" value="no"/>
|
245 |
+
<label for="advanced_is_taxonomy_no_0"><?php _e("Not Taxonomy", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
246 |
+
</div>
|
247 |
+
<div class="input wpallimport-radio-field">
|
248 |
+
<input type="radio" id="advanced_is_taxonomy_xpath_0" class="switcher" name="advanced_is_taxonomy[0]" value="xpath"/>
|
249 |
+
<label for="advanced_is_taxonomy_xpath_0"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
250 |
+
<span class="wpallimport-clear"></span>
|
251 |
+
<div class="switcher-target-advanced_is_taxonomy_xpath_0 set_with_xpath">
|
252 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
253 |
+
<input type="text" class="smaller-text" name="advanced_is_taxonomy_xpath[0]" value=""/>
|
254 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
255 |
+
</span>
|
256 |
+
</div>
|
257 |
+
</div>
|
258 |
+
</div>
|
259 |
+
|
260 |
+
<div class="input" style="display:inline-block;">
|
261 |
+
<div class="input">
|
262 |
+
<input type="radio" id="advanced_is_create_terms_yes_0" class="switcher" name="advanced_is_create_terms[0]" value="yes" checked="checked"/>
|
263 |
+
<label for="advanced_is_create_terms_yes_0"><?php _e("Auto-Create Terms", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
264 |
+
</div>
|
265 |
+
<div class="input">
|
266 |
+
<input type="radio" id="advanced_is_create_terms_no_0" class="switcher" name="advanced_is_create_terms[0]" value="no"/>
|
267 |
+
<label for="advanced_is_create_terms_no_0"><?php _e("Do Not Create Terms", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
268 |
+
</div>
|
269 |
+
<div class="input wpallimport-radio-field">
|
270 |
+
<input type="radio" id="advanced_is_create_terms_xpath_0" class="switcher" name="advanced_is_create_terms[0]" value="xpath"/>
|
271 |
+
<label for="advanced_is_create_terms_xpath_0"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
272 |
+
<span class="wpallimport-clear"></span>
|
273 |
+
<div class="switcher-target-advanced_is_create_terms_xpath_0 set_with_xpath">
|
274 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
275 |
+
<input type="text" class="smaller-text" name="advanced_is_create_terms_xpath[0]" value=""/>
|
276 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
277 |
+
</span>
|
278 |
+
</div>
|
279 |
+
</div>
|
280 |
+
</div>
|
281 |
+
|
282 |
+
</div>
|
283 |
+
|
284 |
+
</div>
|
285 |
+
</td>
|
286 |
+
<td class="action remove"><a href="#remove" style="top: 9px;"></a></td>
|
287 |
+
</tr>
|
288 |
+
<?php endif;?>
|
289 |
+
<tr class="form-field template">
|
290 |
+
<td style="width: 50%;">
|
291 |
+
<div class="drag-attribute">
|
292 |
+
<input type="text" name="attribute_name[]" value="" class="widefat" style="width:100%;"/>
|
293 |
+
</div>
|
294 |
+
</td>
|
295 |
+
<td style="width: 50%;">
|
296 |
+
<input type="text" name="attribute_value[]" class="widefat" value="" style="width:100%;"/>
|
297 |
+
<span class="wpallimport-clear"></span>
|
298 |
+
<div class="form-field wpallimport-radio-field" style="padding: 0 !important; position: relative; left: -100%; width: 200%;">
|
299 |
+
|
300 |
+
<a href="javascript:void(0);" id="advanced_attributes_0" class="action advanced_attributes"><span>+</span> <?php _e('Advanced', PMWI_Plugin::TEXT_DOMAIN) ?></a>
|
301 |
+
<input type="hidden" value="0" name="is_advanced[]">
|
302 |
+
|
303 |
+
<span class="default_attribute_settings">
|
304 |
+
<span class='in_variations'>
|
305 |
+
<input type="checkbox" name="in_variations[]" checked="checked" style="float: left;" value="1"/>
|
306 |
+
<label for=""><?php _e('In Variations',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
307 |
+
</span>
|
308 |
+
<span class='is_visible'>
|
309 |
+
<input type="checkbox" name="is_visible[]" checked="checked" style="float: left;" value="1"/>
|
310 |
+
<label for=""><?php _e('Is Visible',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
311 |
+
</span>
|
312 |
+
<span class='is_taxonomy'>
|
313 |
+
<input type="checkbox" name="is_taxonomy[]" checked="checked" style="float: left;" value="1" class="switcher"/>
|
314 |
+
<label for=""><?php _e('Is Taxonomy',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
315 |
+
</span>
|
316 |
+
<span class='is_create_taxonomy'>
|
317 |
+
<input type="checkbox" name="create_taxonomy_in_not_exists[]" checked="checked" style="float: left;" value="1"/>
|
318 |
+
<label for=""><?php _e('Auto-Create Terms',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
319 |
+
</span>
|
320 |
+
</span>
|
321 |
+
|
322 |
+
<div class="advanced_attribute_settings advanced_settings_template">
|
323 |
+
|
324 |
+
<div class="input" style="display:inline-block;">
|
325 |
+
<div class="input">
|
326 |
+
<input type="radio" id="advanced_in_variations_yes_00" class="switcher" name="advanced_in_variations[00]" value="yes" checked="checked"/>
|
327 |
+
<label for="advanced_in_variations_yes_00"><?php _e("In Variations", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
328 |
+
</div>
|
329 |
+
<div class="input">
|
330 |
+
<input type="radio" id="advanced_in_variations_no_00" class="switcher" name="advanced_in_variations[00]" value="no"/>
|
331 |
+
<label for="advanced_in_variations_no_00"><?php _e("Not In Variations", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
332 |
+
</div>
|
333 |
+
<div class="input wpallimport-radio-field">
|
334 |
+
<input type="radio" id="advanced_in_variations_xpath_00" class="switcher" name="advanced_in_variations[00]" value="xpath"/>
|
335 |
+
<label for="advanced_in_variations_xpath_00"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
336 |
+
<span class="wpallimport-clear"></span>
|
337 |
+
<div class="set_with_xpath">
|
338 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
339 |
+
<input type="text" class="smaller-text" name="advanced_in_variations_xpath[00]" value=""/>
|
340 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
341 |
+
</span>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
|
346 |
+
<div class="input" style="display:inline-block;">
|
347 |
+
<div class="input">
|
348 |
+
<input type="radio" id="advanced_is_visible_yes_00" class="switcher" name="advanced_is_visible[00]" value="yes" checked="checked"/>
|
349 |
+
<label for="advanced_is_visible_yes_00"><?php _e("Is Visible", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
350 |
+
</div>
|
351 |
+
<div class="input">
|
352 |
+
<input type="radio" id="advanced_is_visible_no_00" class="switcher" name="advanced_is_visible[00]" value="no"/>
|
353 |
+
<label for="advanced_is_visible_no_00"><?php _e("Not Visible", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
354 |
+
</div>
|
355 |
+
<div class="input wpallimport-radio-field">
|
356 |
+
<input type="radio" id="advanced_is_visible_xpath_00" class="switcher" name="advanced_is_visible[00]" value="xpath"/>
|
357 |
+
<label for="advanced_is_visible_xpath_00"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
358 |
+
<span class="wpallimport-clear"></span>
|
359 |
+
<div class="set_with_xpath">
|
360 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
361 |
+
<input type="text" class="smaller-text" name="advanced_is_visible_xpath[00]" value=""/>
|
362 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
363 |
+
</span>
|
364 |
+
</div>
|
365 |
+
</div>
|
366 |
+
</div>
|
367 |
+
|
368 |
+
<div class="input" style="display:inline-block;">
|
369 |
+
<div class="input">
|
370 |
+
<input type="radio" id="advanced_is_taxonomy_yes_00" class="switcher" name="advanced_is_taxonomy[00]" value="yes" checked="checked"/>
|
371 |
+
<label for="advanced_is_taxonomy_yes_00"><?php _e("Is Taxonomy", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
372 |
+
</div>
|
373 |
+
<div class="input">
|
374 |
+
<input type="radio" id="advanced_is_taxonomy_no_00" class="switcher" name="advanced_is_taxonomy[00]" value="no"/>
|
375 |
+
<label for="advanced_is_taxonomy_no_00"><?php _e("Not Taxonomy", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
376 |
+
</div>
|
377 |
+
<div class="input wpallimport-radio-field">
|
378 |
+
<input type="radio" id="advanced_is_taxonomy_xpath_00" class="switcher" name="advanced_is_taxonomy[00]" value="xpath"/>
|
379 |
+
<label for="advanced_is_taxonomy_xpath_00"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
380 |
+
<span class="wpallimport-clear"></span>
|
381 |
+
<div class="set_with_xpath">
|
382 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
383 |
+
<input type="text" class="smaller-text" name="advanced_is_taxonomy_xpath[00]" value=""/>
|
384 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
385 |
+
</span>
|
386 |
+
</div>
|
387 |
+
</div>
|
388 |
+
</div>
|
389 |
+
|
390 |
+
<div class="input" style="display:inline-block;">
|
391 |
+
<div class="input">
|
392 |
+
<input type="radio" id="advanced_is_create_terms_yes_00" class="switcher" name="advanced_is_create_terms[00]" value="yes" checked="checked"/>
|
393 |
+
<label for="advanced_is_create_terms_yes_00"><?php _e("Auto-Create Terms", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
394 |
+
</div>
|
395 |
+
<div class="input">
|
396 |
+
<input type="radio" id="advanced_is_create_terms_no_00" class="switcher" name="advanced_is_create_terms[00]" value="no"/>
|
397 |
+
<label for="advanced_is_create_terms_no_00"><?php _e("Do Not Create Terms", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
398 |
+
</div>
|
399 |
+
<div class="input wpallimport-radio-field">
|
400 |
+
<input type="radio" id="advanced_is_create_terms_xpath_00" class="switcher" name="advanced_is_create_terms[00]" value="xpath"/>
|
401 |
+
<label for="advanced_is_create_terms_xpath_00"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
402 |
+
<span class="wpallimport-clear"></span>
|
403 |
+
<div class="set_with_xpath">
|
404 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
405 |
+
<input type="text" class="smaller-text" name="advanced_is_create_terms_xpath[00]" value=""/>
|
406 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
407 |
+
</span>
|
408 |
+
</div>
|
409 |
+
</div>
|
410 |
+
</div>
|
411 |
+
|
412 |
+
</div>
|
413 |
+
|
414 |
+
</div>
|
415 |
+
</td>
|
416 |
+
<td class="action remove"><a href="#remove" style="top: 9px;"></a></td>
|
417 |
+
</tr>
|
418 |
+
<tr class="wpallimport-table-actions">
|
419 |
+
<td colspan="3"><a href="#add" title="<?php _e('add', PMWI_Plugin::TEXT_DOMAIN)?>" class="action add-new-custom"><?php _e('Add more', PMWI_Plugin::TEXT_DOMAIN) ?></a></td>
|
420 |
+
</tr>
|
421 |
+
</tbody>
|
422 |
+
</table>
|
423 |
+
</div>
|
424 |
+
<div class="options_group show_if_variable">
|
425 |
+
<p class="form-field wpallimport-radio-field" style="padding-left: 10px !important;">
|
426 |
+
<input type="hidden" name="link_all_variations" value="0" />
|
427 |
+
<input type="checkbox" id="link_all_variations" name="link_all_variations" value="1" <?php echo $post['link_all_variations'] ? 'checked="checked"' : '' ?>/>
|
428 |
+
<label style="width: 100px;" for="link_all_variations"><?php _e('Link all variations', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
429 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('This option will create all possible variations for the presented attributes. Works just like the Link All Variations option inside WooCommerce.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="top:3px;">?</a>
|
430 |
+
</p>
|
431 |
+
</div>
|
432 |
+
</div><!-- End Product Panel -->
|
views/admin/import/product/_tabs/_general.php
ADDED
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="general_product_data">
|
2 |
+
<?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
|
3 |
+
<div class="woo-add-on-free-edition-notice upgrade_template">
|
4 |
+
<a href="https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=upgrade-notice&utm_campaign=import-variable-wooco-products" target="_blank" class="upgrade_woo_link"><?php _e('Upgrade to the Pro edition of WP All Import and the WooCommerce Add-On to Import to Variable, Affiliate, and Grouped Products.', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
5 |
+
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
6 |
+
</div>
|
7 |
+
<?php endif; ?>
|
8 |
+
<div class="options_group">
|
9 |
+
<p class="form-field">
|
10 |
+
<label><?php _e("SKU", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
11 |
+
<input type="text" class="short" name="single_product_sku" style="" value="<?php echo esc_attr($post['single_product_sku']) ?>"/>
|
12 |
+
</p>
|
13 |
+
</div>
|
14 |
+
<div class="options_group show_if_external">
|
15 |
+
<p class="form-field">
|
16 |
+
<label><?php _e("Product URL", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
17 |
+
<input type="text" class="short" name="single_product_url" value="<?php echo esc_attr($post['single_product_url']) ?>"/>
|
18 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The external/affiliate link URL to the product.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
19 |
+
</p>
|
20 |
+
<p class="form-field">
|
21 |
+
<label><?php _e("Button text", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
22 |
+
<input type="text" class="short" name="single_product_button_text" value="<?php echo esc_attr($post['single_product_button_text']) ?>"/>
|
23 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('This text will be shown on the button linking to the external product.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
24 |
+
</p>
|
25 |
+
</div>
|
26 |
+
<div class="options_group pricing show_if_simple show_if_external show_if_variable">
|
27 |
+
|
28 |
+
<p class="form-field">
|
29 |
+
<label><?php printf(__("Regular Price (%s)", PMWI_Plugin::TEXT_DOMAIN), get_woocommerce_currency_symbol()); ?></label>
|
30 |
+
<input type="text" class="short" name="single_product_regular_price" value="<?php echo esc_attr($post['single_product_regular_price']) ?>"/> <strong class="options_group show_if_variable" style="position:relative; top:4px; left:4px;">(<?php _e('required', PMWI_Plugin::TEXT_DOMAIN); ?>)</strong>
|
31 |
+
</p>
|
32 |
+
<p class="form-field">
|
33 |
+
<label><?php printf(__("Sale Price (%s)", PMWI_Plugin::TEXT_DOMAIN), get_woocommerce_currency_symbol()); ?></label>
|
34 |
+
<input type="text" class="short" name="single_product_sale_price" value="<?php echo esc_attr($post['single_product_sale_price']) ?>"/> <a id="regular_price_shedule" href="javascript:void(0);" <?php if ($post['is_regular_price_shedule']):?>style="display:none;"<?php endif; ?>><?php _e('schedule', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
35 |
+
<input type="hidden" name="is_regular_price_shedule" value="<?php echo esc_attr($post['is_regular_price_shedule']) ?>"/>
|
36 |
+
</p>
|
37 |
+
<p class="form-field" <?php if ( ! $post['is_regular_price_shedule']):?>style="display:none;"<?php endif; ?> id="sale_price_range">
|
38 |
+
<span style="vertical-align:middle">
|
39 |
+
<label><?php _e("Sale Price Dates", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
40 |
+
<input type="text" class="datepicker" name="single_sale_price_dates_from" value="<?php echo esc_attr($post['single_sale_price_dates_from']) ?>" style="float:none; width:110px;"/>
|
41 |
+
<span><?php _e('and', PMWI_Plugin::TEXT_DOMAIN) ?></span>
|
42 |
+
<input type="text" class="datepicker" name="single_sale_price_dates_to" value="<?php echo esc_attr($post['single_sale_price_dates_to']) ?>" style="float:none !important; width:110px;"/>
|
43 |
+
<a id="cancel_regular_price_shedule" href="javascript:void(0);"><?php _e('cancel', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
44 |
+
</span>
|
45 |
+
</p>
|
46 |
+
|
47 |
+
<!-- AUTOFIX PRICES -->
|
48 |
+
|
49 |
+
<p class="form-field pmwi_trigger_adjust_prices" style="color:#5EAAAC;"> <strong><span><?php if (!empty($post['single_product_regular_price_adjust']) or !empty($post['single_product_sale_price_adjust'])):?>-<?php else: ?>+<?php endif; ?></span><?php _e(' Adjust Prices', PMWI_Plugin::TEXT_DOMAIN); ?></strong><a href="#help" class="wpallimport-help" title="<?php _e('Mark prices up and down, convert prices to currencies.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top: -1px; left:4px;;">?</a></p>
|
50 |
+
<div class="pmwi_adjust_prices" <?php if (!empty($post['single_product_regular_price_adjust']) or !empty($post['single_product_sale_price_adjust'])):?>style="display:block;"<?php endif; ?>>
|
51 |
+
<p class="form-field">
|
52 |
+
<label><?php printf(__("Regular Price (%s)", PMWI_Plugin::TEXT_DOMAIN), get_woocommerce_currency_symbol()); ?></label>
|
53 |
+
<input type="text" class="short" name="single_product_regular_price_adjust" value="<?php echo esc_attr($post['single_product_regular_price_adjust']) ?>"/>
|
54 |
+
<select name="single_product_regular_price_adjust_type" class="pmwi_adjust_type">
|
55 |
+
<option value="%" <?php echo ($post['single_product_regular_price_adjust_type'] == '%') ? 'selected="selected"' : ''; ?>>%</option>
|
56 |
+
<option value="$" <?php echo ($post['single_product_regular_price_adjust_type'] == '$') ? 'selected="selected"' : ''; ?>><?php echo get_woocommerce_currency_symbol(); ?></option>
|
57 |
+
</select>
|
58 |
+
<a href="#help" class="wpallimport-help pmwi_percentage_prices_note" title="<?php _e('Leave blank or enter in 100% to keep the price as is. Enter in 110% to markup by 10%. Enter in 50% to cut prices in half.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
59 |
+
<a href="#help" class="wpallimport-help pmwi_reduce_prices_note" title="<?php _e('Enter a negative number to reduce prices.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
60 |
+
<span class="wpallimport-clear"></span>
|
61 |
+
</p>
|
62 |
+
|
63 |
+
<p class="form-field">
|
64 |
+
<label><?php printf(__("Sale Price (%s)", PMWI_Plugin::TEXT_DOMAIN), get_woocommerce_currency_symbol()); ?></label>
|
65 |
+
<input type="text" class="short" name="single_product_sale_price_adjust" value="<?php echo esc_attr($post['single_product_sale_price_adjust']) ?>"/>
|
66 |
+
<select name="single_product_sale_price_adjust_type" class="pmwi_adjust_type">
|
67 |
+
<option value="%" <?php echo ($post['single_product_sale_price_adjust_type'] == '%') ? 'selected="selected"' : ''; ?>>%</option>
|
68 |
+
<option value="$" <?php echo ($post['single_product_sale_price_adjust_type'] == '$') ? 'selected="selected"' : ''; ?>><?php echo get_woocommerce_currency_symbol(); ?></option>
|
69 |
+
</select>
|
70 |
+
<a href="#help" class="wpallimport-help pmwi_percentage_prices_note" title="<?php _e('Leave blank or enter in 100% to keep the price as is. Enter in 110% to markup by 10%. Enter in 50% to cut prices in half.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
71 |
+
<a href="#help" class="wpallimport-help pmwi_reduce_prices_note" title="<?php _e('Enter a negative number to reduce prices.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
72 |
+
<span class="wpallimport-clear"></span>
|
73 |
+
</p>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<br>
|
77 |
+
|
78 |
+
<p class="form-field wpallimport-radio-field">
|
79 |
+
<input type="hidden" name="disable_prepare_price" value="0" />
|
80 |
+
<input type="checkbox" id="disable_prepare_price" name="disable_prepare_price" value="1" <?php echo $post['disable_prepare_price'] ? 'checked="checked"' : '' ?> />
|
81 |
+
<label for="disable_prepare_price" style="width:220px;"><?php _e('Remove currency symbols from price', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
82 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Attempt to remove currency symbols from prices.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:1px;">?</a>
|
83 |
+
</p>
|
84 |
+
|
85 |
+
<p class="form-field wpallimport-radio-field">
|
86 |
+
<input type="hidden" name="convert_decimal_separator" value="0" />
|
87 |
+
<input type="checkbox" id="convert_decimal_separator" name="convert_decimal_separator" value="1" <?php echo $post['convert_decimal_separator'] ? 'checked="checked"' : '' ?> />
|
88 |
+
<label for="convert_decimal_separator" style="width:220px;"><?php _e('Convert decimal separator to a period', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
89 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Prices must be imported using a period as the decimal separator. If you\'d like to change the decimal separator you can do so by editing your WooCommerce settings.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:1px;">?</a>
|
90 |
+
</p>
|
91 |
+
|
92 |
+
<p class="form-field wpallimport-radio-field">
|
93 |
+
<input type="hidden" name="prepare_price_to_woo_format" value="0" />
|
94 |
+
<input type="checkbox" id="prepare_price_to_woo_format" name="prepare_price_to_woo_format" value="1" <?php echo $post['prepare_price_to_woo_format'] ? 'checked="checked"' : '' ?> />
|
95 |
+
<label for="prepare_price_to_woo_format" style="width:420px;"><?php _e('Attempt to convert incorrectly formatted prices to WooCommerce format', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
96 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('WP All Import will attempt to correct the formatting of prices presented incorrectly, but this doesn\'t always work. Try unchecking this option if your prices are not appearing correctly, or enter your prices in your import file using the same format you would when entering them in WooCommerce.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:1px;">?</a>
|
97 |
+
</p>
|
98 |
+
|
99 |
+
<p class="form-field">
|
100 |
+
<a href="javascript:void(0);" class="preview_prices" rel="preview_prices" style="float:left;"><?php _e('Preview Prices', PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
101 |
+
</p>
|
102 |
+
|
103 |
+
</div>
|
104 |
+
|
105 |
+
<div class="options_group show_if_variable">
|
106 |
+
<p class="form-field">
|
107 |
+
<label><?php _e("Variation Description"); ?></label>
|
108 |
+
<input type="text" class="short" name="single_product_variation_description" value="<?php echo esc_attr($post['single_product_variation_description']) ?>"/>
|
109 |
+
</p>
|
110 |
+
</div>
|
111 |
+
|
112 |
+
<!--div class="options_group show_if_variable">
|
113 |
+
|
114 |
+
<p class="form-field"><?php _e('Variation Enabled',PMWI_Plugin::TEXT_DOMAIN);?><a href="#help" class="wpallimport-help" title="<?php _e('This option is the same as the Enabled checkbox when editing an individual variation in WooCommerce.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a></p>
|
115 |
+
|
116 |
+
<p class="form-field wpallimport-radio-field">
|
117 |
+
<input type="radio" id="variation_enabled_yes" class="switcher" name="is_variation_enabled" value="yes" <?php echo 'yes' == $post['is_variation_enabled'] ? 'checked="checked"': '' ?>/>
|
118 |
+
<label for="variation_enabled_yes"><?php _e("Yes"); ?></label>
|
119 |
+
</p>
|
120 |
+
<p class="form-field wpallimport-radio-field">
|
121 |
+
<input type="radio" id="variation_enabled_no" class="switcher" name="is_variation_enabled" value="no" <?php echo 'no' == $post['is_variation_enabled'] ? 'checked="checked"': '' ?>/>
|
122 |
+
<label for="variation_enabled_no"><?php _e("No"); ?></label>
|
123 |
+
</p>
|
124 |
+
<div class="form-field wpallimport-radio-field">
|
125 |
+
<input type="radio" id="variation_enabled_xpath" class="switcher" name="is_variation_enabled" value="xpath" <?php echo 'xpath' == $post['is_variation_enabled'] ? 'checked="checked"': '' ?>/>
|
126 |
+
<label for="variation_enabled_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
127 |
+
<span class="wpallimport-clear"></span>
|
128 |
+
<div class="switcher-target-variation_enabled_xpath set_with_xpath">
|
129 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
130 |
+
<input type="text" class="smaller-text" name="single_variation_enabled" style="width:300px;" value="<?php echo esc_attr($post['single_variation_enabled']) ?>"/>
|
131 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
132 |
+
</span>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
</div-->
|
136 |
+
|
137 |
+
<div class="options_group show_if_simple show_if_external show_if_variable">
|
138 |
+
|
139 |
+
<p class="form-field wpallimport-radio-field">
|
140 |
+
<input type="radio" id="is_product_virtual_yes" class="switcher" name="is_product_virtual" value="yes" <?php echo 'yes' == $post['is_product_virtual'] ? 'checked="checked"': '' ?>/>
|
141 |
+
<label for="is_product_virtual_yes"><?php _e("Virtual", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
142 |
+
</p>
|
143 |
+
<p class="form-field wpallimport-radio-field">
|
144 |
+
<input type="radio" id="is_product_virtual_no" class="switcher" name="is_product_virtual" value="no" <?php echo 'no' == $post['is_product_virtual'] ? 'checked="checked"': '' ?>/>
|
145 |
+
<label for="is_product_virtual_no"><?php _e("Not Virtual", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
146 |
+
</p>
|
147 |
+
<div class="form-field wpallimport-radio-field">
|
148 |
+
<input type="radio" id="is_product_virtual_xpath" class="switcher" name="is_product_virtual" value="xpath" <?php echo 'xpath' == $post['is_product_virtual'] ? 'checked="checked"': '' ?>/>
|
149 |
+
<label for="is_product_virtual_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
150 |
+
<span class="wpallimport-clear"></span>
|
151 |
+
<div class="switcher-target-is_product_virtual_xpath set_with_xpath">
|
152 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
153 |
+
<input type="text" class="smaller-text" name="single_product_virtual" style="width:300px;" value="<?php echo esc_attr($post['single_product_virtual']) ?>"/>
|
154 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
155 |
+
</span>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
|
159 |
+
</div>
|
160 |
+
<div class="options_group show_if_simple show_if_external show_if_variable">
|
161 |
+
|
162 |
+
<p class="form-field wpallimport-radio-field">
|
163 |
+
<input type="radio" id="is_product_downloadable_yes" class="switcher" name="is_product_downloadable" value="yes" <?php echo 'yes' == $post['is_product_downloadable'] ? 'checked="checked"': '' ?>/>
|
164 |
+
<label for="is_product_downloadable_yes"><?php _e("Downloadable", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
165 |
+
</p>
|
166 |
+
<p class="form-field wpallimport-radio-field">
|
167 |
+
<input type="radio" id="is_product_downloadable_no" class="switcher" name="is_product_downloadable" value="no" <?php echo 'no' == $post['is_product_downloadable'] ? 'checked="checked"': '' ?>/>
|
168 |
+
<label for="is_product_downloadable_no"><?php _e("Not Downloadable", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
169 |
+
</p>
|
170 |
+
<div class="form-field wpallimport-radio-field">
|
171 |
+
<input type="radio" id="is_product_downloadable_xpath" class="switcher" name="is_product_downloadable" value="xpath" <?php echo 'xpath' == $post['is_product_downloadable'] ? 'checked="checked"': '' ?>/>
|
172 |
+
<label for="is_product_downloadable_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
173 |
+
<span class="wpallimport-clear"></span>
|
174 |
+
<div class="switcher-target-is_product_downloadable_xpath set_with_xpath">
|
175 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
176 |
+
<input type="text" class="smaller-text" name="single_product_downloadable" style="width:300px;" value="<?php echo esc_attr($post['single_product_downloadable']) ?>"/>
|
177 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
178 |
+
</span>
|
179 |
+
</div>
|
180 |
+
</div>
|
181 |
+
</div>
|
182 |
+
|
183 |
+
<div class="options_group show_if_downloadable">
|
184 |
+
<p class="form-field">
|
185 |
+
<label><?php _e("File paths", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
186 |
+
<input type="text" class="short" name="single_product_files" value="<?php echo esc_attr($post['single_product_files']) ?>" style="margin-right:5px;"/>
|
187 |
+
<input type="text" class="small" name="product_files_delim" value="<?php echo esc_attr($post['product_files_delim']) ?>" style="width:5%; text-align:center;"/>
|
188 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('File paths/URLs, comma separated. The delimiter is used when an XML element contains multiple URLs/paths - i.e. <code>http://files.com/1.doc, http://files.com/2.doc</code>.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
189 |
+
</p>
|
190 |
+
<p class="form-field">
|
191 |
+
<label><?php _e("File names", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
192 |
+
<input type="text" class="short" name="single_product_files_names" value="<?php echo esc_attr($post['single_product_files_names']) ?>" style="margin-right:5px;"/>
|
193 |
+
<input type="text" class="small" name="product_files_names_delim" value="<?php echo esc_attr($post['product_files_names_delim']) ?>" style="width:5%; text-align:center;"/>
|
194 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('File names, comma separated. The delimiter is used when an XML element contains multiple names - i.e. <code>1.doc, 2.doc</code>.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
195 |
+
</p>
|
196 |
+
<p class="form-field">
|
197 |
+
<label><?php _e("Download Limit", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
198 |
+
<input type="text" class="short" placeholder="Unimited" name="single_product_download_limit" value="<?php echo esc_attr($post['single_product_download_limit']) ?>"/>
|
199 |
+
<a href="#help" class="wpallimport-help" title="<?php _e( 'Leave blank for unlimited re-downloads.', PMWI_Plugin::TEXT_DOMAIN ) ?>">?</a>
|
200 |
+
</p>
|
201 |
+
<p class="form-field">
|
202 |
+
<label><?php _e("Download Expiry", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
203 |
+
<input type="text" class="short" placeholder="Never" name="single_product_download_expiry" value="<?php echo esc_attr($post['single_product_download_expiry']) ?>"/>
|
204 |
+
<a href="#help" class="wpallimport-help" title="<?php _e( 'Enter the number of days before a download link expires, or leave blank.', PMWI_Plugin::TEXT_DOMAIN ) ?>">?</a>
|
205 |
+
</p>
|
206 |
+
<p class="form-field">
|
207 |
+
<label><?php _e("Download Type", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
208 |
+
<input type="text" class="short" placeholder="Standard Product" name="single_product_download_type" value="<?php echo esc_attr($post['single_product_download_type']) ?>"/>
|
209 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'application\', \'music\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
210 |
+
</p>
|
211 |
+
</div>
|
212 |
+
|
213 |
+
<div class="options_group show_if_simple show_if_external show_if_variable">
|
214 |
+
|
215 |
+
<div class="form-field wpallimport-radio-field">
|
216 |
+
<input type="radio" id="multiple_product_tax_status_yes" class="switcher" name="is_multiple_product_tax_status" value="yes" <?php echo 'no' != $post['is_multiple_product_tax_status'] ? 'checked="checked"': '' ?>/>
|
217 |
+
<label for="multiple_product_tax_status_yes"><?php _e("Tax Status", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
218 |
+
<span class="wpallimport-clear"></span>
|
219 |
+
<div class="switcher-target-multiple_product_tax_status_yes set_with_xpath">
|
220 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
221 |
+
<select class="select short" name="multiple_product_tax_status">
|
222 |
+
<option value="taxable" <?php echo 'taxable' == $post['multiple_product_tax_status'] ? 'selected="selected"': '' ?>><?php _e('Taxable', PMWI_Plugin::TEXT_DOMAIN);?></option>
|
223 |
+
<option value="shipping" <?php echo 'shipping' == $post['multiple_product_tax_status'] ? 'selected="selected"': '' ?>><?php _e('Shipping only', PMWI_Plugin::TEXT_DOMAIN);?></option>
|
224 |
+
<option value="none" <?php echo 'none' == $post['multiple_product_tax_status'] ? 'selected="selected"': '' ?>><?php _e('None', PMWI_Plugin::TEXT_DOMAIN);?></option>
|
225 |
+
</select>
|
226 |
+
</span>
|
227 |
+
</div>
|
228 |
+
</div>
|
229 |
+
|
230 |
+
<div class="form-field wpallimport-radio-field">
|
231 |
+
<input type="radio" id="multiple_product_tax_status_no" class="switcher" name="is_multiple_product_tax_status" value="no" <?php echo 'no' == $post['is_multiple_product_tax_status'] ? 'checked="checked"': '' ?>/>
|
232 |
+
<label for="multiple_product_tax_status_no"><?php _e('Set tax status with XPath', PMWI_Plugin::TEXT_DOMAIN ); ?></label>
|
233 |
+
<span class="wpallimport-clear"></span>
|
234 |
+
<div class="switcher-target-multiple_product_tax_status_no set_with_xpath">
|
235 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
236 |
+
<input type="text" class="smaller-text" name="single_product_tax_status" style="width:300px;" value="<?php echo esc_attr($post['single_product_tax_status']) ?>"/>
|
237 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Value should be the slug for the tax status - \'taxable\', \'shipping\', and \'none\' are the default slugs.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
238 |
+
</span>
|
239 |
+
</div>
|
240 |
+
</div>
|
241 |
+
|
242 |
+
</div>
|
243 |
+
<div class="options_group show_if_simple show_if_external show_if_variable">
|
244 |
+
|
245 |
+
<div class="form-field wpallimport-radio-field">
|
246 |
+
<input type="radio" id="multiple_product_tax_class_yes" class="switcher" name="is_multiple_product_tax_class" value="yes" <?php echo 'no' != $post['is_multiple_product_tax_class'] ? 'checked="checked"': '' ?>/>
|
247 |
+
<label for="multiple_product_tax_class_yes"><?php _e("Tax Class", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
248 |
+
|
249 |
+
<span class="wpallimport-clear"></span>
|
250 |
+
<div class="switcher-target-multiple_product_tax_class_yes set_with_xpath">
|
251 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
252 |
+
<?php
|
253 |
+
$tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) );
|
254 |
+
$classes_options = array();
|
255 |
+
$classes_options[''] = __( 'Standard', PMWI_Plugin::TEXT_DOMAIN );
|
256 |
+
|
257 |
+
if ( $tax_classes ){
|
258 |
+
foreach ( $tax_classes as $class ){
|
259 |
+
$classes_options[ sanitize_title( $class ) ] = esc_html( $class );
|
260 |
+
}
|
261 |
+
}
|
262 |
+
?>
|
263 |
+
<select class="select short" name="multiple_product_tax_class">
|
264 |
+
<?php foreach ($classes_options as $key => $value):?>
|
265 |
+
<option value="<?php echo $key; ?>" <?php echo selected( esc_attr( $key ), esc_attr( $post['multiple_product_tax_class'] ), false ); ?>><?php echo $value; ?></option>
|
266 |
+
<?php endforeach; ?>
|
267 |
+
</select>
|
268 |
+
</span>
|
269 |
+
</div>
|
270 |
+
</div>
|
271 |
+
|
272 |
+
<div class="form-field wpallimport-radio-field">
|
273 |
+
<input type="radio" id="multiple_product_tax_class_no" class="switcher" name="is_multiple_product_tax_class" value="no" <?php echo 'no' == $post['is_multiple_product_tax_class'] ? 'checked="checked"': '' ?>/>
|
274 |
+
<label for="multiple_product_tax_class_no"><?php _e('Set tax class with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
275 |
+
|
276 |
+
<span class="wpallimport-clear"></span>
|
277 |
+
<div class="switcher-target-multiple_product_tax_class_no set_with_xpath">
|
278 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
279 |
+
<input type="text" class="smaller-text" name="single_product_tax_class" style="width:300px;" value="<?php echo esc_attr($post['single_product_tax_class']) ?>"/>
|
280 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Value should be the slug for the tax class - \'reduced-rate\' and \'zero-rate\', are the default slugs.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
281 |
+
</span>
|
282 |
+
</div>
|
283 |
+
</div>
|
284 |
+
|
285 |
+
</div>
|
286 |
+
|
287 |
+
</div>
|
views/admin/import/product/_tabs/_inventory.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="inventory_product_data" style="display:none;">
|
2 |
+
<?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
|
3 |
+
<div class="woo-add-on-free-edition-notice upgrade_template">
|
4 |
+
<a href="https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=upgrade-notice&utm_campaign=import-variable-wooco-products" target="_blank" class="upgrade_woo_link"><?php _e('Upgrade to the Pro edition of WP All Import and the WooCommerce Add-On to Import to Variable, Affiliate, and Grouped Products', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
5 |
+
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
6 |
+
</div>
|
7 |
+
<?php endif; ?>
|
8 |
+
<div class="options_group show_if_simple show_if_variable">
|
9 |
+
|
10 |
+
<p class="form-field"><?php _e("Manage stock?", PMWI_Plugin::TEXT_DOMAIN); ?></p>
|
11 |
+
|
12 |
+
<p class="form-field wpallimport-radio-field">
|
13 |
+
<input type="radio" id="is_product_manage_stock_yes" class="switcher" name="is_product_manage_stock" value="yes" <?php echo 'yes' == $post['is_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
14 |
+
<label for="is_product_manage_stock_yes"><?php _e("Yes"); ?></label>
|
15 |
+
</p>
|
16 |
+
<p class="form-field wpallimport-radio-field">
|
17 |
+
<input type="radio" id="is_product_manage_stock_no" class="switcher" name="is_product_manage_stock" value="no" <?php echo 'no' == $post['is_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
18 |
+
<label for="is_product_manage_stock_no"><?php _e("No"); ?></label>
|
19 |
+
</p>
|
20 |
+
<div class="form-field wpallimport-radio-field">
|
21 |
+
<input type="radio" id="is_product_manage_stock_xpath" class="switcher" name="is_product_manage_stock" value="xpath" <?php echo 'xpath' == $post['is_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
22 |
+
<label for="is_product_manage_stock_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
23 |
+
<span class="wpallimport-clear"></span>
|
24 |
+
<div class="switcher-target-is_product_manage_stock_xpath set_with_xpath">
|
25 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
26 |
+
<input type="text" class="smaller-text" name="single_product_manage_stock" style="width:300px;" value="<?php echo esc_attr($post['single_product_manage_stock']) ?>"/>
|
27 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
28 |
+
</span>
|
29 |
+
</div>
|
30 |
+
</div>
|
31 |
+
|
32 |
+
</div>
|
33 |
+
<div class="options_group stock_fields show_if_simple show_if_variable">
|
34 |
+
<p class="form-field" style="margin-top:0;">
|
35 |
+
<label><?php _e("Stock Qty", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
36 |
+
<input type="text" class="short" name="single_product_stock_qty" value="<?php echo esc_attr($post['single_product_stock_qty']) ?>"/>
|
37 |
+
</p>
|
38 |
+
<p class="form-field" style="margin-top:0;">
|
39 |
+
<label><?php _e("Low stock threshold", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
40 |
+
<input type="text" class="short" name="single_product_low_stock_amount" value="<?php echo esc_attr($post['single_product_low_stock_amount']) ?>"/>
|
41 |
+
</p>
|
42 |
+
</div>
|
43 |
+
<div class="options_group">
|
44 |
+
|
45 |
+
<p class="form-field"><?php _e('Stock status',PMWI_Plugin::TEXT_DOMAIN);?></p>
|
46 |
+
|
47 |
+
<p class="form-field wpallimport-radio-field">
|
48 |
+
<input type="radio" id="product_stock_status_in_stock" class="switcher" name="product_stock_status" value="instock" <?php echo 'instock' == $post['product_stock_status'] ? 'checked="checked"': '' ?>/>
|
49 |
+
<label for="product_stock_status_in_stock"><?php _e("In stock", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
50 |
+
</p>
|
51 |
+
<p class="form-field wpallimport-radio-field">
|
52 |
+
<input type="radio" id="product_stock_status_out_of_stock" class="switcher" name="product_stock_status" value="outofstock" <?php echo 'outofstock' == $post['product_stock_status'] ? 'checked="checked"': '' ?>/>
|
53 |
+
<label for="product_stock_status_out_of_stock"><?php _e("Out of stock", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
54 |
+
</p>
|
55 |
+
<p class="form-field wpallimport-radio-field">
|
56 |
+
<input type="radio" id="product_stock_status_automatically" class="switcher" name="product_stock_status" value="auto" <?php echo 'auto' == $post['product_stock_status'] ? 'checked="checked"': '' ?>/>
|
57 |
+
<label for="product_stock_status_automatically" style="width:105px;"><?php _e("Set automatically", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
58 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Set the stock status to In Stock for positive or blank Stock Qty values, and Out Of Stock if Stock Qty is 0.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
59 |
+
</p>
|
60 |
+
<div class="form-field wpallimport-radio-field">
|
61 |
+
<input type="radio" id="product_stock_status_xpath" class="switcher" name="product_stock_status" value="xpath" <?php echo 'xpath' == $post['product_stock_status'] ? 'checked="checked"': '' ?>/>
|
62 |
+
<label for="product_stock_status_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
63 |
+
<span class="wpallimport-clear"></span>
|
64 |
+
<div class="switcher-target-product_stock_status_xpath set_with_xpath">
|
65 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
66 |
+
<input type="text" class="smaller-text" name="single_product_stock_status" style="width:300px;" value="<?php echo esc_attr($post['single_product_stock_status']) ?>"/>
|
67 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'instock\', \'outofstock\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
68 |
+
</span>
|
69 |
+
</div>
|
70 |
+
</div>
|
71 |
+
|
72 |
+
</div>
|
73 |
+
|
74 |
+
<div class="options_group show_if_simple show_if_variable">
|
75 |
+
|
76 |
+
<p class="form-field"><?php _e('Allow Backorders?',PMWI_Plugin::TEXT_DOMAIN);?></p>
|
77 |
+
|
78 |
+
<p class="form-field wpallimport-radio-field">
|
79 |
+
<input type="radio" id="product_allow_backorders_no" class="switcher" name="product_allow_backorders" value="no" <?php echo 'no' == $post['product_allow_backorders'] ? 'checked="checked"': '' ?>/>
|
80 |
+
<label for="product_allow_backorders_no"><?php _e("Do not allow", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
81 |
+
</p>
|
82 |
+
<p class="form-field wpallimport-radio-field">
|
83 |
+
<input type="radio" id="product_allow_backorders_notify" class="switcher" name="product_allow_backorders" value="notify" <?php echo 'notify' == $post['product_allow_backorders'] ? 'checked="checked"': '' ?>/>
|
84 |
+
<label for="product_allow_backorders_notify"><?php _e("Allow, but notify customer", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
85 |
+
</p>
|
86 |
+
<p class="form-field wpallimport-radio-field">
|
87 |
+
<input type="radio" id="product_allow_backorders_yes" class="switcher" name="product_allow_backorders" value="yes" <?php echo 'yes' == $post['product_allow_backorders'] ? 'checked="checked"': '' ?>/>
|
88 |
+
<label for="product_allow_backorders_yes"><?php _e("Allow", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
89 |
+
</p>
|
90 |
+
<div class="form-field wpallimport-radio-field">
|
91 |
+
<input type="radio" id="product_allow_backorders_xpath" class="switcher" name="product_allow_backorders" value="xpath" <?php echo 'xpath' == $post['product_allow_backorders'] ? 'checked="checked"': '' ?>/>
|
92 |
+
<label for="product_allow_backorders_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
93 |
+
<span class="wpallimport-clear"></span>
|
94 |
+
<div class="switcher-target-product_allow_backorders_xpath set_with_xpath">
|
95 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
96 |
+
<input type="text" class="smaller-text" name="single_product_allow_backorders" style="width:300px;" value="<?php echo esc_attr($post['single_product_allow_backorders']) ?>"/>
|
97 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'no\', \'notify\', \'yes\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
98 |
+
</span>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
</div>
|
103 |
+
<div class="options_group show_if_simple show_if_variable">
|
104 |
+
|
105 |
+
<p class="form-field"><?php _e('Sold Individually?',PMWI_Plugin::TEXT_DOMAIN);?></p>
|
106 |
+
|
107 |
+
<p class="form-field wpallimport-radio-field">
|
108 |
+
<input type="radio" id="product_sold_individually_yes" class="switcher" name="product_sold_individually" value="yes" <?php echo 'yes' == $post['product_sold_individually'] ? 'checked="checked"': '' ?>/>
|
109 |
+
<label for="product_sold_individually_yes"><?php _e("Yes"); ?></label>
|
110 |
+
</p>
|
111 |
+
<p class="form-field wpallimport-radio-field">
|
112 |
+
<input type="radio" id="product_sold_individually_no" class="switcher" name="product_sold_individually" value="no" <?php echo 'no' == $post['product_sold_individually'] ? 'checked="checked"': '' ?>/>
|
113 |
+
<label for="product_sold_individually_no"><?php _e("No"); ?></label>
|
114 |
+
</p>
|
115 |
+
<div class="form-field wpallimport-radio-field">
|
116 |
+
<input type="radio" id="product_sold_individually_xpath" class="switcher" name="product_sold_individually" value="xpath" <?php echo 'xpath' == $post['product_sold_individually'] ? 'checked="checked"': '' ?>/>
|
117 |
+
<label for="product_sold_individually_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
118 |
+
<span class="wpallimport-clear"></span>
|
119 |
+
<div class="switcher-target-product_sold_individually_xpath set_with_xpath">
|
120 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
121 |
+
<input type="text" class="smaller-text" name="single_product_sold_individually" style="width:300px;" value="<?php echo esc_attr($post['single_product_sold_individually']) ?>"/>
|
122 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
123 |
+
</span>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
</div>
|
views/admin/import/product/_tabs/_linked_product.php
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="linked_product_data" style="display:none;">
|
2 |
+
<?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
|
3 |
+
<div class="woo-add-on-free-edition-notice upgrade_template">
|
4 |
+
<a href="https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=upgrade-notice&utm_campaign=import-variable-wooco-products" target="_blank" class="upgrade_woo_link"><?php _e('Upgrade to the Pro edition of WP All Import and the WooCommerce Add-On to Import to Variable, Affiliate, and Grouped Products', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
5 |
+
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
6 |
+
</div>
|
7 |
+
<?php endif; ?>
|
8 |
+
<div class="options_group">
|
9 |
+
<p class="form-field">
|
10 |
+
<label><?php _e("Up-Sells", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
11 |
+
<input type="text" class="" name="single_product_up_sells" style="" value="<?php echo esc_attr($post['single_product_up_sells']) ?>"/>
|
12 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Products can be matched by SKU, ID, or Title, and must be comma separated.', PMWI_Plugin::TEXT_DOMAIN); ?>">?</a>
|
13 |
+
</p>
|
14 |
+
<p class="form-field">
|
15 |
+
<label><?php _e("Cross-Sells", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
16 |
+
<input type="text" class="" name="single_product_cross_sells" value="<?php echo esc_attr($post['single_product_cross_sells']) ?>"/>
|
17 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Products can be matched by SKU, ID, or Title, and must be comma separated.', PMWI_Plugin::TEXT_DOMAIN); ?>">?</a>
|
18 |
+
</p>
|
19 |
+
</div> <!-- End options group -->
|
20 |
+
<div class="options_group grouping show_if_simple show_if_external show_if_variable">
|
21 |
+
<?php
|
22 |
+
$post_parents = array();
|
23 |
+
$post_parents[''] = __( 'Choose a grouped product…', PMWI_Plugin::TEXT_DOMAIN );
|
24 |
+
|
25 |
+
$posts_in = array_unique( (array) get_objects_in_term( get_term_by( 'slug', 'grouped', 'product_type' )->term_id, 'product_type' ) );
|
26 |
+
if ( sizeof( $posts_in ) > 0 ) {
|
27 |
+
$posts_in = array_slice($posts_in, 0, 100);
|
28 |
+
$args = array(
|
29 |
+
'post_type' => 'product',
|
30 |
+
'post_status' => 'any',
|
31 |
+
'numberposts' => 100,
|
32 |
+
'orderby' => 'title',
|
33 |
+
'order' => 'asc',
|
34 |
+
'post_parent' => 0,
|
35 |
+
'include' => $posts_in,
|
36 |
+
);
|
37 |
+
$grouped_products = get_posts( $args );
|
38 |
+
|
39 |
+
if ( $grouped_products ) {
|
40 |
+
foreach ( $grouped_products as $product ) {
|
41 |
+
$post_parents[ $product->ID ] = $product->post_title;
|
42 |
+
}
|
43 |
+
}
|
44 |
+
}
|
45 |
+
?>
|
46 |
+
|
47 |
+
<div class="form-field wpallimport-radio-field">
|
48 |
+
<input type="radio" id="multiple_grouping_product_yes" class="switcher" name="is_multiple_grouping_product" value="yes" <?php echo 'no' != $post['is_multiple_grouping_product'] ? 'checked="checked"': '' ?>/>
|
49 |
+
<label for="multiple_grouping_product_yes"><?php _e("Grouping", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
50 |
+
<span class="wpallimport-clear"></span>
|
51 |
+
<div class="switcher-target-multiple_grouping_product_yes set_with_xpath">
|
52 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
53 |
+
<select name="multiple_grouping_product">
|
54 |
+
<?php
|
55 |
+
foreach ($post_parents as $parent_id => $parent_title) {
|
56 |
+
?>
|
57 |
+
<option value="<?php echo $parent_id; ?>" <?php if ($parent_id == $post['multiple_grouping_product']):?>selected="selected"<?php endif;?>><?php echo $parent_title;?></option>
|
58 |
+
<?php
|
59 |
+
}
|
60 |
+
?>
|
61 |
+
</select>
|
62 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Set this option to make this product part of a grouped product.', PMWI_Plugin::TEXT_DOMAIN); ?>">?</a>
|
63 |
+
</span>
|
64 |
+
</div>
|
65 |
+
</div>
|
66 |
+
|
67 |
+
<p class="form-field wpallimport-radio-field">
|
68 |
+
<input type="radio" id="multiple_grouping_product_no" class="switcher" name="is_multiple_grouping_product" value="no" <?php echo 'no' == $post['is_multiple_grouping_product'] ? 'checked="checked"': '' ?>/>
|
69 |
+
<label for="multiple_grouping_product_no" style="width: 200px;"><?php _e('Manual Grouped Product Matching', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
70 |
+
<a href="#help" class="wpallimport-help" style="top:2px;" title="<?php _e('Product will be assigned as the child of an already created product matching the specified criteria.', PMWI_Plugin::TEXT_DOMAIN); ?>">?</a>
|
71 |
+
</p>
|
72 |
+
|
73 |
+
<div class="switcher-target-multiple_grouping_product_no set_with_xpath" style="padding-left: 20px;">
|
74 |
+
|
75 |
+
<div class="form-field wpallimport-radio-field">
|
76 |
+
<input type="radio" id="duplicate_indicator_xpath_grouping" class="switcher" name="grouping_indicator" value="xpath" <?php echo 'xpath' == $post['grouping_indicator'] ? 'checked="checked"': '' ?>/>
|
77 |
+
<label for="duplicate_indicator_xpath_grouping"><?php _e('Match by Post Title', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
78 |
+
<span class="wpallimport-clear"></span>
|
79 |
+
<div class="switcher-target-duplicate_indicator_xpath_grouping set_with_xpath" style="vertical-align:middle">
|
80 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
81 |
+
<input type="text" name="single_grouping_product" value="<?php echo esc_attr($post['single_grouping_product']); ?>" style="float:none; margin:1px; " />
|
82 |
+
</span>
|
83 |
+
</div>
|
84 |
+
</div>
|
85 |
+
|
86 |
+
<div class="form-field wpallimport-radio-field">
|
87 |
+
<input type="radio" id="duplicate_indicator_custom_field_grouping" class="switcher" name="grouping_indicator" value="custom field" <?php echo 'custom field' == $post['grouping_indicator'] ? 'checked="checked"': '' ?>/>
|
88 |
+
<label for="duplicate_indicator_custom_field_grouping"><?php _e('Match by Custom Field', PMWI_Plugin::TEXT_DOMAIN )?></label><br>
|
89 |
+
<span class="wpallimport-clear"></span>
|
90 |
+
<div class="switcher-target-duplicate_indicator_custom_field_grouping set_with_xpath" style="padding-left:40px;">
|
91 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
92 |
+
<label style="width: 80px;"><?php _e('Name', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
93 |
+
<input type="text" name="custom_grouping_indicator_name" value="<?php echo esc_attr($post['custom_grouping_indicator_name']) ?>" style="float:none; margin:1px;" />
|
94 |
+
|
95 |
+
<span class="wpallimport-clear"></span>
|
96 |
+
|
97 |
+
<label style="width: 80px;"><?php _e('Value', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
98 |
+
<input type="text" name="custom_grouping_indicator_value" value="<?php echo esc_attr($post['custom_grouping_indicator_value']) ?>" style="float:none; margin:1px;" />
|
99 |
+
</span>
|
100 |
+
</div>
|
101 |
+
</div>
|
102 |
+
</div>
|
103 |
+
|
104 |
+
</div>
|
105 |
+
</div><!-- End Product Panel -->
|
views/admin/import/product/_tabs/_options.php
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="add_on_options" style="display:none;">
|
2 |
+
<?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
|
3 |
+
<div class="woo-add-on-free-edition-notice upgrade_template">
|
4 |
+
<a href="https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=upgrade-notice&utm_campaign=import-variable-wooco-products" target="_blank" class="upgrade_woo_link"><?php _e('Upgrade to the Pro edition of WP All Import and the WooCommerce Add-On to Import to Variable, Affiliate, and Grouped Products', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
5 |
+
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
6 |
+
</div>
|
7 |
+
<?php endif; ?>
|
8 |
+
<p class="form-field"><?php _e('Import options',PMWI_Plugin::TEXT_DOMAIN);?></p>
|
9 |
+
|
10 |
+
<?php if ( "new" == $post['wizard_type']): ?>
|
11 |
+
<div class="options_group hide_if_external">
|
12 |
+
<p class="form-field wpallimport-radio-field">
|
13 |
+
<input type="hidden" name="missing_records_stock_status" value="0" />
|
14 |
+
<input type="checkbox" id="missing_records_stock_status" name="missing_records_stock_status" value="1" <?php echo $post['missing_records_stock_status'] ? 'checked="checked"' : '' ?> />
|
15 |
+
<label for="missing_records_stock_status"><?php _e('Set out of stock status for missing records', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
16 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Option to set the stock status to out of stock instead of deleting the product entirely. This option doesn\'t work when \'Delete missing records\' option is enabled.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:-2px;">?</a>
|
17 |
+
</p>
|
18 |
+
</div>
|
19 |
+
<?php endif; ?>
|
20 |
+
<div class="options_group">
|
21 |
+
<p class="form-field wpallimport-radio-field">
|
22 |
+
<input type="hidden" name="disable_auto_sku_generation" value="0" />
|
23 |
+
<input type="checkbox" id="disable_auto_sku_generation" name="disable_auto_sku_generation" value="1" <?php echo $post['disable_auto_sku_generation'] ? 'checked="checked"' : '' ?> />
|
24 |
+
<label for="disable_auto_sku_generation"><?php _e('Disable auto SKU generation', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
25 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Plugin will NOT automaticaly generate the SKU for each product based on md5 algorithm, if SKU option is empty.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:-2px;">?</a>
|
26 |
+
</p>
|
27 |
+
<p class="form-field wpallimport-radio-field">
|
28 |
+
<input type="hidden" name="disable_sku_matching" value="0" />
|
29 |
+
<input type="checkbox" id="disable_sku_matching" name="disable_sku_matching" value="1" <?php echo $post['disable_sku_matching'] ? 'checked="checked"' : '' ?> />
|
30 |
+
<label for="disable_sku_matching"><?php _e('Don\'t check for duplicate SKUs', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
31 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Each product should have a unique SKU. If this box is checked, WP All Import won\'t check for duplicate SKUs, which speeds up the import process. Make sure the SKU for each of your products is unique. If this box is unchecked, WP All Import will import products with duplicate SKUs with a blank SKU.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:-2px;">?</a>
|
32 |
+
</p>
|
33 |
+
|
34 |
+
</div>
|
35 |
+
</div>
|
views/admin/import/product/_tabs/_shipping.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="shipping_product_data" style="display:none;">
|
2 |
+
<?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
|
3 |
+
<div class="woo-add-on-free-edition-notice upgrade_template">
|
4 |
+
<a href="https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=upgrade-notice&utm_campaign=import-variable-wooco-products" target="_blank" class="upgrade_woo_link"><?php _e('Upgrade to the Pro edition of WP All Import and the WooCommerce Add-On to Import to Variable, Affiliate, and Grouped Products', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
5 |
+
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
6 |
+
</div>
|
7 |
+
<?php endif; ?>
|
8 |
+
<div class="options_group">
|
9 |
+
<p class="form-field">
|
10 |
+
<label><?php printf(__("Weight (%s)", PMWI_Plugin::TEXT_DOMAIN), get_option('woocommerce_weight_unit')); ?></label>
|
11 |
+
<input type="text" class="short" placeholder="0.00" name="single_product_weight" style="" value="<?php echo esc_attr($post['single_product_weight']) ?>"/>
|
12 |
+
</p>
|
13 |
+
<p class="form-field">
|
14 |
+
<label><?php printf(__("Dimensions (%s)", PMWI_Plugin::TEXT_DOMAIN), get_option( 'woocommerce_dimension_unit' )); ?></label>
|
15 |
+
<input type="text" class="short" placeholder="<?php _e('Length',PMWI_Plugin::TEXT_DOMAIN);?>" name="single_product_length" style="margin-right:5px;" value="<?php echo esc_attr($post['single_product_length']) ?>"/>
|
16 |
+
<input type="text" class="short" placeholder="<?php _e('Width',PMWI_Plugin::TEXT_DOMAIN);?>" name="single_product_width" style="margin-right:5px;" value="<?php echo esc_attr($post['single_product_width']) ?>"/>
|
17 |
+
<input type="text" class="short" placeholder="<?php _e('Height',PMWI_Plugin::TEXT_DOMAIN);?>" name="single_product_height" style="" value="<?php echo esc_attr($post['single_product_height']) ?>"/>
|
18 |
+
</p>
|
19 |
+
</div> <!-- End options group -->
|
20 |
+
|
21 |
+
<div class="options_group">
|
22 |
+
|
23 |
+
<div class="form-field wpallimport-radio-field">
|
24 |
+
<input type="radio" id="multiple_product_shipping_class_yes" class="switcher" name="is_multiple_product_shipping_class" value="yes" <?php echo 'no' != $post['is_multiple_product_shipping_class'] ? 'checked="checked"': '' ?>/>
|
25 |
+
<label for="multiple_product_shipping_class_yes"><?php _e("Shipping Class", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
26 |
+
<span class="wpallimport-clear"></span>
|
27 |
+
<div class="switcher-target-multiple_product_shipping_class_yes set_with_xpath">
|
28 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
29 |
+
<?php
|
30 |
+
|
31 |
+
$args = array(
|
32 |
+
'taxonomy' => 'product_shipping_class',
|
33 |
+
'hide_empty' => 0,
|
34 |
+
'show_option_none' => __( 'No shipping class', PMWI_Plugin::TEXT_DOMAIN ),
|
35 |
+
'name' => 'multiple_product_shipping_class',
|
36 |
+
'id' => 'multiple_product_shipping_class',
|
37 |
+
'selected' => ( ! empty($post['multiple_product_shipping_class']) and $post['multiple_product_shipping_class'] > 0 ) ? $post['multiple_product_shipping_class'] : '',
|
38 |
+
'class' => 'select short'
|
39 |
+
);
|
40 |
+
|
41 |
+
wp_dropdown_categories( $args );
|
42 |
+
?>
|
43 |
+
</span>
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
|
47 |
+
<div class="form-field wpallimport-radio-field">
|
48 |
+
<input type="radio" id="multiple_product_shipping_class_no" class="switcher" name="is_multiple_product_shipping_class" value="no" <?php echo 'no' == $post['is_multiple_product_shipping_class'] ? 'checked="checked"': '' ?>/>
|
49 |
+
<label for="multiple_product_shipping_class_no" style="width: 350px;"><?php _e('Set product shipping class with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
50 |
+
<span class="wpallimport-clear"></span>
|
51 |
+
<div class="switcher-target-multiple_product_shipping_class_no set_with_xpath">
|
52 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
53 |
+
<input type="text" class="smaller-text" name="single_product_shipping_class" style="width:300px;" value="<?php echo esc_attr($post['single_product_shipping_class']) ?>"/>
|
54 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Value should be the name, ID, or slug for the shipping class. Default slugs are \'taxable\', \'shipping\' and \'none\'.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
55 |
+
</span>
|
56 |
+
</div>
|
57 |
+
</div>
|
58 |
+
|
59 |
+
</div> <!-- End options group -->
|
60 |
+
</div> <!-- End Product Panel -->
|
views/admin/import/product/_tabs/_variations.php
ADDED
@@ -0,0 +1,879 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="variable_product_options" style="display:none;">
|
2 |
+
<?php if (class_exists('PMWI_Plugin') && PMWI_EDITION == 'free'): ?>
|
3 |
+
<div class="woo-add-on-free-edition-notice upgrade_template">
|
4 |
+
<a href="https://www.wpallimport.com/checkout/?edd_action=purchase_collection&taxonomy=download_category&terms=14&utm_source=import-wooco-products-addon-free&utm_medium=upgrade-notice&utm_campaign=import-variable-wooco-products" target="_blank" class="upgrade_woo_link"><?php _e('Upgrade to the Pro edition of WP All Import and the WooCommerce Add-On to Import to Variable, Affiliate, and Grouped Products', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
5 |
+
<p><?php _e('If you already own it, remove the free edition and install the Pro edition.', 'wp_all_import_plugin'); ?></p>
|
6 |
+
</div>
|
7 |
+
<?php endif; ?>
|
8 |
+
<div class="options_group" style="padding-bottom:0px;">
|
9 |
+
|
10 |
+
<p class="form-field wpallimport-radio-field">
|
11 |
+
<input type="radio" id="auto_matching_parent" class="switcher" name="matching_parent" value="auto" <?php echo 'auto' == $post['matching_parent'] ? 'checked="checked"': '' ?>/>
|
12 |
+
<label for="auto_matching_parent" style="width:95%"><?php _e('All my variable products have SKUs or some other unique identifier. Each variation is linked to its parent with its parent\'s SKU or other unique identifier.', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
13 |
+
</p>
|
14 |
+
<div class="switcher-target-auto_matching_parent" style="padding-left:25px;">
|
15 |
+
<p class="form-field">
|
16 |
+
<label style="width:195px; padding-top:3px;"><?php _e("SKU element for parent", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
17 |
+
<input type="text" class="short" placeholder="" name="single_product_id" value="<?php echo esc_attr($post['single_product_id']) ?>"/>
|
18 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('SKU column in the below example.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative;">?</a>
|
19 |
+
</p>
|
20 |
+
<p class="form-field">
|
21 |
+
<label style="width:195px; padding-top:3px;"><?php _e("Parent SKU element for variation", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
22 |
+
<input type="text" class="short" placeholder="" name="single_product_parent_id" value="<?php echo esc_attr($post['single_product_parent_id']) ?>"/>
|
23 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Parent SKU column in the below example.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative;">?</a>
|
24 |
+
</p>
|
25 |
+
<p class="form-field">
|
26 |
+
<strong><?php _e("Example Data For Use With This Option",PMWI_Plugin::TEXT_DOMAIN);?> </strong> - <a href="http://www.wpallimport.com/wp-content/uploads/2014/10/data-example-1.csv" tatger="_blank"><?php _e("download",PMWI_Plugin::TEXT_DOMAIN);?></a>
|
27 |
+
<span class="wpallimport-clear"></span>
|
28 |
+
<img src="<?php echo PMWI_ROOT_URL; ?>/static/img/data-example-1.png"/>
|
29 |
+
</p>
|
30 |
+
</div>
|
31 |
+
|
32 |
+
<div class="wpallimport-clear" style="margin-top:5px;"></div>
|
33 |
+
|
34 |
+
<p class="form-field wpallimport-radio-field">
|
35 |
+
<input type="radio" id="auto_matching_parent_first_is_parent_id" class="switcher" name="matching_parent" value="first_is_parent_id" <?php echo 'first_is_parent_id' == $post['matching_parent'] ? 'checked="checked"': '' ?> style="float:left;"/>
|
36 |
+
<label for="auto_matching_parent_first_is_parent_id" style="width:95%"><?php _e('All products with variations are grouped with a unique value that is the same for each variation and unique for each product.', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
37 |
+
</p>
|
38 |
+
|
39 |
+
<div class="switcher-target-auto_matching_parent_first_is_parent_id" style="padding-left:25px;">
|
40 |
+
<p class="form-field">
|
41 |
+
<label style="width:105px; padding-top: 3px;"><?php _e("Unique Value", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
42 |
+
<input type="text" class="short" placeholder="" name="single_product_id_first_is_parent_id" value="<?php echo esc_attr($post['single_product_id_first_is_parent_id']) ?>"/>
|
43 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Group ID column in the below example.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative;">?</a>
|
44 |
+
</p>
|
45 |
+
<p class="form-field">
|
46 |
+
<label style="width:105px; padding-top: 3px;"><?php _e("Parent SKU", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
47 |
+
<input type="text" class="short" placeholder="" name="single_product_first_is_parent_id_parent_sku" value="<?php echo esc_attr($post['single_product_first_is_parent_id_parent_sku']) ?>"/>
|
48 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Leave empty to use SKU settings from general tab.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative;">?</a>
|
49 |
+
</p>
|
50 |
+
<p class="form-field">
|
51 |
+
<strong><?php _e("Example Data For Use With This Option",PMWI_Plugin::TEXT_DOMAIN);?> </strong> - <a href="http://www.wpallimport.com/wp-content/uploads/2014/10/data-example-2.csv" tatger="_blank"><?php _e("download",PMWI_Plugin::TEXT_DOMAIN);?></a>
|
52 |
+
<span class="wpallimport-clear"></span>
|
53 |
+
<img src="<?php echo PMWI_ROOT_URL; ?>/static/img/data-example-2.png"/>
|
54 |
+
</p>
|
55 |
+
</div>
|
56 |
+
|
57 |
+
<div class="wpallimport-clear" style="margin-top:5px;"></div>
|
58 |
+
|
59 |
+
<p class="form-field wpallimport-radio-field">
|
60 |
+
<input type="radio" id="auto_matching_parent_first_is_parent_title" class="switcher" name="matching_parent" value="first_is_parent_title" <?php echo 'first_is_parent_title' == $post['matching_parent'] ? 'checked="checked"': '' ?> style="float:left;"/>
|
61 |
+
<label for="auto_matching_parent_first_is_parent_title" style="width:95%"><?php _e('All variations for a particular product have the same title as the parent product.', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
62 |
+
</p>
|
63 |
+
|
64 |
+
<div class="switcher-target-auto_matching_parent_first_is_parent_title" style="padding-left:25px;">
|
65 |
+
<p class="form-field">
|
66 |
+
<label style="width:85px; padding-top: 3px;"><?php _e("Product Title", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
67 |
+
<input type="text" class="short" placeholder="" name="single_product_id_first_is_parent_title" value="<?php echo ($post['single_product_id_first_is_parent_title']) ? esc_attr($post['single_product_id_first_is_parent_title']) : ((!empty(PMXI_Plugin::$session->options['title'])) ? esc_attr(PMXI_Plugin::$session->options['title']) : ''); ?>"/>
|
68 |
+
</p>
|
69 |
+
<p class="form-field">
|
70 |
+
<strong><?php _e("Example Data For Use With This Option",PMWI_Plugin::TEXT_DOMAIN);?> </strong> - <a href="http://www.wpallimport.com/wp-content/uploads/2014/10/data-example-3.csv" tatger="_blank"><?php _e("download",PMWI_Plugin::TEXT_DOMAIN);?></a>
|
71 |
+
<span class="wpallimport-clear"></span>
|
72 |
+
<img src="<?php echo PMWI_ROOT_URL; ?>/static/img/data-example-3.png"/>
|
73 |
+
</p>
|
74 |
+
</div>
|
75 |
+
|
76 |
+
<div class="wpallimport-clear" style="margin-top:5px;"></div>
|
77 |
+
|
78 |
+
<p class="form-field wpallimport-radio-field">
|
79 |
+
<input type="radio" id="auto_matching_parent_first_is_variation" class="switcher" name="matching_parent" value="first_is_variation" <?php echo 'first_is_variation' == $post['matching_parent'] ? 'checked="checked"': '' ?> style="float:left;"/>
|
80 |
+
<label for="auto_matching_parent_first_is_variation" style="width:95%"><?php _e('All variations for a particular product have the same title. There are no parent products.', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
81 |
+
</p>
|
82 |
+
<div class="switcher-target-auto_matching_parent_first_is_variation" style="padding-left:25px;">
|
83 |
+
<p class="form-field">
|
84 |
+
<label style="width:85px; padding-top: 3px;"><?php _e("Product Title"); ?></label>
|
85 |
+
<input type="text" class="short" placeholder="" name="single_product_id_first_is_variation" value="<?php echo ($post['single_product_id_first_is_variation']) ? esc_attr($post['single_product_id_first_is_variation']) : ((!empty(PMXI_Plugin::$session->options['title'])) ? esc_attr(PMXI_Plugin::$session->options['title']) : ''); ?>"/>
|
86 |
+
</p>
|
87 |
+
<p class="form-field">
|
88 |
+
<label style="width:105px; padding-top: 3px;"><?php _e("Parent SKU", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
89 |
+
<input type="text" class="short" placeholder="" name="single_product_first_is_parent_title_parent_sku" value="<?php echo esc_attr($post['single_product_first_is_parent_title_parent_sku']) ?>"/>
|
90 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Leave empty to use SKU settings from general tab.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative;">?</a>
|
91 |
+
</p>
|
92 |
+
<p class="form-field">
|
93 |
+
<strong><?php _e("Example Data For Use With This Option",PMWI_Plugin::TEXT_DOMAIN);?> </strong> - <a href="http://www.wpallimport.com/wp-content/uploads/2014/10/data-example-4.csv" tatger="_blank"><?php _e("download",PMWI_Plugin::TEXT_DOMAIN);?></a>
|
94 |
+
<span class="wpallimport-clear"></span>
|
95 |
+
<img src="<?php echo PMWI_ROOT_URL; ?>/static/img/data-example-4.png"/>
|
96 |
+
</p>
|
97 |
+
</div>
|
98 |
+
|
99 |
+
<div class="wpallimport-clear" style="margin-top:5px;"></div>
|
100 |
+
|
101 |
+
<p class="form-field wpallimport-radio-field">
|
102 |
+
<input type="radio" id="xml_matching_parent" class="switcher" name="matching_parent" value="xml" <?php echo 'xml' == $post['matching_parent'] ? 'checked="checked"': '' ?> style="float:left;"/>
|
103 |
+
<label for="xml_matching_parent" style="width:350px;"><?php _e('I\'m importing XML and my variations are child XML elements', PMWI_Plugin::TEXT_DOMAIN )?> </label>
|
104 |
+
</p>
|
105 |
+
|
106 |
+
<div class="switcher-target-xml_matching_parent" style="padding-left:25px; position:relative;">
|
107 |
+
|
108 |
+
<div class="input">
|
109 |
+
|
110 |
+
<p class="form-field"><a href="http://youtu.be/F1NX4po0dsc" target="_blank"><?php _e("Video Example", PMWI_Plugin::TEXT_DOMAIN);?></a></p>
|
111 |
+
|
112 |
+
<p class="form-field">
|
113 |
+
<label style="width:150px;"><?php _e("Variations XPath", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
114 |
+
<input type="text" class="short" placeholder="" id="variations_xpath" name="variations_xpath" value="<?php echo esc_attr($post['variations_xpath']) ?>" style="width:370px !important;"/> <a href="javascript:void(0);" id="toggle_xml_tree"><?php _e("Open XML Tree",PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
115 |
+
<div class="wpallimport-clear"></div>
|
116 |
+
<span id="variations_console"></span>
|
117 |
+
</p>
|
118 |
+
|
119 |
+
<div style="margin-right:2%;">
|
120 |
+
|
121 |
+
<!--div class="options_group">
|
122 |
+
<p class="form-field wpallimport-radio-field">
|
123 |
+
<label style="border-right:none;" for="_variable_virtual"><?php _e('Virtual', PMWI_Plugin::TEXT_DOMAIN);?> </label>
|
124 |
+
<input type="checkbox" name="_variable_virtual" id="_variable_virtual" style="position:relative; top:2px; margin-left:5px;" <?php echo ($post['_variable_virtual']) ? 'checked="checked"' : ''; ?>>
|
125 |
+
</p>
|
126 |
+
<p class="form-field wpallimport-radio-field">
|
127 |
+
<label for="_variable_downloadable" class="show_if_simple"><?php _e('Downloadable',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
128 |
+
<input type="checkbox" name="_variable_downloadable" id="_variable_downloadable" style="position:relative; top:2px; margin-left:5px;" <?php echo ($post['_variable_downloadable']) ? 'checked="checked"' : ''; ?>>
|
129 |
+
</p>
|
130 |
+
</div-->
|
131 |
+
|
132 |
+
<div class="options_group">
|
133 |
+
<p class="form-field">
|
134 |
+
<label style="width:150px;"><?php _e('SKU',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
135 |
+
<input type="text" value="<?php echo esc_attr($post['variable_sku']) ?>" style="" name="variable_sku" class="short">
|
136 |
+
<span class="use_parent">
|
137 |
+
<input type="hidden" name="variable_sku_add_parent" value="0"/>
|
138 |
+
<input type="checkbox" name="variable_sku_add_parent" id="variable_sku_add_parent" style="margin-left:5px; margin-right:5px;" <?php echo ($post['variable_sku_add_parent']) ? 'checked="checked"' : ''; ?>>
|
139 |
+
<label style="width: 160px;" for="variable_sku_add_parent"><?php _e("Add value to the parent SKU",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
140 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Enable this checkbox to combine SKU from parent and variation products.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
141 |
+
</span>
|
142 |
+
</p>
|
143 |
+
<p class="form-field">
|
144 |
+
<label style="width:150px;"><?php _e('Image',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
145 |
+
<input type="text" value="<?php echo esc_attr($post['variable_image']) ?>" style="" name="variable_image" class="short">
|
146 |
+
<span class="use_parent">
|
147 |
+
<input type="hidden" name="variable_image_use_parent" value="0"/>
|
148 |
+
<input type="checkbox" name="variable_image_use_parent" id="variable_image_use_parent" style="position:relative; top:1px; margin-left:5px; margin-right:5px;" <?php echo ($post['variable_image_use_parent']) ? 'checked="checked"' : ''; ?>>
|
149 |
+
<label for="variable_image_use_parent" style="top:0px;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
150 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Images are imported according to the options set in the Images section below. There you can import images to the parent products, and here you can import images to the product variations.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px; right: 30px;">?</a>
|
151 |
+
</span>
|
152 |
+
</p>
|
153 |
+
<p class="form-field">
|
154 |
+
<label style="width:150px;"><?php _e('Variation Description',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
155 |
+
<input type="text" value="<?php echo esc_attr($post['variable_description']) ?>" style="" name="variable_description" class="short">
|
156 |
+
<span class="use_parent">
|
157 |
+
<input type="hidden" name="variable_description_use_parent" value="0"/>
|
158 |
+
<input type="checkbox" name="variable_description_use_parent" id="variable_description_use_parent" style="position:relative; top:1px; margin-left:5px; margin-right:5px;" <?php echo ($post['variable_description_use_parent']) ? 'checked="checked"' : ''; ?>>
|
159 |
+
<label for="variable_description_use_parent" style="top:0px;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
160 |
+
</span>
|
161 |
+
</p>
|
162 |
+
</div>
|
163 |
+
|
164 |
+
<div class="options_group">
|
165 |
+
<p class="form-field wpallimport-radio-field">
|
166 |
+
<label><?php _e("Manage stock?"); ?></label>
|
167 |
+
</p>
|
168 |
+
<p class="form-field wpallimport-radio-field">
|
169 |
+
<input type="radio" id="is_variable_product_manage_stock_yes" class="switcher" name="is_variable_product_manage_stock" value="yes" <?php echo 'yes' == $post['is_variable_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
170 |
+
<label for="is_variable_product_manage_stock_yes"><?php _e("Yes"); ?></label>
|
171 |
+
</p>
|
172 |
+
<p class="form-field wpallimport-radio-field">
|
173 |
+
<input type="radio" id="is_variable_product_manage_stock_no" class="switcher" name="is_variable_product_manage_stock" value="no" <?php echo 'no' == $post['is_variable_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
174 |
+
<label for="is_variable_product_manage_stock_no"><?php _e("No"); ?></label>
|
175 |
+
</p>
|
176 |
+
<div class="form-field wpallimport-radio-field">
|
177 |
+
<input type="radio" id="is_variable_product_manage_stock_xpath" class="switcher" name="is_variable_product_manage_stock" value="xpath" <?php echo 'xpath' == $post['is_variable_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
178 |
+
<label for="is_variable_product_manage_stock_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
179 |
+
<span class="wpallimport-clear"></span>
|
180 |
+
<div class="switcher-target-is_variable_product_manage_stock_xpath set_with_xpath" style="width:390px;">
|
181 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
182 |
+
<input type="text" class="smaller-text" name="single_variable_product_manage_stock" style="width:345px;" value="<?php echo esc_attr($post['single_variable_product_manage_stock']) ?>"/>
|
183 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
184 |
+
<span class="use_parent" style="float:right; top: 2px;">
|
185 |
+
<input type="hidden" name="single_variable_product_manage_stock_use_parent" value="0"/>
|
186 |
+
<input type="checkbox" name="single_variable_product_manage_stock_use_parent" id="single_variable_product_manage_stock_use_parent" style="position:relative; top:1px; margin-right:5px; float: left;" <?php echo ($post['single_variable_product_manage_stock_use_parent']) ? 'checked="checked"' : ''; ?>>
|
187 |
+
<label for="single_variable_product_manage_stock_use_parent" style="top:3px;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
188 |
+
</span>
|
189 |
+
</span>
|
190 |
+
</div>
|
191 |
+
</div>
|
192 |
+
</div>
|
193 |
+
|
194 |
+
<div class="options_group variable_stock_fields">
|
195 |
+
<p class="form-field">
|
196 |
+
<label style="width:150px;"><?php _e('Stock Qty', PMWI_Plugin::TEXT_DOMAIN);?></label>
|
197 |
+
<input type="text" value="<?php echo esc_attr($post['variable_stock']) ?>" style="" name="variable_stock" class="short">
|
198 |
+
<span class="use_parent">
|
199 |
+
<input type="hidden" name="variable_stock_use_parent" value="0"/>
|
200 |
+
<input type="checkbox" name="variable_stock_use_parent" id="variable_stock_use_parent" style="margin-left:5px; margin-right: 5px;" <?php echo ($post['variable_stock_use_parent']) ? 'checked="checked"' : ''; ?>>
|
201 |
+
<label for="variable_stock_use_parent" style="width:120px;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
202 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Enable this checkbox to determine XPath from parent element.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
203 |
+
</span>
|
204 |
+
</p>
|
205 |
+
</div>
|
206 |
+
|
207 |
+
<div class="options_group">
|
208 |
+
<p class="form-field wpallimport-radio-field">
|
209 |
+
<label><?php _e("Stock status"); ?></label>
|
210 |
+
</p>
|
211 |
+
<p class="form-field wpallimport-radio-field">
|
212 |
+
<input type="radio" id="variable_stock_status_in_stock" class="switcher" name="variable_stock_status" value="instock" <?php echo 'instock' == $post['variable_stock_status'] ? 'checked="checked"': '' ?>/>
|
213 |
+
<label for="variable_stock_status_in_stock"><?php _e("In stock"); ?></label>
|
214 |
+
</p>
|
215 |
+
<p class="form-field wpallimport-radio-field">
|
216 |
+
<input type="radio" id="variable_stock_status_out_of_stock" class="switcher" name="variable_stock_status" value="outofstock" <?php echo 'outofstock' == $post['variable_stock_status'] ? 'checked="checked"': '' ?>/>
|
217 |
+
<label for="variable_stock_status_out_of_stock"><?php _e("Out of stock"); ?></label>
|
218 |
+
</p>
|
219 |
+
<p class="form-field wpallimport-radio-field">
|
220 |
+
<input type="radio" id="variable_stock_status_auto" class="switcher" name="variable_stock_status" value="auto" <?php echo 'auto' == $post['variable_stock_status'] ? 'checked="checked"': '' ?>/>
|
221 |
+
<label for="variable_stock_status_auto" style="width:100px;"><?php _e("Set automatically"); ?></label>
|
222 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Set the stock status to In Stock for positive or blank Stock Qty values, and Out Of Stock if Stock Qty is 0.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:3px;">?</a>
|
223 |
+
</p>
|
224 |
+
<div class="form-field wpallimport-radio-field">
|
225 |
+
<input type="radio" id="variable_stock_status_xpath" class="switcher" name="variable_stock_status" value="xpath" <?php echo 'xpath' == $post['variable_stock_status'] ? 'checked="checked"': '' ?>/>
|
226 |
+
<label for="variable_stock_status_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
227 |
+
<span class="wpallimport-clear"></span>
|
228 |
+
<div class="switcher-target-variable_stock_status_xpath set_with_xpath" style="width:390px;">
|
229 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
230 |
+
<input type="text" class="smaller-text" name="single_variable_stock_status" style="width:345px;" value="<?php echo esc_attr($post['single_variable_stock_status']) ?>"/>
|
231 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'instock\', \'outofstock\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
232 |
+
</span>
|
233 |
+
</div>
|
234 |
+
</div>
|
235 |
+
</div>
|
236 |
+
|
237 |
+
<div class="options_group">
|
238 |
+
<p class="form-field wpallimport-radio-field">
|
239 |
+
<label><?php _e("Allow Backorders?"); ?></label>
|
240 |
+
</p>
|
241 |
+
<p class="form-field wpallimport-radio-field">
|
242 |
+
<input type="radio" id="variable_allow_backorders_no" class="switcher" name="variable_allow_backorders" value="no" <?php echo 'no' == $post['variable_allow_backorders'] ? 'checked="checked"': '' ?>/>
|
243 |
+
<label for="variable_allow_backorders_no"><?php _e("Do not allow"); ?></label>
|
244 |
+
</p>
|
245 |
+
<p class="form-field wpallimport-radio-field">
|
246 |
+
<input type="radio" id="variable_allow_backorders_notify" class="switcher" name="variable_allow_backorders" value="notify" <?php echo 'notify' == $post['variable_allow_backorders'] ? 'checked="checked"': '' ?>/>
|
247 |
+
<label for="variable_allow_backorders_notify"><?php _e("Allow, but notify customer"); ?></label>
|
248 |
+
</p>
|
249 |
+
<p class="form-field wpallimport-radio-field">
|
250 |
+
<input type="radio" id="variable_allow_backorders_yes" class="switcher" name="variable_allow_backorders" value="yes" <?php echo 'yes' == $post['variable_allow_backorders'] ? 'checked="checked"': '' ?>/>
|
251 |
+
<label for="variable_allow_backorders_yes" style="width:100px;"><?php _e("Allow"); ?></label>
|
252 |
+
</p>
|
253 |
+
<div class="form-field wpallimport-radio-field">
|
254 |
+
<input type="radio" id="variable_allow_backorders_xpath" class="switcher" name="variable_allow_backorders" value="xpath" <?php echo 'xpath' == $post['variable_allow_backorders'] ? 'checked="checked"': '' ?>/>
|
255 |
+
<label for="variable_allow_backorders_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
256 |
+
<span class="wpallimport-clear"></span>
|
257 |
+
<div class="switcher-target-variable_allow_backorders_xpath set_with_xpath" style="width:390px;">
|
258 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
259 |
+
<input type="text" class="smaller-text" name="single_variable_allow_backorders" style="width:345px;" value="<?php echo esc_attr($post['single_variable_allow_backorders']) ?>"/>
|
260 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'no\', \'notify\', \'yes\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
261 |
+
</span>
|
262 |
+
</div>
|
263 |
+
</div>
|
264 |
+
</div>
|
265 |
+
|
266 |
+
<div class="options_group">
|
267 |
+
<p class="form-field">
|
268 |
+
<label style="width:150px;"><?php _e('Regular Price',PMWI_Plugin::TEXT_DOMAIN);?> (<?php echo get_woocommerce_currency_symbol(); ?>)</label>
|
269 |
+
<input type="text" value="<?php echo esc_attr($post['variable_regular_price']) ?>" style="" name="variable_regular_price" class="short">
|
270 |
+
<span class="use_parent">
|
271 |
+
<input type="hidden" name="variable_regular_price_use_parent" value="0"/>
|
272 |
+
<input type="checkbox" name="variable_regular_price_use_parent" id="variable_regular_price_use_parent" style="position:relative; top:1px; margin-left:5px; margin-right:5px;" <?php echo ($post['variable_regular_price_use_parent']) ? 'checked="checked"' : ''; ?>>
|
273 |
+
<label for="variable_regular_price_use_parent" style="top:1px; position: relative;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
274 |
+
</span>
|
275 |
+
</p>
|
276 |
+
<p class="form-field">
|
277 |
+
<label style="width:150px;"><?php _e('Sale Price',PMWI_Plugin::TEXT_DOMAIN);?> (<?php echo get_woocommerce_currency_symbol(); ?>)</label>
|
278 |
+
<a id="variable_sale_price_shedule" href="javascript:void(0);" style="<?php if ($post['is_variable_sale_price_shedule']):?>display:none;<?php endif; ?>position:relative; top:-10px;"><?php _e('schedule');?></a>
|
279 |
+
<input type="text" value="<?php echo esc_attr($post['variable_sale_price']) ?>" style="" name="variable_sale_price" class="short">
|
280 |
+
<input type="hidden" name="is_variable_sale_price_shedule" value="<?php echo esc_attr($post['is_variable_sale_price_shedule']) ?>"/>
|
281 |
+
<span class="use_parent">
|
282 |
+
<input type="hidden" name="variable_sale_price_use_parent" value="0"/>
|
283 |
+
<input type="checkbox" name="variable_sale_price_use_parent" id="variable_sale_price_use_parent" style="position:relative; top:1px; margin-right:5px;" <?php echo ($post['variable_sale_price_use_parent']) ? 'checked="checked"' : ''; ?>>
|
284 |
+
<label for="variable_sale_price_use_parent"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
285 |
+
</span>
|
286 |
+
</p>
|
287 |
+
<?php if ( class_exists('woocommerce_wholesale_pricing') ):?>
|
288 |
+
<p class="form-field">
|
289 |
+
<label style="width:150px;"><?php _e("Wholesale Price (".get_woocommerce_currency_symbol().")"); ?></label>
|
290 |
+
<input type="text" class="short" name="variable_whosale_price" value="<?php echo esc_attr($post['variable_whosale_price']) ?>"/>
|
291 |
+
<span class="use_parent">
|
292 |
+
<input type="hidden" name="variable_whosale_price_use_parent" value="0"/>
|
293 |
+
<input type="checkbox" name="variable_whosale_price_use_parent" id="variable_whosale_price_use_parent" style="position:relative; top:1px; margin-left:5px; margin-right:5px;" <?php echo ($post['variable_whosale_price_use_parent']) ? 'checked="checked"' : ''; ?>>
|
294 |
+
<label for="variable_whosale_price_use_parent"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
295 |
+
</span>
|
296 |
+
</p>
|
297 |
+
<?php endif; ?>
|
298 |
+
</div>
|
299 |
+
|
300 |
+
<div class="options_group" <?php if ( ! $post['is_variable_sale_price_shedule']):?>style="display:none;"<?php endif; ?> id="variable_sale_price_range">
|
301 |
+
<p class="form-field">
|
302 |
+
<span style="vertical-align:middle">
|
303 |
+
<label style="width:150px;"><?php _e("Variable Sale Price Dates", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
304 |
+
<span class="use_parent">
|
305 |
+
<input type="hidden" name="variable_sale_dates_use_parent" value="0"/>
|
306 |
+
<input type="checkbox" name="variable_sale_dates_use_parent" id="variable_sale_dates_use_parent" style="position:relative; top:1px; margin-left:5px; margin-right:5px;" <?php echo ($post['variable_sale_dates_use_parent']) ? 'checked="checked"' : ''; ?>>
|
307 |
+
<label for="variable_sale_dates_use_parent"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
308 |
+
</span>
|
309 |
+
<br>
|
310 |
+
<input type="text" class="datepicker" name="variable_sale_price_dates_from" value="<?php echo esc_attr($post['variable_sale_price_dates_from']) ?>" style="float:none;"/>
|
311 |
+
<?php _e('and', PMWI_Plugin::TEXT_DOMAIN) ?>
|
312 |
+
<input type="text" class="datepicker" name="variable_sale_price_dates_to" value="<?php echo esc_attr($post['variable_sale_price_dates_to']) ?>" style="float:none;"/>
|
313 |
+
<a id="cancel_variable_regular_price_shedule" href="javascript:void(0);"><?php _e('cancel');?></a>
|
314 |
+
</span>
|
315 |
+
</p>
|
316 |
+
</div>
|
317 |
+
|
318 |
+
<div class="options_group" id="variable_virtual">
|
319 |
+
|
320 |
+
<p class="form-field wpallimport-radio-field">
|
321 |
+
<input type="radio" id="is_variable_product_virtual_yes" class="switcher" name="is_variable_product_virtual" value="yes" <?php echo 'yes' == $post['is_variable_product_virtual'] ? 'checked="checked"': '' ?>/>
|
322 |
+
<label for="is_variable_product_virtual_yes"><?php _e("Virtual"); ?></label>
|
323 |
+
</p>
|
324 |
+
<p class="form-field wpallimport-radio-field">
|
325 |
+
<input type="radio" id="is_variable_product_virtual_no" class="switcher" name="is_variable_product_virtual" value="no" <?php echo 'no' == $post['is_variable_product_virtual'] ? 'checked="checked"': '' ?>/>
|
326 |
+
<label for="is_variable_product_virtual_no"><?php _e("Not Virtual"); ?></label>
|
327 |
+
</p>
|
328 |
+
<div class="form-field wpallimport-radio-field">
|
329 |
+
<input type="radio" id="is_variable_product_virtual_xpath" class="switcher" name="is_variable_product_virtual" value="xpath" <?php echo 'xpath' == $post['is_variable_product_virtual'] ? 'checked="checked"': '' ?>/>
|
330 |
+
<label for="is_variable_product_virtual_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
331 |
+
<span class="wpallimport-clear"></span>
|
332 |
+
<div class="switcher-target-is_variable_product_virtual_xpath set_with_xpath" style="width:390px;">
|
333 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
334 |
+
<input type="text" class="smaller-text" name="single_variable_product_virtual" style="width:300px;" value="<?php echo esc_attr($post['single_variable_product_virtual']) ?>"/>
|
335 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
336 |
+
<span class="use_parent" style="float:right; top: 2px;">
|
337 |
+
<input type="hidden" name="single_variable_product_virtual_use_parent" value="0"/>
|
338 |
+
<input type="checkbox" name="single_variable_product_virtual_use_parent" id="single_variable_product_virtual_use_parent" style="position:relative; top:1px; margin-right:5px; float: left;" <?php echo ($post['single_variable_product_virtual_use_parent']) ? 'checked="checked"' : ''; ?>>
|
339 |
+
<label for="single_variable_product_virtual_use_parent" style="top:3px;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
340 |
+
</span>
|
341 |
+
</span>
|
342 |
+
</div>
|
343 |
+
</div>
|
344 |
+
</div>
|
345 |
+
|
346 |
+
<div class="options_group" id="variable_dimensions">
|
347 |
+
<p class="form-field">
|
348 |
+
<label style="width:150px;"><?php _e('Weight',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
349 |
+
<input type="text" placeholder="0.00" value="<?php echo esc_attr($post['variable_weight']) ?>" style="" name="variable_weight" class="short">
|
350 |
+
<span class="use_parent">
|
351 |
+
<input type="hidden" name="variable_weight_use_parent" value="0"/>
|
352 |
+
<input type="checkbox" name="variable_weight_use_parent" id="variable_weight_use_parent" style="position:relative; top:1px; margin-left:5px; margin-right:5px;" <?php echo ($post['variable_weight_use_parent']) ? 'checked="checked"' : ''; ?>>
|
353 |
+
<label for="variable_weight_use_parent"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
354 |
+
</span>
|
355 |
+
</p>
|
356 |
+
<p class="form-field">
|
357 |
+
<label for"product_length"=""><?php _e('Dimensions (L×W×H)',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
358 |
+
<span class="use_parent">
|
359 |
+
<input type="hidden" name="variable_dimensions_use_parent" value="0"/>
|
360 |
+
<input type="checkbox" name="variable_dimensions_use_parent" id="variable_dimensions_use_parent" style="position:relative; top:1px; margin-left:5px; margin-right:5px;" <?php echo ($post['variable_dimensions_use_parent']) ? 'checked="checked"' : ''; ?>>
|
361 |
+
<label for="variable_dimensions_use_parent"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
362 |
+
</span>
|
363 |
+
<br>
|
364 |
+
<input type="text" placeholder="0" value="<?php echo esc_attr($post['variable_length']) ?>" name="variable_length" class="short" style="margin-right:5px;">
|
365 |
+
<input type="text" placeholder="0" value="<?php echo esc_attr($post['variable_width']) ?>" name="variable_width" class="short" style="margin-right:5px;">
|
366 |
+
<input type="text" placeholder="0" value="<?php echo esc_attr($post['variable_height']) ?>" style="" name="variable_height" class="short">
|
367 |
+
</p>
|
368 |
+
</div>
|
369 |
+
|
370 |
+
<div class="options_group">
|
371 |
+
|
372 |
+
<!-- Shipping class -->
|
373 |
+
<div class="form-field wpallimport-radio-field">
|
374 |
+
<input type="radio" id="multiple_variable_product_shipping_class_yes" class="switcher" name="is_multiple_variable_product_shipping_class" value="yes" <?php echo 'no' != $post['is_multiple_variable_product_shipping_class'] ? 'checked="checked"': '' ?>/>
|
375 |
+
<label for="multiple_variable_product_shipping_class_yes" style="width:150px;"><?php _e("Shipping Class"); ?></label>
|
376 |
+
<span class="wpallimport-clear"></span>
|
377 |
+
<div class="switcher-target-multiple_variable_product_shipping_class_yes set_with_xpath">
|
378 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
379 |
+
<?php
|
380 |
+
$classes = get_the_terms( 0, 'product_shipping_class' );
|
381 |
+
if ( $classes && ! is_wp_error( $classes ) ) $current_shipping_class = current($classes)->term_id; else $current_shipping_class = '';
|
382 |
+
|
383 |
+
$args = array(
|
384 |
+
'taxonomy' => 'product_shipping_class',
|
385 |
+
'hide_empty' => 0,
|
386 |
+
'show_option_none' => __( 'No shipping class', PMWI_Plugin::TEXT_DOMAIN ),
|
387 |
+
'name' => 'multiple_variable_product_shipping_class',
|
388 |
+
'id' => 'multiple_variable_product_shipping_class',
|
389 |
+
'selected' => (!empty($post['multiple_variable_product_shipping_class'])) ? $post['multiple_variable_product_shipping_class'] : $current_shipping_class,
|
390 |
+
'class' => 'select short'
|
391 |
+
);
|
392 |
+
|
393 |
+
wp_dropdown_categories( $args );
|
394 |
+
?>
|
395 |
+
</span>
|
396 |
+
</div>
|
397 |
+
</div>
|
398 |
+
<!-- Shipping class -->
|
399 |
+
<div class="form-field wpallimport-radio-field">
|
400 |
+
<input type="radio" id="multiple_variable_product_shipping_class_no" class="switcher" name="is_multiple_variable_product_shipping_class" value="no" <?php echo 'no' == $post['is_multiple_variable_product_shipping_class'] ? 'checked="checked"': '' ?>/>
|
401 |
+
<label for="multiple_variable_product_shipping_class_no" style="width:300px;"><?php _e('Set product shipping class with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
402 |
+
<span class="wpallimport-clear"></span>
|
403 |
+
<div class="switcher-target-multiple_variable_product_shipping_class_no set_with_xpath">
|
404 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
405 |
+
<input type="text" class="smaller-text" name="single_variable_product_shipping_class" style="width:300px;" value="<?php echo esc_attr($post['single_variable_product_shipping_class']) ?>"/>
|
406 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'taxable\', \'shipping\', \'none\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position: relative; top: -10px;">?</a>
|
407 |
+
<span class="use_parent">
|
408 |
+
<input type="hidden" name="single_variable_product_shipping_class_use_parent" value="0"/>
|
409 |
+
<input type="checkbox" name="single_variable_product_shipping_class_use_parent" id="single_variable_product_shipping_class_use_parent" style="position:relative; top:2px; margin-left:5px; margin-right:5px;" <?php echo ($post['single_variable_product_shipping_class_use_parent']) ? 'checked="checked"' : ''; ?>>
|
410 |
+
<label for="single_variable_product_shipping_class_use_parent" style="top:2px; position: relative;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
411 |
+
</span>
|
412 |
+
</span>
|
413 |
+
</div>
|
414 |
+
</div>
|
415 |
+
</div>
|
416 |
+
|
417 |
+
<div class="options_group">
|
418 |
+
<!-- Tax class -->
|
419 |
+
<div class="form-field wpallimport-radio-field">
|
420 |
+
<input type="radio" id="multiple_variable_product_tax_class_yes" class="switcher" name="is_multiple_variable_product_tax_class" value="yes" <?php echo 'no' != $post['is_multiple_variable_product_tax_class'] ? 'checked="checked"': '' ?>/>
|
421 |
+
<label for="multiple_variable_product_tax_class_yes" style="width:150px;"><?php _e("Tax Class", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
422 |
+
<span class="wpallimport-clear"></span>
|
423 |
+
<div class="switcher-target-multiple_variable_product_tax_class_yes set_with_xpath">
|
424 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
425 |
+
<?php
|
426 |
+
$tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) );
|
427 |
+
$classes_options = array();
|
428 |
+
$classes_options[''] = __( 'Standard', PMWI_Plugin::TEXT_DOMAIN );
|
429 |
+
if ( $tax_classes )
|
430 |
+
foreach ( $tax_classes as $class )
|
431 |
+
$classes_options[ sanitize_title( $class ) ] = esc_html( $class );
|
432 |
+
?>
|
433 |
+
<select class="select short" name="multiple_variable_product_tax_class">
|
434 |
+
<option value="parent" <?php echo 'parent' == $post['multiple_variable_product_tax_class'] ? 'selected="selected"': '' ?>><?php _e('Same as parent', PMWI_Plugin::TEXT_DOMAIN);?></option>
|
435 |
+
<?php foreach ($classes_options as $key => $value):?>
|
436 |
+
<option value="<?php echo $key; ?>" <?php echo $key == $post['multiple_variable_product_tax_class'] ? 'selected="selected"': '' ?>><?php echo $value; ?></option>
|
437 |
+
<?php endforeach; ?>
|
438 |
+
</select>
|
439 |
+
</span>
|
440 |
+
</div>
|
441 |
+
</div>
|
442 |
+
<!-- Tax class -->
|
443 |
+
<div class="form-field wpallimport-radio-field">
|
444 |
+
<input type="radio" id="multiple_variable_product_tax_class_no" class="switcher" name="is_multiple_variable_product_tax_class" value="no" <?php echo 'no' == $post['is_multiple_variable_product_tax_class'] ? 'checked="checked"': '' ?>/>
|
445 |
+
<label for="multiple_variable_product_tax_class_no" style="width: 300px;"><?php _e('Set product tax class with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
446 |
+
<span class="wpallimport-clear"></span>
|
447 |
+
<div class="switcher-target-multiple_variable_product_tax_class_no set_with_xpath">
|
448 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
449 |
+
<input type="text" class="smaller-text" name="single_variable_product_tax_class" style="width:300px;" value="<?php echo esc_attr($post['single_variable_product_tax_class']) ?>"/>
|
450 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'reduced-rate\', \'zero-rate\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position: relative; top:-10px;">?</a>
|
451 |
+
<span class="use_parent">
|
452 |
+
<input type="hidden" name="single_variable_product_tax_class_use_parent" value="0"/>
|
453 |
+
<input type="checkbox" name="single_variable_product_tax_class_use_parent" id="single_variable_product_tax_class_use_parent" style="position:relative; top:2px; margin-left:5px; margin-right:5px;" <?php echo ($post['single_variable_product_tax_class_use_parent']) ? 'checked="checked"' : ''; ?>>
|
454 |
+
<label for="single_variable_product_tax_class_use_parent" style="top:1px; position: relative;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
455 |
+
</span>
|
456 |
+
</span>
|
457 |
+
</div>
|
458 |
+
</div>
|
459 |
+
|
460 |
+
</div>
|
461 |
+
|
462 |
+
<!-- Downloadable -->
|
463 |
+
<div class="options_group">
|
464 |
+
<p class="form-field wpallimport-radio-field">
|
465 |
+
<input type="radio" id="is_variable_product_downloadable_yes" class="switcher" name="is_variable_product_downloadable" value="yes" <?php echo 'yes' == $post['is_variable_product_downloadable'] ? 'checked="checked"': '' ?>/>
|
466 |
+
<label for="is_variable_product_downloadable_yes"><?php _e("Downloadable"); ?></label>
|
467 |
+
</p>
|
468 |
+
<p class="form-field wpallimport-radio-field">
|
469 |
+
<input type="radio" id="is_variable_product_downloadable_no" class="switcher" name="is_variable_product_downloadable" value="no" <?php echo 'no' == $post['is_variable_product_downloadable'] ? 'checked="checked"': '' ?>/>
|
470 |
+
<label for="is_variable_product_downloadable_no"><?php _e("Not Downloadable"); ?></label>
|
471 |
+
</p>
|
472 |
+
<div class="form-field wpallimport-radio-field">
|
473 |
+
<input type="radio" id="is_variable_product_downloadable_xpath" class="switcher" name="is_variable_product_downloadable" value="xpath" <?php echo 'xpath' == $post['is_variable_product_downloadable'] ? 'checked="checked"': '' ?>/>
|
474 |
+
<label for="is_variable_product_downloadable_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
475 |
+
<span class="wpallimport-clear"></span>
|
476 |
+
<div class="switcher-target-is_variable_product_downloadable_xpath set_with_xpath" style="width:390px;">
|
477 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
478 |
+
<input type="text" class="smaller-text" name="single_variable_product_downloadable" style="width:345px;" value="<?php echo esc_attr($post['single_variable_product_downloadable']) ?>"/>
|
479 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
480 |
+
<span class="use_parent" style="float:right; top: 2px;">
|
481 |
+
<input type="hidden" name="single_variable_product_downloadable_use_parent" value="0"/>
|
482 |
+
<input type="checkbox" name="single_variable_product_downloadable_use_parent" id="single_variable_product_downloadable_use_parent" style="position:relative; top:1px; margin-right:5px; float: left;" <?php echo ($post['single_variable_product_downloadable_use_parent']) ? 'checked="checked"' : ''; ?>>
|
483 |
+
<label for="single_variable_product_downloadable_use_parent" style="top:3px;"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
484 |
+
</span>
|
485 |
+
</span>
|
486 |
+
</div>
|
487 |
+
</div>
|
488 |
+
</div>
|
489 |
+
|
490 |
+
<div class="options_group variable_downloadable">
|
491 |
+
<p class="form-field">
|
492 |
+
<label style="width:150px;"><?php _e('File paths',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
493 |
+
<input type="text" value="<?php echo esc_attr($post['variable_file_paths']) ?>" name="variable_file_paths" class="short" style="width:60% !important;">
|
494 |
+
<input type="text" class="small" name="variable_product_files_delim" value="<?php echo esc_attr($post['variable_product_files_delim']) ?>" style="width:5% !important;text-align:center; margin-left:5px;"/>
|
495 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('File paths/URLs, comma separated. The delimiter option uses when xml element contains few paths/URLs (http://files.com/1.doc, http://files.com/2.doc).', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
496 |
+
</p>
|
497 |
+
<p class="form-field">
|
498 |
+
<label style="width:150px;"><?php _e("File names"); ?></label>
|
499 |
+
<input type="text" class="short" name="variable_file_names" value="<?php echo esc_attr($post['variable_file_names']) ?>" style="width:60% !important;"/>
|
500 |
+
<input type="text" class="small" name="variable_product_files_names_delim" value="<?php echo esc_attr($post['variable_product_files_names_delim']) ?>" style="width:5% !important;text-align:center; margin-left:5px;"/>
|
501 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('File names, comma separated. The delimiter is used when an XML element contains multiple names - i.e. <code>1.doc, 2.doc</code>.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
502 |
+
</p>
|
503 |
+
<p class="form-field">
|
504 |
+
<label style="width:150px;"><?php _e('Download Limit',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
505 |
+
<input type="text" value="<?php echo esc_attr($post['variable_download_limit']) ?>" style="" name="variable_download_limit" class="short">
|
506 |
+
<span class="use_parent">
|
507 |
+
<input type="hidden" name="variable_download_limit_use_parent" value="0"/>
|
508 |
+
<input type="checkbox" name="variable_download_limit_use_parent" id="variable_download_limit_use_parent" style="margin-left:5px; margin-right:5px;" <?php echo ($post['variable_download_limit_use_parent']) ? 'checked="checked"' : ''; ?>>
|
509 |
+
<label for="variable_download_limit_use_parent"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN);?></label>
|
510 |
+
</span>
|
511 |
+
</p>
|
512 |
+
<p class="form-field">
|
513 |
+
<label style="width:150px;"><?php _e('Download Expiry',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
514 |
+
<input type="text" value="<?php echo esc_attr($post['variable_download_expiry']) ?>" style="" name="variable_download_expiry" class="short">
|
515 |
+
<span class="use_parent">
|
516 |
+
<input type="hidden" name="variable_download_expiry_use_parent" value="0"/>
|
517 |
+
<input type="checkbox" name="variable_download_expiry_use_parent" id="variable_download_expiry_use_parent" style="margin-left:5px; margin-right:5px;" <?php echo ($post['variable_download_expiry_use_parent']) ? 'checked="checked"' : ''; ?>>
|
518 |
+
<label for="variable_download_expiry_use_parent"><?php _e("XPath Is From Parent",PMWI_Plugin::TEXT_DOMAIN);?></label>
|
519 |
+
</span>
|
520 |
+
</p>
|
521 |
+
</div>
|
522 |
+
|
523 |
+
<div class="options_group">
|
524 |
+
|
525 |
+
<label style="width:150px; padding-left:0px;"><?php _e('Variation Enabled',PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
526 |
+
|
527 |
+
<span class="wpallimport-clear"></span>
|
528 |
+
|
529 |
+
<p class="form-field wpallimport-radio-field">
|
530 |
+
<input type="radio" id="variable_product_enabled_yes" class="switcher" name="is_variable_product_enabled" value="yes" <?php echo 'yes' == $post['is_variable_product_enabled'] ? 'checked="checked"': '' ?>/>
|
531 |
+
<label for="variable_product_enabled_yes"><?php _e("Yes"); ?></label>
|
532 |
+
</p>
|
533 |
+
<p class="form-field wpallimport-radio-field">
|
534 |
+
<input type="radio" id="variable_product_enabled_no" class="switcher" name="is_variable_product_enabled" value="no" <?php echo 'no' == $post['is_variable_product_enabled'] ? 'checked="checked"': '' ?>/>
|
535 |
+
<label for="variable_product_enabled_no"><?php _e("No"); ?></label>
|
536 |
+
</p>
|
537 |
+
<div class="form-field wpallimport-radio-field">
|
538 |
+
<input type="radio" id="variable_product_enabled_xpath" class="switcher" name="is_variable_product_enabled" value="xpath" <?php echo 'xpath' == $post['is_variable_product_enabled'] ? 'checked="checked"': '' ?>/>
|
539 |
+
<label for="variable_product_enabled_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
540 |
+
<span class="wpallimport-clear"></span>
|
541 |
+
<div class="switcher-target-variable_product_enabled_xpath set_with_xpath">
|
542 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
543 |
+
<input type="text" class="smaller-text" name="single_variable_product_enabled" style="width:300px; " value="<?php echo esc_attr($post['single_variable_product_enabled']) ?>"/>
|
544 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
545 |
+
</span>
|
546 |
+
</div>
|
547 |
+
</div>
|
548 |
+
|
549 |
+
</div>
|
550 |
+
|
551 |
+
<div class="options_group variation_attributes">
|
552 |
+
|
553 |
+
<label style="width:150px; padding-left:0px;"><?php _e('Variation Attributes',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
554 |
+
|
555 |
+
<span class="wpallimport-clear"></span>
|
556 |
+
|
557 |
+
<div class="input">
|
558 |
+
<table id="variation_attributes_table" class="form-table custom-params" style="max-width:95%;">
|
559 |
+
<thead>
|
560 |
+
<tr>
|
561 |
+
<td><?php _e('Name', PMWI_Plugin::TEXT_DOMAIN) ?></td>
|
562 |
+
<td><?php _e('Values', PMWI_Plugin::TEXT_DOMAIN) ?></td>
|
563 |
+
<td></td>
|
564 |
+
</tr>
|
565 |
+
</thead>
|
566 |
+
<tbody>
|
567 |
+
<?php if ( ! empty($post['variable_attribute_name'][0])):?>
|
568 |
+
<?php foreach ($post['variable_attribute_name'] as $i => $name): if ("" == $name) continue; ?>
|
569 |
+
<tr class="form-field">
|
570 |
+
<td style="width: 50%;">
|
571 |
+
<div class="drag-attribute">
|
572 |
+
<input type="text" class="widefat" name="variable_attribute_name[]" value="<?php echo esc_attr($name) ?>" style="width:95% !important;"/>
|
573 |
+
</div>
|
574 |
+
</td>
|
575 |
+
<td style="width: 50%;">
|
576 |
+
<input type="text" class="widefat" name="variable_attribute_value[]" value="<?php echo esc_attr($post['variable_attribute_value'][$i]); ?>" style="width: 100% !important;"/>
|
577 |
+
|
578 |
+
<span class="wpallimport-clear"></span>
|
579 |
+
<p class="form-field wpallimport-radio-field" style="padding: 0 !important; position: relative; left: -100%; width: 200%;">
|
580 |
+
<span class='in_variations' style="margin-left:0px;">
|
581 |
+
<input type="checkbox" name="variable_in_variations[]" id="variable_in_variations_<?php echo $i; ?>" <?php echo ($post['variable_in_variations'][$i]) ? 'checked="checked"' : ''; ?> style="float:left;" value="1"/>
|
582 |
+
<label for="variable_in_variations_<?php echo $i; ?>"><?php _e('In Variations',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
583 |
+
</span>
|
584 |
+
|
585 |
+
<span class='is_visible'>
|
586 |
+
<input type="checkbox" name="variable_is_visible[]" id="variable_is_visible_<?php echo $i; ?>" <?php echo ($post['variable_is_visible'][$i]) ? 'checked="checked"' : ''; ?> style="float: left;" value="1"/>
|
587 |
+
<label for="variable_is_visible_<?php echo $i; ?>"><?php _e('Is Visible',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
588 |
+
</span>
|
589 |
+
|
590 |
+
<span class='is_taxonomy'>
|
591 |
+
<input type="checkbox" name="variable_is_taxonomy[]" id="variable_is_taxonomy_<?php echo $i; ?>" <?php echo ($post['variable_is_taxonomy'][$i]) ? 'checked="checked"' : ''; ?> style="float: left;" value="1"/>
|
592 |
+
<label for="variable_is_taxonomy_<?php echo $i; ?>"><?php _e('Taxonomy',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
593 |
+
</span>
|
594 |
+
|
595 |
+
<span class='is_create_taxonomy'>
|
596 |
+
<input type="checkbox" name="variable_create_taxonomy_in_not_exists[]" id="variable_create_taxonomy_in_not_exists_<?php echo $i;?>" <?php echo ($post['variable_create_taxonomy_in_not_exists'][$i]) ? 'checked="checked"' : ''; ?> style="float:left;" value="1"/>
|
597 |
+
<label for="variable_create_taxonomy_in_not_exists_<?php echo $i; ?>"><?php _e('Auto-Create Terms',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
598 |
+
</span>
|
599 |
+
</p>
|
600 |
+
</td>
|
601 |
+
<td class="action remove"><a href="#remove" style="top: 9px;"></a></td>
|
602 |
+
</tr>
|
603 |
+
<?php endforeach ?>
|
604 |
+
<?php else: ?>
|
605 |
+
<tr class="form-field">
|
606 |
+
<td style="width: 50%;">
|
607 |
+
<div class="drag-attribute">
|
608 |
+
<input type="text" name="variable_attribute_name[]" value="" style="width:95% !important;"/>
|
609 |
+
</div>
|
610 |
+
</td>
|
611 |
+
<td style="width: 50%;">
|
612 |
+
<input type="text" class="widefat" name="variable_attribute_value[]" value="" style="width: 100% !important;"/>
|
613 |
+
|
614 |
+
<span class="wpallimport-clear"></span>
|
615 |
+
<p class="form-field wpallimport-radio-field" style="padding: 0 !important; position: relative; left: -100%; width: 200%;">
|
616 |
+
<span class='in_variations' style="margin-left:0px;">
|
617 |
+
<input type="checkbox" name="variable_in_variations[]" id="variable_in_variations_0" checked="checked" style="float: left;" value="1"/>
|
618 |
+
<label for="variable_in_variations_0"><?php _e('In Variations',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
619 |
+
</span>
|
620 |
+
<span class='is_visible'>
|
621 |
+
<input type="checkbox" name="variable_is_visible[]" id="variable_is_visible_0" checked="checked" style="float:left;" value="1"/>
|
622 |
+
<label for="variable_is_visible_0"><?php _e('Is Visible',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
623 |
+
</span>
|
624 |
+
<span class='is_taxonomy'>
|
625 |
+
<input type="checkbox" name="variable_is_taxonomy[]" id="variable_is_taxonomy_0" checked="checked" style="float:left;" value="1"/>
|
626 |
+
<label for="variable_is_taxonomy_0"><?php _e('Taxonomy',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
627 |
+
</span>
|
628 |
+
<span class='is_create_taxonomy'>
|
629 |
+
<input type="checkbox" name="variable_create_taxonomy_in_not_exists[]" id="variable_create_taxonomy_in_not_exists_0" checked="checked" style="float:left;" value="1"/>
|
630 |
+
<label for="variable_create_taxonomy_in_not_exists_0"><?php _e('Auto-Create Terms',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
631 |
+
</span>
|
632 |
+
</p>
|
633 |
+
</td>
|
634 |
+
<td class="action remove"><a href="#remove" style="top: 9px;"></a></td>
|
635 |
+
</tr>
|
636 |
+
<?php endif;?>
|
637 |
+
<tr class="form-field template">
|
638 |
+
<td style="width: 50%;">
|
639 |
+
<div class="drag-attribute">
|
640 |
+
<input type="text" name="variable_attribute_name[]" value="" style="width:95% !important;"/>
|
641 |
+
</div>
|
642 |
+
</td>
|
643 |
+
<td style="width: 50%;">
|
644 |
+
<input type="text" class="widefat" name="variable_attribute_value[]" value="" style="width: 100% !important;"/>
|
645 |
+
|
646 |
+
<span class="wpallimport-clear"></span>
|
647 |
+
<p class="form-field wpallimport-radio-field" style="padding: 0 !important; position: relative; left: -100%; width: 200%;">
|
648 |
+
<span class='in_variations' style="margin-left:0px;">
|
649 |
+
<input type="checkbox" name="variable_in_variations[]" checked="checked" style="float: left;" value="1"/>
|
650 |
+
<label for=""><?php _e('In Variations',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
651 |
+
</span>
|
652 |
+
<span class='is_visible'>
|
653 |
+
<input type="checkbox" name="variable_is_visible[]" checked="checked" style="float: left;" value="1"/>
|
654 |
+
<label for=""><?php _e('Is Visible',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
655 |
+
</span>
|
656 |
+
<span class='is_taxonomy'>
|
657 |
+
<input type="checkbox" name="variable_is_taxonomy[]" checked="checked" style="float: left;" value="1"/>
|
658 |
+
<label for=""><?php _e('Taxonomy',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
659 |
+
</span>
|
660 |
+
<span class='is_create_taxonomy'>
|
661 |
+
<input type="checkbox" name="variable_create_taxonomy_in_not_exists[]" checked="checked" style="float: left;" value="1"/>
|
662 |
+
<label for=""><?php _e('Auto-Create Terms',PMWI_Plugin::TEXT_DOMAIN);?></label>
|
663 |
+
</span>
|
664 |
+
</p>
|
665 |
+
</td>
|
666 |
+
<td class="action remove"><a href="#remove" style="top: 9px;"></a></td>
|
667 |
+
</tr>
|
668 |
+
<tr class="wpallimport-table-actions">
|
669 |
+
<td colspan="3"><a href="#add" title="<?php _e('add', PMWI_Plugin::TEXT_DOMAIN)?>" class="action add-new-custom"><?php _e('Add more', PMWI_Plugin::TEXT_DOMAIN) ?></a></td>
|
670 |
+
</tr>
|
671 |
+
</tbody>
|
672 |
+
</table>
|
673 |
+
</div>
|
674 |
+
</div>
|
675 |
+
</div>
|
676 |
+
<div id="variations_tag" class="options_group show_if_variable">
|
677 |
+
<a href="javascript:void(0)" id="close_xml_tree"></a>
|
678 |
+
<div class="variations_tree">
|
679 |
+
<div id="variations_xml">
|
680 |
+
<div class="variations_tag">
|
681 |
+
<input type="hidden" name="variations_tagno" value="<?php echo (!empty($tagno)) ? $tagno : 0; ?>" />
|
682 |
+
<div class="title">
|
683 |
+
<?php printf(__('No matching elements found for XPath expression specified', PMWI_Plugin::TEXT_DOMAIN), (!empty($tagno)) ? $tagno : 0, (!empty($variation_list_count)) ? $variation_list_count : 0); ?>
|
684 |
+
</div>
|
685 |
+
<div class="clear"></div>
|
686 |
+
<div class="xml resetable"></div>
|
687 |
+
</div>
|
688 |
+
</div>
|
689 |
+
</div>
|
690 |
+
</div>
|
691 |
+
</div>
|
692 |
+
</div>
|
693 |
+
|
694 |
+
<?php if ($post['wizard_type'] == 'new'): ?>
|
695 |
+
<div class="wpallimport-clear" style="margin-top:5px;"></div>
|
696 |
+
<p class="form-field wpallimport-radio-field">
|
697 |
+
<input type="radio" id="add_variation_to_existing_product" class="switcher" name="matching_parent" value="existing" <?php echo 'existing' == $post['matching_parent'] ? 'checked="checked"': '' ?> style="float:left;"/>
|
698 |
+
<label for="add_variation_to_existing_product" style="width:350px;"><?php _e('I\'m importing new variations to existing products', PMWI_Plugin::TEXT_DOMAIN )?> </label>
|
699 |
+
</p>
|
700 |
+
<div class="switcher-target-add_variation_to_existing_product" style="padding-left:25px;">
|
701 |
+
<p class="form-field wpallimport-radio-field">
|
702 |
+
<label style="width: 200px;"><?php _e('Manual Parent Product Matching', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
703 |
+
<a href="#help" class="wpallimport-help" style="top:0px;" title="<?php _e('Variation will be assigned as the child of an already created product matching the specified criteria.', PMWI_Plugin::TEXT_DOMAIN); ?>">?</a>
|
704 |
+
</p>
|
705 |
+
<div class="form-field wpallimport-radio-field">
|
706 |
+
<input type="radio" id="existing_parent_product_matching_logic_cf" class="switcher" name="existing_parent_product_matching_logic" value="custom field" <?php echo 'custom field' == $post['existing_parent_product_matching_logic'] ? 'checked="checked"': '' ?>/>
|
707 |
+
<label for="existing_parent_product_matching_logic_cf"><?php _e('Match by Custom Field', PMWI_Plugin::TEXT_DOMAIN )?></label><br>
|
708 |
+
<span class="wpallimport-clear"></span>
|
709 |
+
<div class="switcher-target-existing_parent_product_matching_logic_cf set_with_xpath" style="padding-left:40px;">
|
710 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
711 |
+
<label style="width: 80px;"><?php _e('Name', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
712 |
+
<input type="text" name="existing_parent_product_cf_name" value="<?php echo esc_attr($post['existing_parent_product_cf_name']) ?>" style="float:none; margin:1px;" />
|
713 |
+
<span class="wpallimport-clear"></span>
|
714 |
+
<label style="width: 80px;"><?php _e('Value', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
715 |
+
<input type="text" name="existing_parent_product_cf_value" value="<?php echo esc_attr($post['existing_parent_product_cf_value']) ?>" style="float:none; margin:1px;" />
|
716 |
+
</span>
|
717 |
+
</div>
|
718 |
+
</div>
|
719 |
+
<div class="form-field wpallimport-radio-field">
|
720 |
+
<input type="radio" id="existing_parent_product_matching_logic_title" class="switcher" name="existing_parent_product_matching_logic" value="title" <?php echo 'title' == $post['existing_parent_product_matching_logic'] ? 'checked="checked"': '' ?>/>
|
721 |
+
<label for="existing_parent_product_matching_logic_title"><?php _e('Match Parent by Title', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
722 |
+
<span class="wpallimport-clear"></span>
|
723 |
+
<div class="switcher-target-existing_parent_product_matching_logic_title set_with_xpath" style="vertical-align:middle">
|
724 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
725 |
+
<input type="text" name="existing_parent_product_title" value="<?php echo esc_attr($post['existing_parent_product_title']); ?>" style="float:none; margin:1px; " />
|
726 |
+
</span>
|
727 |
+
</div>
|
728 |
+
</div>
|
729 |
+
</div>
|
730 |
+
<?php endif; ?>
|
731 |
+
|
732 |
+
<div class="clear" style="margin-top:5px;"></div>
|
733 |
+
|
734 |
+
</div>
|
735 |
+
|
736 |
+
<div class="options_group variations_are_not_child_elements">
|
737 |
+
<p class="form-field wpallimport-radio-field">
|
738 |
+
<label><?php _e("Manage stock?"); ?></label>
|
739 |
+
</p>
|
740 |
+
<p class="form-field wpallimport-radio-field">
|
741 |
+
<input type="radio" id="is_variation_product_manage_stock_yes" class="switcher" name="is_variation_product_manage_stock" value="yes" <?php echo 'yes' == $post['is_variation_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
742 |
+
<label for="is_variation_product_manage_stock_yes"><?php _e("Yes"); ?></label>
|
743 |
+
</p>
|
744 |
+
<p class="form-field wpallimport-radio-field">
|
745 |
+
<input type="radio" id="is_variation_product_manage_stock_no" class="switcher" name="is_variation_product_manage_stock" value="no" <?php echo 'no' == $post['is_variation_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
746 |
+
<label for="is_variation_product_manage_stock_no"><?php _e("No"); ?></label>
|
747 |
+
</p>
|
748 |
+
<div class="form-field wpallimport-radio-field">
|
749 |
+
<input type="radio" id="is_variation_product_manage_stock_xpath" class="switcher" name="is_variation_product_manage_stock" value="xpath" <?php echo 'xpath' == $post['is_variation_product_manage_stock'] ? 'checked="checked"': '' ?>/>
|
750 |
+
<label for="is_variation_product_manage_stock_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
751 |
+
<span class="wpallimport-clear"></span>
|
752 |
+
<div class="switcher-target-is_variation_product_manage_stock_xpath set_with_xpath" style="width:390px;">
|
753 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
754 |
+
<input type="text" class="smaller-text" name="single_variation_product_manage_stock" style="width:345px;" value="<?php echo esc_attr($post['single_variation_product_manage_stock']) ?>"/>
|
755 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
756 |
+
</span>
|
757 |
+
</div>
|
758 |
+
</div>
|
759 |
+
</div>
|
760 |
+
|
761 |
+
<div class="options_group variation_stock_fields variations_are_not_child_elements">
|
762 |
+
<p class="form-field">
|
763 |
+
<label style="width:150px;"><?php _e('Stock Qty', PMWI_Plugin::TEXT_DOMAIN);?></label>
|
764 |
+
<input type="text" value="<?php echo esc_attr($post['variation_stock']) ?>" style="" name="variation_stock" class="short">
|
765 |
+
</p>
|
766 |
+
</div>
|
767 |
+
|
768 |
+
<div class="options_group variations_are_not_child_elements">
|
769 |
+
<p class="form-field wpallimport-radio-field">
|
770 |
+
<label><?php _e("Stock status"); ?></label>
|
771 |
+
</p>
|
772 |
+
<p class="form-field wpallimport-radio-field">
|
773 |
+
<input type="radio" id="variation_stock_status_in_stock" class="switcher" name="variation_stock_status" value="instock" <?php echo 'instock' == $post['variation_stock_status'] ? 'checked="checked"': '' ?>/>
|
774 |
+
<label for="variation_stock_status_in_stock"><?php _e("In stock"); ?></label>
|
775 |
+
</p>
|
776 |
+
<p class="form-field wpallimport-radio-field">
|
777 |
+
<input type="radio" id="variation_stock_status_out_of_stock" class="switcher" name="variation_stock_status" value="outofstock" <?php echo 'outofstock' == $post['variation_stock_status'] ? 'checked="checked"': '' ?>/>
|
778 |
+
<label for="variation_stock_status_out_of_stock"><?php _e("Out of stock"); ?></label>
|
779 |
+
</p>
|
780 |
+
<p class="form-field wpallimport-radio-field">
|
781 |
+
<input type="radio" id="variation_stock_status_auto" class="switcher" name="variation_stock_status" value="auto" <?php echo 'auto' == $post['variation_stock_status'] ? 'checked="checked"': '' ?>/>
|
782 |
+
<label for="variation_stock_status_auto" style="width:100px;"><?php _e("Set automatically"); ?></label>
|
783 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Set the stock status to In Stock for positive or blank Stock Qty values, and Out Of Stock if Stock Qty is 0.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:3px;">?</a>
|
784 |
+
</p>
|
785 |
+
<div class="form-field wpallimport-radio-field">
|
786 |
+
<input type="radio" id="variation_stock_status_xpath" class="switcher" name="variation_stock_status" value="xpath" <?php echo 'xpath' == $post['variation_stock_status'] ? 'checked="checked"': '' ?>/>
|
787 |
+
<label for="variation_stock_status_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
788 |
+
<span class="wpallimport-clear"></span>
|
789 |
+
<div class="switcher-target-variation_stock_status_xpath set_with_xpath" style="width:390px;">
|
790 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
791 |
+
<input type="text" class="smaller-text" name="single_variation_stock_status" style="width:345px;" value="<?php echo esc_attr($post['single_variation_stock_status']) ?>"/>
|
792 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'instock\', \'outofstock\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
793 |
+
</span>
|
794 |
+
</div>
|
795 |
+
</div>
|
796 |
+
</div>
|
797 |
+
|
798 |
+
<div class="options_group">
|
799 |
+
|
800 |
+
<p class="form-field"><?php _e('Variation Enabled',PMWI_Plugin::TEXT_DOMAIN);?><a href="#help" class="wpallimport-help" title="<?php _e('This option is the same as the Enabled checkbox when editing an individual variation in WooCommerce.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a></p>
|
801 |
+
|
802 |
+
<p class="form-field wpallimport-radio-field">
|
803 |
+
<input type="radio" id="product_enabled_yes" class="switcher" name="is_product_enabled" value="yes" <?php echo 'yes' == $post['is_product_enabled'] ? 'checked="checked"': '' ?>/>
|
804 |
+
<label for="product_enabled_yes"><?php _e("Yes"); ?></label>
|
805 |
+
</p>
|
806 |
+
<p class="form-field wpallimport-radio-field">
|
807 |
+
<input type="radio" id="product_enabled_no" class="switcher" name="is_product_enabled" value="no" <?php echo 'no' == $post['is_product_enabled'] ? 'checked="checked"': '' ?>/>
|
808 |
+
<label for="product_enabled_no"><?php _e("No"); ?></label>
|
809 |
+
</p>
|
810 |
+
<div class="form-field wpallimport-radio-field">
|
811 |
+
<input type="radio" id="product_enabled_xpath" class="switcher" name="is_product_enabled" value="xpath" <?php echo 'xpath' == $post['is_product_enabled'] ? 'checked="checked"': '' ?>/>
|
812 |
+
<label for="product_enabled_xpath"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
813 |
+
<span class="wpallimport-clear"></span>
|
814 |
+
<div class="switcher-target-product_enabled_xpath set_with_xpath">
|
815 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
816 |
+
<input type="text" class="smaller-text" name="single_product_enabled" style="width:300px;" value="<?php echo esc_attr($post['single_product_enabled']) ?>"/>
|
817 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The value of presented XPath should be one of the following: (\'yes\', \'no\').', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
818 |
+
</span>
|
819 |
+
</div>
|
820 |
+
</div>
|
821 |
+
</div>
|
822 |
+
|
823 |
+
<div class="options_group">
|
824 |
+
|
825 |
+
<div class="clear"></div>
|
826 |
+
|
827 |
+
<p class="form-field wpallimport-radio-field">
|
828 |
+
<input type="radio" id="set_default_yes" class="switcher" name="is_default_attributes" value="1" <?php echo $post['is_default_attributes'] ? 'checked="checked"': '' ?>/>
|
829 |
+
<label for="set_default_yes" style="width: 400px;"><?php _e("Set the default selection in the attributes dropdowns.", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
830 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The attributes for the first variation will be automatically selected on the frontend.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:2px;">?</a>
|
831 |
+
</p>
|
832 |
+
<div class="switcher-target-set_default_yes set_with_xpath" style="padding-left:17px;">
|
833 |
+
<p class="form-field wpallimport-radio-field">
|
834 |
+
<input type="radio" id="set_default_first" name="default_attributes_type" value="first" <?php echo ($post['default_attributes_type'] == 'first') ? 'checked="checked"': '' ?>/>
|
835 |
+
<label for="set_default_first" style="width: 90%;"><?php _e("Set first variation as the default selection.", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
836 |
+
</p>
|
837 |
+
<p class="form-field wpallimport-radio-field">
|
838 |
+
<input type="radio" id="set_default_instock" name="default_attributes_type" value="instock" <?php echo ($post['default_attributes_type'] == 'instock') ? 'checked="checked"': '' ?>/>
|
839 |
+
<label for="set_default_instock" style="width: 90%;"><?php _e("Set first in stock variation as the default selection.", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
840 |
+
</p>
|
841 |
+
</div>
|
842 |
+
<p class="form-field wpallimport-radio-field">
|
843 |
+
<input type="radio" id="set_default_no" class="switcher" name="is_default_attributes" value="0" <?php echo ! $post['is_default_attributes'] ? 'checked="checked"': '' ?>/>
|
844 |
+
<label for="set_default_no" style="width: 90%;"><?php _e("Do not set default selections for the dropdowns.", PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
845 |
+
</p>
|
846 |
+
|
847 |
+
<p class="form-field wpallimport-radio-field">
|
848 |
+
<input type="hidden" name="make_simple_product" value="0" />
|
849 |
+
<input type="checkbox" id="make_simple_product" name="make_simple_product" value="1" <?php echo $post['make_simple_product'] ? 'checked="checked"' : '' ?> />
|
850 |
+
<label for="make_simple_product" style="width:340px;"><?php _e('Create products with no variations as simple products.', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
851 |
+
</p>
|
852 |
+
<p class="form-field wpallimport-radio-field">
|
853 |
+
<input type="hidden" name="put_variation_image_to_gallery" value="0" />
|
854 |
+
<input type="checkbox" id="put_variation_image_to_gallery" name="put_variation_image_to_gallery" value="1" <?php echo $post['put_variation_image_to_gallery'] ? 'checked="checked"' : '' ?> />
|
855 |
+
<label for="put_variation_image_to_gallery" style="width:340px;"><?php _e('Save variation image to the gallery.', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
856 |
+
</p>
|
857 |
+
<?php
|
858 |
+
if ( function_exists( 'is_plugin_active' ) ) {
|
859 |
+
if ( is_plugin_active( "woocommerce-additional-variation-images/woocommerce-additional-variation-images.php" ) ) {
|
860 |
+
?>
|
861 |
+
<p class="form-field wpallimport-radio-field">
|
862 |
+
<input type="hidden" name="import_additional_variation_images" value="0" />
|
863 |
+
<input type="checkbox" id="import_additional_variation_images" name="import_additional_variation_images" value="1" <?php echo $post['import_additional_variation_images'] ? 'checked="checked"' : '' ?> />
|
864 |
+
<label for="import_additional_variation_images" style="width:340px;"><?php _e('Import additional variation images.', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
865 |
+
</p>
|
866 |
+
<?php
|
867 |
+
}
|
868 |
+
}
|
869 |
+
?>
|
870 |
+
<p class="form-field wpallimport-radio-field set_parent_stock_option" style="display:none;">
|
871 |
+
<input type="hidden" name="set_parent_stock" value="0" />
|
872 |
+
<input type="checkbox" id="set_parent_stock" name="set_parent_stock" value="1" <?php echo $post['set_parent_stock'] ? 'checked="checked"' : '' ?> />
|
873 |
+
<label for="set_parent_stock" style="width: 435px;"><?php _e('Set _stock value for parent product to the _stock value for the first variation.', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
874 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('This option works when there are no parent products in your feed ( cases 2 and 4 on Variations tab).', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:1px;">?</a>
|
875 |
+
</p>
|
876 |
+
|
877 |
+
</div>
|
878 |
+
|
879 |
+
</div><!-- End Product Panel -->
|
views/admin/import/product/index.php
ADDED
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpallimport-collapsed closed">
|
2 |
+
<div class="wpallimport-content-section">
|
3 |
+
<div class="wpallimport-collapsed-header">
|
4 |
+
<h3><?php _e('WooCommerce Add-On',PMWI_Plugin::TEXT_DOMAIN);?></h3>
|
5 |
+
</div>
|
6 |
+
<div class="wpallimport-collapsed-content" style="padding:0;">
|
7 |
+
<div class="wpallimport-collapsed-content-inner">
|
8 |
+
<table class="form-table" style="max-width:none;">
|
9 |
+
<tr>
|
10 |
+
<td colspan="3">
|
11 |
+
<div class="postbox " id="woocommerce-product-data">
|
12 |
+
<h3 class="hndle" style="margin-top:0;">
|
13 |
+
<span>
|
14 |
+
<div class="main_choise" style="padding:0px; margin-right:0px;">
|
15 |
+
<input type="radio" id="multiple_product_type_yes" class="switcher" name="is_multiple_product_type" value="yes" <?php echo 'no' != $post['is_multiple_product_type'] ? 'checked="checked"': '' ?>/>
|
16 |
+
<label for="multiple_product_type_yes"><?php _e('Product Type', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
17 |
+
</div>
|
18 |
+
<div class="switcher-target-multiple_product_type_yes" style="float:left;">
|
19 |
+
<div class="input">
|
20 |
+
<?php
|
21 |
+
$product_type_selector = apply_filters( 'product_type_selector', array(
|
22 |
+
'simple' => __( 'Simple product', PMWI_Plugin::TEXT_DOMAIN ),
|
23 |
+
'grouped' => __( 'Grouped product', PMWI_Plugin::TEXT_DOMAIN ),
|
24 |
+
'external' => __( 'External/Affiliate product', PMWI_Plugin::TEXT_DOMAIN ),
|
25 |
+
'variable' => __( 'Variable product', PMWI_Plugin::TEXT_DOMAIN )
|
26 |
+
), false );
|
27 |
+
?>
|
28 |
+
<select name="multiple_product_type" id="product-type">
|
29 |
+
<optgroup label="Product Type">
|
30 |
+
<?php foreach ($product_type_selector as $product_type => $product_type_title):?>
|
31 |
+
<option value="<?php echo $product_type; ?>" <?php echo $product_type == $post['multiple_product_type'] ? 'selected="selected"': '' ?>><?php echo $product_type_title;?></option>
|
32 |
+
<?php endforeach; ?>
|
33 |
+
</optgroup>
|
34 |
+
</select>
|
35 |
+
</div>
|
36 |
+
</div>
|
37 |
+
<div class="main_choise" style="padding:0px; margin-left:40px;">
|
38 |
+
<input type="radio" id="multiple_product_type_no" class="switcher" name="is_multiple_product_type" value="no" <?php echo 'no' == $post['is_multiple_product_type'] ? 'checked="checked"': '' ?>/>
|
39 |
+
<label for="multiple_product_type_no"><?php _e('Set Product Type With XPath', PMWI_Plugin::TEXT_DOMAIN )?></label>
|
40 |
+
</div>
|
41 |
+
<div class="switcher-target-multiple_product_type_no" style="float:left;">
|
42 |
+
<div class="input">
|
43 |
+
<input type="text" class="smaller-text" name="single_product_type" style="width:300px;" value="<?php echo esc_attr($post['single_product_type']) ?>"/>
|
44 |
+
<a href="#help" class="wpallimport-help" style="top: -1px;" title="<?php _e('The value of presented XPath should be one of the following: (\'simple\', \'grouped\', \'external\', \'variable\').', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
</span>
|
48 |
+
</h3>
|
49 |
+
<div class="clear"></div>
|
50 |
+
<div class="inside">
|
51 |
+
<div class="panel-wrap product_data">
|
52 |
+
|
53 |
+
<ul style="" class="product_data_tabs wc-tabs">
|
54 |
+
|
55 |
+
<li class="general_options active"><a href="javascript:void(0);" rel="general_product_data"><?php _e('General',PMWI_Plugin::TEXT_DOMAIN);?></a></li>
|
56 |
+
|
57 |
+
<li class="inventory_tab show_if_simple show_if_variable show_if_grouped inventory_options" style="display: block;"><a href="javascript:void(0);" rel="inventory_product_data"><?php _e('Inventory', PMWI_Plugin::TEXT_DOMAIN);?></a></li>
|
58 |
+
|
59 |
+
<li class="shipping_tab shipping_options hide_if_grouped hide_if_external"><a href="javascript:void(0);" rel="shipping_product_data"><?php _e('Shipping', PMWI_Plugin::TEXT_DOMAIN);?></a></li>
|
60 |
+
|
61 |
+
<li class="linked_product_tab linked_product_options"><a href="javascript:void(0);" rel="linked_product_data"><?php _e('Linked Products', PMWI_Plugin::TEXT_DOMAIN);?></a></li>
|
62 |
+
|
63 |
+
<li class="attributes_tab attribute_options"><a href="javascript:void(0);" rel="woocommerce_attributes"><?php _e('Attributes',PMWI_Plugin::TEXT_DOMAIN);?></a></li>
|
64 |
+
|
65 |
+
<li class="advanced_tab advanced_options"><a href="javascript:void(0);" rel="advanced_product_data"><?php _e('Advanced',PMWI_Plugin::TEXT_DOMAIN);?></a></li>
|
66 |
+
|
67 |
+
<li class="variations_tab show_if_variable variation_options"><a title="Variations for variable products are defined here." href="javascript:void(0);" rel="variable_product_options"><?php _e('Variations',PMWI_Plugin::TEXT_DOMAIN);?></a></li>
|
68 |
+
|
69 |
+
<li class="options_tab advanced_options"><a title="Variations for variable products are defined here." href="javascript:void(0);" rel="add_on_options"><?php _e('Add-On Options', PMWI_Plugin::TEXT_DOMAIN);?></a></li>
|
70 |
+
|
71 |
+
<?php do_action('pmwi_tab_header'); ?>
|
72 |
+
|
73 |
+
</ul>
|
74 |
+
|
75 |
+
<!-- GENERAL -->
|
76 |
+
|
77 |
+
<?php include( '_tabs/_general.php' ); ?>
|
78 |
+
|
79 |
+
<!-- INVENTORY -->
|
80 |
+
|
81 |
+
<?php include( '_tabs/_inventory.php' ); ?>
|
82 |
+
|
83 |
+
<!-- SHIPPING -->
|
84 |
+
|
85 |
+
<?php include( '_tabs/_shipping.php' ); ?>
|
86 |
+
|
87 |
+
<!-- LINKED PRODUCT -->
|
88 |
+
|
89 |
+
<?php include( '_tabs/_linked_product.php' ); ?>
|
90 |
+
|
91 |
+
<!-- ATTRIBUTES -->
|
92 |
+
|
93 |
+
<?php include( '_tabs/_attributes.php' ); ?>
|
94 |
+
|
95 |
+
<!-- ADVANCED -->
|
96 |
+
|
97 |
+
<?php include( '_tabs/_advanced.php' ); ?>
|
98 |
+
|
99 |
+
<!-- VARIATIONS -->
|
100 |
+
|
101 |
+
<?php include( '_tabs/_variations.php' ); ?>
|
102 |
+
|
103 |
+
<!-- ADDITIONAL TABS -->
|
104 |
+
|
105 |
+
<?php do_action('pmwi_tab_content'); ?>
|
106 |
+
|
107 |
+
<!-- OPTIONS -->
|
108 |
+
|
109 |
+
<?php include( '_tabs/_options.php' ); ?>
|
110 |
+
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
|
115 |
+
<div class="clear"></div>
|
116 |
+
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
</table>
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
</div>
|
123 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_billing.php
ADDED
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="billing_order_data">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<div class="input">
|
4 |
+
<div class="form-field wpallimport-radio-field">
|
5 |
+
<input type="radio" id="billing_source_existing" name="pmwi_order[billing_source]" value="existing" <?php echo 'existing' == $post['pmwi_order']['billing_source'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
6 |
+
<label for="billing_source_existing" style="width:auto;"><?php _e('Try to load data from existing customer', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
7 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If no customer is found the order will be skipped.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top: 3px;">?</a>
|
8 |
+
</div>
|
9 |
+
<span class="wpallimport-clear"></span>
|
10 |
+
<div class="switcher-target-billing_source_existing" style="padding-left:27px;">
|
11 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
12 |
+
<div class="wpallimport-billing-user-try-match">
|
13 |
+
<div class="wpallimport-billing-user-try-match-selector">
|
14 |
+
<label for=""><?php _e('Match by:', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
15 |
+
<select name="pmwi_order[billing_source_match_by]" id="billing_source_match_by" class="rad4">
|
16 |
+
<option value="username" <?php echo 'username' == $post['pmwi_order']['billing_source_match_by'] ? 'selected="selected"' : '' ?>><?php _e('Username', PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
17 |
+
<option value="email" <?php echo 'email' == $post['pmwi_order']['billing_source_match_by'] ? 'selected="selected"' : '' ?>><?php _e('Email', PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
18 |
+
<option value="cf" <?php echo 'cf' == $post['pmwi_order']['billing_source_match_by'] ? 'selected="selected"' : '' ?>><?php _e('Custom Field', PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
19 |
+
<option value="id" <?php echo 'id' == $post['pmwi_order']['billing_source_match_by'] ? 'selected="selected"' : '' ?>><?php _e('User ID', PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
20 |
+
</select>
|
21 |
+
</div>
|
22 |
+
<div class="clear"></div>
|
23 |
+
<!-- Match user by Username -->
|
24 |
+
<div class="form-field wpallimport-radio-field wpallimport-select-switcher-target" rel="username">
|
25 |
+
<span class="wpallimport-clear"></span>
|
26 |
+
<div class="switcher-target-billing_source_match_by_username set_with_xpath">
|
27 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
28 |
+
<input type="text" class="short rad4" name="pmwi_order[billing_source_username]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_source_username']) ?>" placeholder="<?php _e('Username', PMWI_Plugin::TEXT_DOMAIN); ?>"/>
|
29 |
+
</span>
|
30 |
+
</div>
|
31 |
+
</div>
|
32 |
+
<div class="clear"></div>
|
33 |
+
<!-- Match user by Email -->
|
34 |
+
<div class="form-field wpallimport-radio-field wpallimport-select-switcher-target" rel="email">
|
35 |
+
<span class="wpallimport-clear"></span>
|
36 |
+
<div class="switcher-target-billing_source_match_by_email set_with_xpath">
|
37 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
38 |
+
<input type="text" class="short rad4" name="pmwi_order[billing_source_email]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_source_email']) ?>" placeholder="<?php _e('Email Address', PMWI_Plugin::TEXT_DOMAIN); ?>"/>
|
39 |
+
</span>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
<div class="clear"></div>
|
43 |
+
<!-- Match user by Custom Field -->
|
44 |
+
<div class="form-field wpallimport-radio-field wpallimport-select-switcher-target" rel="cf">
|
45 |
+
<span class="wpallimport-clear"></span>
|
46 |
+
<div class="switcher-target-billing_source_match_by_cf set_with_xpath">
|
47 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
48 |
+
<p style="padding: 0;">
|
49 |
+
<input type="text" class="short rad4" name="pmwi_order[billing_source_cf_name]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_source_cf_name']) ?>" placeholder="<?php _e('Field Name', PMWI_Plugin::TEXT_DOMAIN); ?>"/>
|
50 |
+
</p>
|
51 |
+
<p style="padding: 0;">
|
52 |
+
<input type="text" class="short rad4" name="pmwi_order[billing_source_cf_value]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_source_cf_value']) ?>" placeholder="<?php _e('Field Value', PMWI_Plugin::TEXT_DOMAIN); ?>"/>
|
53 |
+
</p>
|
54 |
+
</span>
|
55 |
+
</div>
|
56 |
+
</div>
|
57 |
+
<div class="clear"></div>
|
58 |
+
<!-- Match user by user ID -->
|
59 |
+
<div class="form-field wpallimport-radio-field wpallimport-select-switcher-target" rel="id">
|
60 |
+
<span class="wpallimport-clear"></span>
|
61 |
+
<div class="switcher-target-billing_source_match_by_id set_with_xpath">
|
62 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
63 |
+
<input type="text" class="short rad4" name="pmwi_order[billing_source_id]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_source_id']) ?>" placeholder="<?php _e('User ID', PMWI_Plugin::TEXT_DOMAIN); ?>"/>
|
64 |
+
</span>
|
65 |
+
</div>
|
66 |
+
</div>
|
67 |
+
<div class="form-field wpallimport-radio-field">
|
68 |
+
<input type="hidden" name="pmwi_order[is_guest_matching]" value="0"/>
|
69 |
+
<input type="checkbox" id="billing_is_guest_matching" name="pmwi_order[is_guest_matching]" value="1" <?php echo $post['pmwi_order']['is_guest_matching'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
70 |
+
<label for="billing_is_guest_matching" style="width:auto;"><?php _e('If no match found, import as guest customer', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
71 |
+
<span class="wpallimport-clear"></span>
|
72 |
+
<div class="switcher-target-billing_is_guest_matching">
|
73 |
+
<table cellspacing="5" class="wpallimport-order-billing-fields">
|
74 |
+
<tr>
|
75 |
+
<td>
|
76 |
+
<label><?php _e('First Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
77 |
+
<div class="clear">
|
78 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_first_name]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_first_name']) ?>"/>
|
79 |
+
</div>
|
80 |
+
</td>
|
81 |
+
<td>
|
82 |
+
<label><?php _e('Last Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
83 |
+
<div class="clear">
|
84 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_last_name]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_last_name']) ?>"/>
|
85 |
+
</div>
|
86 |
+
</td>
|
87 |
+
</tr>
|
88 |
+
<tr>
|
89 |
+
<td colspan="2">
|
90 |
+
<label><?php _e('Company', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
91 |
+
<div class="clear">
|
92 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_company]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_company']) ?>"/>
|
93 |
+
</div>
|
94 |
+
</td>
|
95 |
+
</tr>
|
96 |
+
<tr>
|
97 |
+
<td>
|
98 |
+
<label><?php _e('Address 1', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
99 |
+
<div class="clear">
|
100 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_address_1]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_address_1']) ?>"/>
|
101 |
+
</div>
|
102 |
+
</td>
|
103 |
+
<td>
|
104 |
+
<label><?php _e('Address 2', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
105 |
+
<div class="clear">
|
106 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_address_2]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_address_2']) ?>"/>
|
107 |
+
</div>
|
108 |
+
</td>
|
109 |
+
</tr>
|
110 |
+
<tr>
|
111 |
+
<td>
|
112 |
+
<label><?php _e('City', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
113 |
+
<div class="clear">
|
114 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_city]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_city']) ?>"/>
|
115 |
+
</div>
|
116 |
+
</td>
|
117 |
+
<td>
|
118 |
+
<label><?php _e('Postcode', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
119 |
+
<div class="clear">
|
120 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_postcode]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_postcode']) ?>"/>
|
121 |
+
</div>
|
122 |
+
</td>
|
123 |
+
</tr>
|
124 |
+
<tr>
|
125 |
+
<td>
|
126 |
+
<label><?php _e('Country', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
127 |
+
<div class="clear">
|
128 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_country]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_country']) ?>"/>
|
129 |
+
</div>
|
130 |
+
</td>
|
131 |
+
<td>
|
132 |
+
<label><?php _e('State/Country', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
133 |
+
<div class="clear">
|
134 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_state]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_state']) ?>"/>
|
135 |
+
</div>
|
136 |
+
</td>
|
137 |
+
</tr>
|
138 |
+
<tr>
|
139 |
+
<td>
|
140 |
+
<label><?php _e('Email', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
141 |
+
<div class="clear">
|
142 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_email]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_email']) ?>"/>
|
143 |
+
</div>
|
144 |
+
</td>
|
145 |
+
<td>
|
146 |
+
<label><?php _e('Phone', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
147 |
+
<div class="clear">
|
148 |
+
<input type="text" class="rad4" name="pmwi_order[guest_billing_phone]" style="" value="<?php echo esc_attr($post['pmwi_order']['guest_billing_phone']) ?>"/>
|
149 |
+
</div>
|
150 |
+
</td>
|
151 |
+
</tr>
|
152 |
+
</table>
|
153 |
+
</div>
|
154 |
+
</span>
|
155 |
+
<p class="is_guest_matching_notice" style="padding: 5px 0 10px;"><i><?php _e('Orders without a match will be skipped', PMWI_Plugin::TEXT_DOMAIN); ?></i></p>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
</span>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
<div class="clear"></div>
|
162 |
+
<div style="margin-top:0; padding-left:8px;">
|
163 |
+
<div class="form-field wpallimport-radio-field">
|
164 |
+
<input type="radio" id="billing_source_guest" name="pmwi_order[billing_source]" value="guest" <?php echo 'guest' == $post['pmwi_order']['billing_source'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
165 |
+
<label for="billing_source_guest" style="width:auto;"><?php _e('Import as guest customer', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
166 |
+
</div>
|
167 |
+
<span class="wpallimport-clear"></span>
|
168 |
+
<div class="switcher-target-billing_source_guest" style="padding-left:45px;">
|
169 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
170 |
+
<table cellspacing="5" class="wpallimport-order-billing-fields">
|
171 |
+
<tr>
|
172 |
+
<td>
|
173 |
+
<label><?php _e('First Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
174 |
+
<div class="clear">
|
175 |
+
<input type="text" class="rad4" name="pmwi_order[billing_first_name]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_first_name']) ?>"/>
|
176 |
+
</div>
|
177 |
+
</td>
|
178 |
+
<td>
|
179 |
+
<label><?php _e('Last Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
180 |
+
<div class="clear">
|
181 |
+
<input type="text" class="rad4" name="pmwi_order[billing_last_name]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_last_name']) ?>"/>
|
182 |
+
</div>
|
183 |
+
</td>
|
184 |
+
</tr>
|
185 |
+
<tr>
|
186 |
+
<td colspan="2">
|
187 |
+
<label><?php _e('Company', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
188 |
+
<div class="clear">
|
189 |
+
<input type="text" class="rad4" name="pmwi_order[billing_company]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_company']) ?>"/>
|
190 |
+
</div>
|
191 |
+
</td>
|
192 |
+
</tr>
|
193 |
+
<tr>
|
194 |
+
<td>
|
195 |
+
<label><?php _e('Address 1', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
196 |
+
<div class="clear">
|
197 |
+
<input type="text" class="rad4" name="pmwi_order[billing_address_1]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_address_1']) ?>"/>
|
198 |
+
</div>
|
199 |
+
</td>
|
200 |
+
<td>
|
201 |
+
<label><?php _e('Address 2', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
202 |
+
<div class="clear">
|
203 |
+
<input type="text" class="rad4" name="pmwi_order[billing_address_2]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_address_2']) ?>"/>
|
204 |
+
</div>
|
205 |
+
</td>
|
206 |
+
</tr>
|
207 |
+
<tr>
|
208 |
+
<td>
|
209 |
+
<label><?php _e('City', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
210 |
+
<div class="clear">
|
211 |
+
<input type="text" class="rad4" name="pmwi_order[billing_city]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_city']) ?>"/>
|
212 |
+
</div>
|
213 |
+
</td>
|
214 |
+
<td>
|
215 |
+
<label><?php _e('Postcode', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
216 |
+
<div class="clear">
|
217 |
+
<input type="text" class="rad4" name="pmwi_order[billing_postcode]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_postcode']) ?>"/>
|
218 |
+
</div>
|
219 |
+
</td>
|
220 |
+
</tr>
|
221 |
+
<tr>
|
222 |
+
<td>
|
223 |
+
<label><?php _e('Country', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
224 |
+
<div class="clear">
|
225 |
+
<input type="text" class="rad4" name="pmwi_order[billing_country]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_country']) ?>"/>
|
226 |
+
</div>
|
227 |
+
</td>
|
228 |
+
<td>
|
229 |
+
<label><?php _e('State/Country', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
230 |
+
<div class="clear">
|
231 |
+
<input type="text" class="rad4" name="pmwi_order[billing_state]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_state']) ?>"/>
|
232 |
+
</div>
|
233 |
+
</td>
|
234 |
+
</tr>
|
235 |
+
<tr>
|
236 |
+
<td>
|
237 |
+
<label><?php _e('Email', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
238 |
+
<div class="clear">
|
239 |
+
<input type="text" class="rad4" name="pmwi_order[billing_email]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_email']) ?>"/>
|
240 |
+
</div>
|
241 |
+
</td>
|
242 |
+
<td>
|
243 |
+
<label><?php _e('Phone', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
244 |
+
<div class="clear">
|
245 |
+
<input type="text" class="rad4" name="pmwi_order[billing_phone]" style="" value="<?php echo esc_attr($post['pmwi_order']['billing_phone']) ?>"/>
|
246 |
+
</div>
|
247 |
+
</td>
|
248 |
+
</tr>
|
249 |
+
</table>
|
250 |
+
</span>
|
251 |
+
</div>
|
252 |
+
</div>
|
253 |
+
<div class="clear"></div>
|
254 |
+
</div>
|
255 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_item_coupons.php
ADDED
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="order_coupons" style="display:none;">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<!-- Coupons matching mode -->
|
4 |
+
<!-- <div class="form-field wpallimport-radio-field wpallimport-clear">
|
5 |
+
<input type="radio" id="coupons_repeater_mode_fixed" name="pmwi_order[coupons_repeater_mode]" value="fixed" <?php echo 'fixed' == $post['pmwi_order']['coupons_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
6 |
+
<label for="coupons_repeater_mode_fixed" style="width:auto;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
7 |
+
</div> -->
|
8 |
+
<table class="form-field wpallimport_variable_table" style="width:98%;">
|
9 |
+
<?php
|
10 |
+
foreach ($post['pmwi_order']['coupons'] as $i => $coupon):
|
11 |
+
|
12 |
+
$coupon += array('code' => '', 'amount' => '', 'amount_tax' => '');
|
13 |
+
|
14 |
+
if (empty($coupon['code'])) continue;
|
15 |
+
|
16 |
+
?>
|
17 |
+
|
18 |
+
<tr class="form-field">
|
19 |
+
<td>
|
20 |
+
<table style="width:100%;" cellspacing="5">
|
21 |
+
<tr>
|
22 |
+
<td colspan="2">
|
23 |
+
<label><?php _e('Coupon Code', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
24 |
+
<div class="clear">
|
25 |
+
<input type="text" class="rad4" name="pmwi_order[coupons][<?php echo $i; ?>][code]" value="<?php echo esc_attr($coupon['code']) ?>" style="width:100%;"/>
|
26 |
+
</div>
|
27 |
+
</td>
|
28 |
+
</tr>
|
29 |
+
<tr>
|
30 |
+
<td>
|
31 |
+
<label><?php _e('Discount Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
32 |
+
<div class="clear">
|
33 |
+
<input type="text" class="rad4" name="pmwi_order[coupons][<?php echo $i; ?>][amount]" value="<?php echo esc_attr($coupon['amount']) ?>" style="width:100%;"/>
|
34 |
+
</div>
|
35 |
+
</td>
|
36 |
+
<td>
|
37 |
+
<label><?php _e('Discount Amount Tax', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
38 |
+
<div class="clear">
|
39 |
+
<input type="text" class="rad4" name="pmwi_order[coupons][<?php echo $i; ?>][amount_tax]" value="<?php echo esc_attr($coupon['amount_tax']) ?>" style="width:100%;"/>
|
40 |
+
</div>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
</table>
|
44 |
+
</td>
|
45 |
+
<td class="action remove"><!--a href="#remove" style="top: 39x;"></a--></td>
|
46 |
+
</tr>
|
47 |
+
|
48 |
+
<?php endforeach; ?>
|
49 |
+
<tr class="form-field template">
|
50 |
+
<td>
|
51 |
+
<table style="width:100%;" cellspacing="5">
|
52 |
+
<tr>
|
53 |
+
<td colspan="2">
|
54 |
+
<label><?php _e('Coupon Code', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
55 |
+
<div class="clear">
|
56 |
+
<input type="text" class="rad4" name="pmwi_order[coupons][ROWNUMBER][code]" value="" style="width:100%;"/>
|
57 |
+
</div>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<tr>
|
61 |
+
<td>
|
62 |
+
<label><?php _e('Discount Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
63 |
+
<div class="clear">
|
64 |
+
<input type="text" class="rad4" name="pmwi_order[coupons][ROWNUMBER][amount]" value="" style="width:100%;"/>
|
65 |
+
</div>
|
66 |
+
</td>
|
67 |
+
<td>
|
68 |
+
<label><?php _e('Discount Amount Tax', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
69 |
+
<div class="clear">
|
70 |
+
<input type="text" class="rad4" name="pmwi_order[coupons][ROWNUMBER][amount_tax]" value="" style="width:100%;"/>
|
71 |
+
</div>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
</table>
|
75 |
+
</td>
|
76 |
+
<td class="action remove"><!--a href="#remove" style="top: 39px;"></a--></td>
|
77 |
+
</tr>
|
78 |
+
<tr class="wpallimport-row-actions" style="display:none;">
|
79 |
+
<td colspan="2">
|
80 |
+
<a class="add-new-line" title="Add Another Coupon" href="javascript:void(0);" style="width:200px;"><?php _e("Add Another Coupon", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
81 |
+
</td>
|
82 |
+
</tr>
|
83 |
+
</table>
|
84 |
+
</div>
|
85 |
+
<div class="wpallimport-collapsed closed wpallimport-section order-imports">
|
86 |
+
<div style="margin:0; background: #FAFAFA;" class="wpallimport-content-section rad4 order-imports">
|
87 |
+
<div class="wpallimport-collapsed-header">
|
88 |
+
<h3 style="color:#40acad; font-size: 14px;"><?php _e("Advanced Options",PMWI_Plugin::TEXT_DOMAIN); ?></h3>
|
89 |
+
</div>
|
90 |
+
<div style="padding: 0px;" class="wpallimport-collapsed-content">
|
91 |
+
<div class="wpallimport-collapsed-content-inner">
|
92 |
+
<?php if ( empty(PMXI_Plugin::$session->options['delimiter']) ): ?>
|
93 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
94 |
+
<input type="radio" id="coupons_repeater_mode_variable_csv" name="pmwi_order[coupons_repeater_mode]" value="csv" <?php echo 'csv' == $post['pmwi_order']['coupons_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
95 |
+
<label for="coupons_repeater_mode_variable_csv" style="width:auto; float: none;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
96 |
+
<div class="switcher-target-coupons_repeater_mode_variable_csv wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
97 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
98 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple coupons separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
99 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[coupons_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['coupons_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
100 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two coupons would be imported like this coupon1|coupon2">?</a>
|
101 |
+
</span>
|
102 |
+
</div>
|
103 |
+
</div>
|
104 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
105 |
+
<input type="radio" id="coupons_repeater_mode_variable_xml" name="pmwi_order[coupons_repeater_mode]" value="xml" <?php echo 'xml' == $post['pmwi_order']['coupons_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
106 |
+
<label for="coupons_repeater_mode_variable_xml" style="width:auto; float: none;"><?php _e('Variable Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
107 |
+
<div class="switcher-target-coupons_repeater_mode_variable_xml wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
108 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
109 |
+
<label style="width: 60px; line-height: 30px;"><?php _e('For each', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
110 |
+
<input type="text" class="short rad4" name="pmwi_order[coupons_repeater_mode_foreach]" value="<?php echo esc_attr($post['pmwi_order']['coupons_repeater_mode_foreach']) ?>" style="width:50%;"/>
|
111 |
+
<label class="foreach-do" style="padding-left: 10px; line-height: 30px;"><?php _e('do...', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
112 |
+
</span>
|
113 |
+
</div>
|
114 |
+
</div>
|
115 |
+
<?php else: ?>
|
116 |
+
<input type="hidden" name="pmwi_order[coupons_repeater_mode]" value="csv"/>
|
117 |
+
<div class="form-field input" style="margin-bottom: 20px;">
|
118 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple coupons separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
119 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[coupons_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['coupons_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
120 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two coupons would be imported like this coupon1|coupon2">?</a>
|
121 |
+
</div>
|
122 |
+
<?php endif; ?>
|
123 |
+
</div>
|
124 |
+
</div>
|
125 |
+
</div>
|
126 |
+
</div>
|
127 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_item_fees.php
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="order_fees" style="display:none;">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<!-- Fees matching mode -->
|
4 |
+
<!-- <div class="form-field wpallimport-radio-field wpallimport-clear">
|
5 |
+
<input type="radio" id="fees_repeater_mode_fixed" name="pmwi_order[fees_repeater_mode]" value="fixed" <?php echo 'fixed' == $post['pmwi_order']['fees_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
6 |
+
<label for="fees_repeater_mode_fixed" style="width:auto;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
7 |
+
</div> -->
|
8 |
+
<table class="form-field wpallimport_variable_table" style="width:98%;" cellspacing="5">
|
9 |
+
<?php
|
10 |
+
foreach ($post['pmwi_order']['fees'] as $i => $fee):
|
11 |
+
|
12 |
+
$fee += array('name' => '', 'amount' => '');
|
13 |
+
|
14 |
+
if (empty($fee['name'])) continue;
|
15 |
+
|
16 |
+
?>
|
17 |
+
|
18 |
+
<tr class="form-field">
|
19 |
+
<td>
|
20 |
+
<label><?php _e('Fee Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
21 |
+
<div class="clear">
|
22 |
+
<input type="text" class="rad4" name="pmwi_order[fees][<?php echo $i; ?>][name]" value="<?php echo esc_attr($fee['name']) ?>" style="width:100%;"/>
|
23 |
+
</div>
|
24 |
+
</td>
|
25 |
+
<td>
|
26 |
+
<label><?php _e('Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
27 |
+
<div class="clear">
|
28 |
+
<input type="text" class="rad4" name="pmwi_order[fees][<?php echo $i; ?>][amount]" value="<?php echo esc_attr($fee['amount']) ?>" style="width:100%;"/>
|
29 |
+
</div>
|
30 |
+
</td>
|
31 |
+
<td class="action remove"><!--a href="#remove" style="top: 33px;"></a--></td>
|
32 |
+
</tr>
|
33 |
+
|
34 |
+
<?php endforeach; ?>
|
35 |
+
<tr class="form-field template">
|
36 |
+
<td>
|
37 |
+
<label><?php _e('Fee Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
38 |
+
<div class="clear">
|
39 |
+
<input type="text" class="rad4" name="pmwi_order[fees][ROWNUMBER][name]" value="" style="width:100%;"/>
|
40 |
+
</div>
|
41 |
+
</td>
|
42 |
+
<td>
|
43 |
+
<label><?php _e('Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
44 |
+
<div class="clear">
|
45 |
+
<input type="text" class="rad4" name="pmwi_order[fees][ROWNUMBER][amount]" value="" style="width:100%;"/>
|
46 |
+
</div>
|
47 |
+
</td>
|
48 |
+
<td class="action remove"><!--a href="#remove" style="top: 33px;"></a--></td>
|
49 |
+
</tr>
|
50 |
+
<tr class="wpallimport-row-actions" style="display:none;">
|
51 |
+
<td colspan="3">
|
52 |
+
<hr>
|
53 |
+
<a class="add-new-line" title="Add Another Fee" href="javascript:void(0);" style="width:200px;"><?php _e("Add Another Fee", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
54 |
+
</td>
|
55 |
+
</tr>
|
56 |
+
</table>
|
57 |
+
</div>
|
58 |
+
<div class="wpallimport-collapsed closed wpallimport-section order-imports">
|
59 |
+
<div style="margin:0; background: #FAFAFA;" class="wpallimport-content-section rad4 order-imports">
|
60 |
+
<div class="wpallimport-collapsed-header">
|
61 |
+
<h3 style="color:#40acad; font-size: 14px;"><?php _e("Advanced Options",PMWI_Plugin::TEXT_DOMAIN); ?></h3>
|
62 |
+
</div>
|
63 |
+
<div style="padding: 0px;" class="wpallimport-collapsed-content">
|
64 |
+
<div class="wpallimport-collapsed-content-inner">
|
65 |
+
<?php if ( empty(PMXI_Plugin::$session->options['delimiter']) ): ?>
|
66 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
67 |
+
<input type="radio" id="fees_repeater_mode_variable_csv" name="pmwi_order[fees_repeater_mode]" value="csv" <?php echo 'csv' == $post['pmwi_order']['fees_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
68 |
+
<label for="fees_repeater_mode_variable_csv" style="width:auto; float: none;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
69 |
+
<div class="switcher-target-fees_repeater_mode_variable_csv wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
70 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
71 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple fees separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
72 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[fees_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['fees_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
73 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two fees would be imported like this 'Fee 1|Fee 2' and the fee amounts like this 10|20">?</a>
|
74 |
+
</span>
|
75 |
+
</div>
|
76 |
+
</div>
|
77 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
78 |
+
<input type="radio" id="fees_repeater_mode_variable_xml" name="pmwi_order[fees_repeater_mode]" value="xml" <?php echo 'xml' == $post['pmwi_order']['fees_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
79 |
+
<label for="fees_repeater_mode_variable_xml" style="width:auto; float: none;"><?php _e('Variable Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
80 |
+
<div class="switcher-target-fees_repeater_mode_variable_xml wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
81 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
82 |
+
<label style="width: 60px; line-height: 30px;"><?php _e('For each', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
83 |
+
<input type="text" class="short rad4" name="pmwi_order[fees_repeater_mode_foreach]" value="<?php echo esc_attr($post['pmwi_order']['fees_repeater_mode_foreach']) ?>" style="width:50%;"/>
|
84 |
+
<label class="foreach-do" style="padding-left: 10px; line-height: 30px;"><?php _e('do...', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
85 |
+
</span>
|
86 |
+
</div>
|
87 |
+
</div>
|
88 |
+
<?php else: ?>
|
89 |
+
<input type="hidden" name="pmwi_order[fees_repeater_mode]" value="csv"/>
|
90 |
+
<div class="form-field input" style="margin-bottom: 20px;">
|
91 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple fees separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
92 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[fees_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['fees_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
93 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two fees would be imported like this 'Fee 1|Fee 2' and the fee amounts like this 10|20">?</a>
|
94 |
+
</div>
|
95 |
+
<?php endif; ?>
|
96 |
+
</div>
|
97 |
+
</div>
|
98 |
+
</div>
|
99 |
+
</div>
|
100 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_item_products.php
ADDED
@@ -0,0 +1,598 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="order_products">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<!-- Product matching mode -->
|
4 |
+
<!-- <div class="form-field wpallimport-radio-field wpallimport-clear">
|
5 |
+
<input type="radio" id="products_repeater_mode_fixed" name="pmwi_order[products_repeater_mode]" value="fixed" <?php echo 'fixed' == $post['pmwi_order']['products_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
6 |
+
<label for="products_repeater_mode_fixed" style="width:auto;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
7 |
+
</div> -->
|
8 |
+
|
9 |
+
<div class="form-field wpallimport-radio-field">
|
10 |
+
<input type="radio" id="products_source_existing" name="pmwi_order[products_source]" value="existing" <?php echo 'existing' == $post['pmwi_order']['products_source'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
11 |
+
<label for="products_source_existing" style="width:auto;"><?php _e('Get data from existing products', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
12 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If no product is found the order will be skipped.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:3px;">?</a>
|
13 |
+
</div>
|
14 |
+
<span class="wpallimport-clear"></span>
|
15 |
+
<div class="switcher-target-products_source_existing" style="padding-left:45px;">
|
16 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
17 |
+
<table class="wpallimport_variable_table" style="width:100%;">
|
18 |
+
<?php
|
19 |
+
foreach ($post['pmwi_order']['products'] as $i => $product):
|
20 |
+
|
21 |
+
$product += array('sku' => '', 'qty' => '', 'price_per_unit' => '', 'tax_rates' => array());
|
22 |
+
|
23 |
+
if (empty($product['sku'])) continue;
|
24 |
+
?>
|
25 |
+
|
26 |
+
<tr>
|
27 |
+
<td colspan="2">
|
28 |
+
<div style="float:left; width:50%;">
|
29 |
+
<label><?php _e('Product SKU', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
30 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][sku]" value="<?php echo esc_attr($product['sku']) ?>" style="width:95%;"/>
|
31 |
+
</div>
|
32 |
+
<div style="float:right; width:50%;">
|
33 |
+
<label><?php _e('Quantity', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
34 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][qty]" value="<?php echo esc_attr($product['qty']) ?>" style="width:95%;"/>
|
35 |
+
</div>
|
36 |
+
<div class="wpallimport-clear"></div>
|
37 |
+
<div style="float:right; width:50%;">
|
38 |
+
<label><?php _e('Price', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
39 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][price_per_unit]" value="<?php echo esc_attr($product['price_per_unit']) ?>" style="width:95%;"/>
|
40 |
+
</div>
|
41 |
+
<div class="wpallimport-clear"></div>
|
42 |
+
<!-- Product Taxes -->
|
43 |
+
<!--a class="switcher" id="taxes_existing_products_<?php echo $i; ?>" href="javascript:void(0);" style="display: block;margin: 10px 0 15px;width: 50px;"><span>-</span> <?php _e("Taxes", PMWI_Plugin::TEXT_DOMAIN); ?></a-->
|
44 |
+
<div class="wpallimport-clear"></div>
|
45 |
+
<div class="switcher-target-taxes_existing_products_<?php echo $i; ?>">
|
46 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
47 |
+
<table style="width:45%;" class="taxes-form-table">
|
48 |
+
<?php
|
49 |
+
foreach ($product['tax_rates'] as $j => $tax_rate):
|
50 |
+
|
51 |
+
$tax_rate += array('code' => '', 'calculate_logic' => 'percentage', 'percentage_value' => '', 'amount_per_unit' => '');
|
52 |
+
|
53 |
+
if (empty($tax_rate['code'])) continue;
|
54 |
+
|
55 |
+
?>
|
56 |
+
<tr class="form-field">
|
57 |
+
<td>
|
58 |
+
<div class="form-field">
|
59 |
+
<label><?php _e('Tax Rate Code', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
60 |
+
<div class="clear"></div>
|
61 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][code]" style="width:100%;" value="<?php echo esc_attr($tax_rate['code']) ?>"/>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<span class="wpallimport-clear"></span>
|
65 |
+
|
66 |
+
<p class="form-field"><?php _e("Calculate Tax Amount By:", PMWI_Plugin::TEXT_DOMAIN);?></p>
|
67 |
+
|
68 |
+
<div class="form-field wpallimport-radio-field">
|
69 |
+
<input type="radio" id="tax_calculate_logic_percentage_<?php echo $i; ?>_<?php echo $j; ?>" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][calculate_logic]" value="percentage" <?php echo 'percentage' == $tax_rate['calculate_logic'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
70 |
+
<label for="tax_calculate_logic_percentage_<?php echo $i; ?>_<?php echo $j; ?>" style="width:auto;"><?php _e('Percentage', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
71 |
+
<span class="wpallimport-clear"></span>
|
72 |
+
<div class="switcher-target-tax_calculate_logic_percentage_<?php echo $i; ?>_<?php echo $j; ?>" style="padding-left:25px;">
|
73 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
74 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][percentage_value]" style="width:100%;" value="<?php echo esc_attr($tax_rate['percentage_value']) ?>"/>
|
75 |
+
</span>
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
<span class="wpallimport-clear"></span>
|
79 |
+
<div class="form-field wpallimport-radio-field">
|
80 |
+
<input type="radio" id="tax_calculate_logic_per_unit_<?php echo $i; ?>_<?php echo $j; ?>" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][calculate_logic]" value="per_unit" <?php echo 'per_unit' == $tax_rate['calculate_logic'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
81 |
+
<label for="tax_calculate_logic_per_unit_<?php echo $i; ?>_<?php echo $j; ?>" style="width:auto;"><?php _e('Tax amount per unit', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
82 |
+
<span class="wpallimport-clear"></span>
|
83 |
+
<div class="switcher-target-tax_calculate_logic_per_unit_<?php echo $i; ?>_<?php echo $j; ?>" style="padding-left:25px;">
|
84 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
85 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][amount_per_unit]" style="width:100%;" value="<?php echo esc_attr($tax_rate['amount_per_unit']) ?>"/>
|
86 |
+
</span>
|
87 |
+
</div>
|
88 |
+
</div>
|
89 |
+
<span class="wpallimport-clear"></span>
|
90 |
+
<div class="form-field wpallimport-radio-field">
|
91 |
+
<input type="radio" id="tax_calculate_logic_lookup_<?php echo $i; ?>_<?php echo $j; ?>" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][<?php echo $i; ?>][calculate_logic]" value="loocup" <?php echo 'loocup' == $tax_rate['calculate_logic'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
92 |
+
<label for="tax_calculate_logic_lookup_<?php echo $i; ?>_<?php echo $j; ?>" style="width:auto;"><?php _e('Look up tax rate code', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
93 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If rate code is not found, this tax amount will not be imported.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
94 |
+
</div>
|
95 |
+
<hr style="margin-left: 20px;">
|
96 |
+
</td>
|
97 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
98 |
+
</tr>
|
99 |
+
<?php endforeach; ?>
|
100 |
+
<tr class="form-field template">
|
101 |
+
<td>
|
102 |
+
<div class="form-field">
|
103 |
+
<label><?php _e('Tax Rate Code', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
104 |
+
<div class="clear"></div>
|
105 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][ROWNUMBER][code]" style="width:100%;" value=""/>
|
106 |
+
</div>
|
107 |
+
|
108 |
+
<span class="wpallimport-clear"></span>
|
109 |
+
|
110 |
+
<p class="form-field"><?php _e("Calculate Tax Amount By:", PMWI_Plugin::TEXT_DOMAIN);?></p>
|
111 |
+
|
112 |
+
<div class="form-field wpallimport-radio-field">
|
113 |
+
<input type="radio" id="tax_calculate_logic_percentage_<?php echo $i; ?>_ROWNUMBER" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][ROWNUMBER][calculate_logic]" value="percentage" checked="checked" class="switcher"/>
|
114 |
+
<label for="tax_calculate_logic_percentage_<?php echo $i; ?>_ROWNUMBER" style="width:auto;"><?php _e('Percentage', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
115 |
+
<span class="wpallimport-clear"></span>
|
116 |
+
<div class="switcher-target-tax_calculate_logic_percentage_<?php echo $i; ?>_ROWNUMBER" style="padding-left:25px;">
|
117 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
118 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][ROWNUMBER][percentage_value]" style="width:100%;"/>
|
119 |
+
</span>
|
120 |
+
</div>
|
121 |
+
</div>
|
122 |
+
<span class="wpallimport-clear"></span>
|
123 |
+
<div class="form-field wpallimport-radio-field">
|
124 |
+
<input type="radio" id="tax_calculate_logic_per_unit_<?php echo $i; ?>_ROWNUMBER" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][ROWNUMBER][calculate_logic]" value="per_unit" class="switcher"/>
|
125 |
+
<label for="tax_calculate_logic_per_unit_<?php echo $i; ?>_ROWNUMBER" style="width:auto;"><?php _e('Tax amount per unit', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
126 |
+
<span class="wpallimport-clear"></span>
|
127 |
+
<div class="switcher-target-tax_calculate_logic_per_unit_<?php echo $i; ?>_ROWNUMBER" style="padding-left:25px;">
|
128 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
129 |
+
<input type="text" class="short rad4" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][ROWNUMBER][amount_per_unit]" style="width:100%;"/>
|
130 |
+
</span>
|
131 |
+
</div>
|
132 |
+
</div>
|
133 |
+
<span class="wpallimport-clear"></span>
|
134 |
+
<div class="form-field wpallimport-radio-field">
|
135 |
+
<input type="radio" id="tax_calculate_logic_lookup_<?php echo $i; ?>_ROWNUMBER" name="pmwi_order[products][<?php echo $i; ?>][tax_rates][ROWNUMBER][calculate_logic]" value="loocup" class="switcher"/>
|
136 |
+
<label for="tax_calculate_logic_lookup_<?php echo $i; ?>_ROWNUMBER" style="width:auto;"><?php _e('Look up tax rate code', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
137 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If rate code is not found, this tax amount will not be imported.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
138 |
+
</div>
|
139 |
+
<hr style="margin-left: 20px;">
|
140 |
+
</td>
|
141 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
142 |
+
</tr>
|
143 |
+
<!-- <tr>-->
|
144 |
+
<!-- <td colspan="2">-->
|
145 |
+
<!-- <div class="form-field"> -->
|
146 |
+
<!-- <a class="add-new-line" title="Add Tax" href="javascript:void(0);">--><?php //_e("Add Tax", " wp_all_import_plugin"); ?><!--</a>-->
|
147 |
+
<!-- </div>-->
|
148 |
+
<!-- </td>-->
|
149 |
+
<!-- </tr>-->
|
150 |
+
</table>
|
151 |
+
</span>
|
152 |
+
</div>
|
153 |
+
<!-- <hr> -->
|
154 |
+
</td>
|
155 |
+
<td class="action remove"><!--a href="#remove" style="top: 33px;"></a--></td>
|
156 |
+
</tr>
|
157 |
+
<?php endforeach; ?>
|
158 |
+
<tr class="template">
|
159 |
+
<td colspan="2">
|
160 |
+
<div style="float:left; width:50%;">
|
161 |
+
<label><?php _e('Product SKU', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
162 |
+
<input type="text" class="short rad4" name="pmwi_order[products][ROWNUMBER][sku]" value="" style="width:95%;"/>
|
163 |
+
</div>
|
164 |
+
<div style="float:right; width:50%;">
|
165 |
+
<label><?php _e('Quantity', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
166 |
+
<input type="text" class="short rad4" name="pmwi_order[products][ROWNUMBER][qty]" value="" style="width:95%;"/>
|
167 |
+
</div>
|
168 |
+
<div class="wpallimport-clear"></div>
|
169 |
+
<div style="float:right; width:50%;">
|
170 |
+
<label><?php _e('Price', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
171 |
+
<input type="text" class="short rad4" name="pmwi_order[products][ROWNUMBER][price_per_unit]" value="" style="width:95%;"/>
|
172 |
+
</div>
|
173 |
+
<div class="wpallimport-clear"></div>
|
174 |
+
<!-- Product Taxes -->
|
175 |
+
<!--a class="switcher" id="taxes_existing_products_ROWNUMBER" href="javascript:void(0);" style="display: block;margin: 10px 0 15px;width: 50px;"><span>-</span> <?php _e("Taxes", PMWI_Plugin::TEXT_DOMAIN); ?></a-->
|
176 |
+
<div class="wpallimport-clear"></div>
|
177 |
+
<div class="switcher-target-taxes_existing_products_ROWNUMBER">
|
178 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
179 |
+
<table style="width:45%;" class="taxes-form-table">
|
180 |
+
<tr class="form-field template">
|
181 |
+
<td>
|
182 |
+
<div class="form-field">
|
183 |
+
<label><?php _e('Tax Rate Code', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
184 |
+
<div class="clear"></div>
|
185 |
+
<input type="text" class="short rad4" name="pmwi_order[products][ROWNUMBER][tax_rates][CELLNUMBER][code]" style="width:100%;" value=""/>
|
186 |
+
</div>
|
187 |
+
|
188 |
+
<span class="wpallimport-clear"></span>
|
189 |
+
|
190 |
+
<p class="form-field"><?php _e("Calculate Tax Amount By:", PMWI_Plugin::TEXT_DOMAIN);?></p>
|
191 |
+
|
192 |
+
<div class="form-field wpallimport-radio-field">
|
193 |
+
<input type="radio" id="tax_calculate_logic_percentage_ROWNUMBER_CELLNUMBER" name="pmwi_order[products][ROWNUMBER][tax_rates][CELLNUMBER][calculate_logic]" value="percentage" checked="checked" class="switcher"/>
|
194 |
+
<label for="tax_calculate_logic_percentage_ROWNUMBER_CELLNUMBER" style="width:auto;"><?php _e('Percentage', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
195 |
+
<span class="wpallimport-clear"></span>
|
196 |
+
<div class="switcher-target-tax_calculate_logic_percentage_ROWNUMBER_CELLNUMBER" style="padding-left:25px;">
|
197 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
198 |
+
<input type="text" class="short rad4" name="pmwi_order[products][ROWNUMBER][tax_rates][CELLNUMBER][percentage_value]" style="width:100%;"/>
|
199 |
+
</span>
|
200 |
+
</div>
|
201 |
+
</div>
|
202 |
+
<span class="wpallimport-clear"></span>
|
203 |
+
<div class="form-field wpallimport-radio-field">
|
204 |
+
<input type="radio" id="tax_calculate_logic_per_unit_ROWNUMBER_CELLNUMBER" name="pmwi_order[products][ROWNUMBER][tax_rates][CELLNUMBER][calculate_logic]" value="per_unit" class="switcher"/>
|
205 |
+
<label for="tax_calculate_logic_per_unit_ROWNUMBER_CELLNUMBER" style="width:auto;"><?php _e('Tax amount per unit', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
206 |
+
<span class="wpallimport-clear"></span>
|
207 |
+
<div class="switcher-target-tax_calculate_logic_per_unit_ROWNUMBER_CELLNUMBER" style="padding-left:25px;">
|
208 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
209 |
+
<input type="text" class="short rad4" name="pmwi_order[products][ROWNUMBER][tax_rates][CELLNUMBER][amount_per_unit]" style="width:100%;"/>
|
210 |
+
</span>
|
211 |
+
</div>
|
212 |
+
</div>
|
213 |
+
<span class="wpallimport-clear"></span>
|
214 |
+
<div class="form-field wpallimport-radio-field">
|
215 |
+
<input type="radio" id="tax_calculate_logic_lookup_ROWNUMBER_CELLNUMBER" name="pmwi_order[products][ROWNUMBER][tax_rates][CELLNUMBER][calculate_logic]" value="loocup" class="switcher"/>
|
216 |
+
<label for="tax_calculate_logic_lookup_ROWNUMBER_CELLNUMBER" style="width:auto;"><?php _e('Look up tax rate code', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
217 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If rate code is not found, this tax amount will not be imported.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
218 |
+
</div>
|
219 |
+
<hr style="margin-left: 20px;">
|
220 |
+
</td>
|
221 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
222 |
+
</tr>
|
223 |
+
<!-- <tr>-->
|
224 |
+
<!-- <td colspan="2">-->
|
225 |
+
<!-- <div class="form-field"> -->
|
226 |
+
<!-- <a class="add-new-line" title="Add Tax" href="javascript:void(0);">--><?php //_e("Add Tax", " wp_all_import_plugin"); ?><!--</a>-->
|
227 |
+
<!-- </div>-->
|
228 |
+
<!-- </td>-->
|
229 |
+
<!-- </tr>-->
|
230 |
+
</table>
|
231 |
+
</span>
|
232 |
+
</div>
|
233 |
+
<!-- <hr> -->
|
234 |
+
</td>
|
235 |
+
<td class="action remove"><!--a href="#remove" style="top: 33px;"></a--></td>
|
236 |
+
</tr>
|
237 |
+
<tr class="wpallimport-row-actions" style="display:none;">
|
238 |
+
<td colspan="3">
|
239 |
+
<a class="add-new-line" title="Add Product" href="javascript:void(0);" style="width:200px;"><?php _e("Add Product", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
240 |
+
</td>
|
241 |
+
</tr>
|
242 |
+
</table>
|
243 |
+
</span>
|
244 |
+
</div>
|
245 |
+
<!-- Manually import product order data -->
|
246 |
+
<div class="clear"></div>
|
247 |
+
<div style="margin-top:0;">
|
248 |
+
<div class="form-field wpallimport-radio-field">
|
249 |
+
<input type="radio" id="products_source_new" name="pmwi_order[products_source]" value="new" <?php echo 'new' == $post['pmwi_order']['products_source'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
250 |
+
<label for="products_source_new" style="width:auto;"><?php _e('Manually import product order data and do not try to match to existing products', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
251 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('The product in this order will not be linked to any existing products.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:3px;">?</a>
|
252 |
+
</div>
|
253 |
+
<span class="wpallimport-clear"></span>
|
254 |
+
<div class="switcher-target-products_source_new" style="padding-left:45px;">
|
255 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
256 |
+
<table class="wpallimport_variable_table">
|
257 |
+
<?php
|
258 |
+
foreach ($post['pmwi_order']['manual_products'] as $i => $product):
|
259 |
+
|
260 |
+
$product += array(
|
261 |
+
'sku' => '',
|
262 |
+
'meta_name' => array(),
|
263 |
+
'meta_value' => array(),
|
264 |
+
'price_per_unit' => '',
|
265 |
+
'qty' => '',
|
266 |
+
'tax_rates' => array()
|
267 |
+
);
|
268 |
+
|
269 |
+
if (empty($product['sku'])) continue;
|
270 |
+
|
271 |
+
?>
|
272 |
+
<tr class="form-field">
|
273 |
+
<td colspan="2">
|
274 |
+
|
275 |
+
<label><?php _e('Product Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
276 |
+
<div class="clear"></div>
|
277 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i; ?>][sku]" value="<?php echo esc_attr($product['sku']) ?>" style="width:100%;"/>
|
278 |
+
|
279 |
+
<span class="wpallimport-clear"></span>
|
280 |
+
|
281 |
+
<table class="form-field">
|
282 |
+
<?php foreach ($product['meta_name'] as $j => $meta_name): if (empty($meta_name)) continue; ?>
|
283 |
+
<tr class="form-field">
|
284 |
+
<td style="padding-right:10px;">
|
285 |
+
<label><?php _e('Meta Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
286 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i;?>][meta_name][]" value="<?php echo esc_attr($meta_name); ?>" style="width:100%;"/>
|
287 |
+
</td>
|
288 |
+
<td style="padding-left:10px;">
|
289 |
+
<label><?php _e('Meta Value', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
290 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i;?>][meta_value][]" value="<?php echo esc_attr($product['meta_value'][$j]); ?>" style="width:100%;"/>
|
291 |
+
</td>
|
292 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
293 |
+
</tr>
|
294 |
+
<?php endforeach; ?>
|
295 |
+
<tr class="form-field template">
|
296 |
+
<td style="padding-right:10px;">
|
297 |
+
<label><?php _e('Meta Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
298 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][0][meta_name][]" value="" style="width:100%;"/>
|
299 |
+
</td>
|
300 |
+
<td style="padding-left:10px;">
|
301 |
+
<label><?php _e('Meta Value', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
302 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][0][meta_value][]" value="" style="width:100%;"/>
|
303 |
+
</td>
|
304 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
305 |
+
</tr>
|
306 |
+
<tr>
|
307 |
+
<td colspan="3">
|
308 |
+
<a class="add-new-line" title="Add Product Meta" href="javascript:void(0);" style="display:block;margin:5px 0;width:140px;top:0;padding-top:4px;"><?php empty($product['meta_name']) ? _e("Add Product Meta", PMWI_Plugin::TEXT_DOMAIN): _e("Add More Product Meta", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
309 |
+
</td>
|
310 |
+
</tr>
|
311 |
+
</table>
|
312 |
+
|
313 |
+
<table>
|
314 |
+
<tr>
|
315 |
+
<td style="padding-right:10px;">
|
316 |
+
<label><?php _e('Price per Unit', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
317 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i; ?>][price_per_unit]" value="<?php echo esc_attr($product['price_per_unit']) ?>" style="width:100%;"/>
|
318 |
+
</td>
|
319 |
+
<td style="padding-left: 10px;">
|
320 |
+
<label><?php _e('Quantity', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
321 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i; ?>][qty]" value="<?php echo esc_attr($product['qty']) ?>" style="width:100%;"/>
|
322 |
+
</td>
|
323 |
+
</tr>
|
324 |
+
</table>
|
325 |
+
|
326 |
+
<!--a class="switcher" id="taxes_manual_products_<?php echo $i; ?>" href="javascript:void(0);" style="display: block;margin: 10px 0 15px;width: 50px;"><span>-</span> <?php _e("Taxes", PMWI_Plugin::TEXT_DOMAIN); ?></a-->
|
327 |
+
<div class="wpallimport-clear"></div>
|
328 |
+
<div class="switcher-target-taxes_manual_products_<?php echo $i; ?>">
|
329 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
330 |
+
<table style="width:45%;" class="taxes-form-table">
|
331 |
+
<?php
|
332 |
+
foreach ($product['tax_rates'] as $j => $tax_rate):
|
333 |
+
|
334 |
+
$tax_rate += array('code' => '', 'calculate_logic' => 'percentage', 'percentage_value' => '', 'amount_per_unit' => '');
|
335 |
+
|
336 |
+
if (empty($tax_rate['code'])) continue;
|
337 |
+
|
338 |
+
?>
|
339 |
+
|
340 |
+
<tr class="form-field">
|
341 |
+
<td>
|
342 |
+
<div class="form-field">
|
343 |
+
<label><?php _e('Tax Rate Code', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
344 |
+
<div class="clear"></div>
|
345 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][code]" style="width:100%;" value="<?php echo esc_attr($tax_rate['code']) ?>"/>
|
346 |
+
</div>
|
347 |
+
|
348 |
+
<span class="wpallimport-clear"></span>
|
349 |
+
|
350 |
+
<p class="form-field"><?php _e("Calculate Tax Amount By:", PMWI_Plugin::TEXT_DOMAIN);?></p>
|
351 |
+
|
352 |
+
<div class="form-field wpallimport-radio-field">
|
353 |
+
<input type="radio" id="product_tax_calculate_logic_percentage_<?php echo $i . '_' . $j; ?>" name="pmwi_order[manual_products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][calculate_logic]" value="percentage" <?php echo 'percentage' == $tax_rate['calculate_logic'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
354 |
+
<label for="product_tax_calculate_logic_percentage_<?php echo $i . '_' . $j; ?>" style="width:auto;"><?php _e('Percentage', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
355 |
+
<span class="wpallimport-clear"></span>
|
356 |
+
<div class="switcher-target-product_tax_calculate_logic_percentage_<?php echo $i . '_' . $j; ?>" style="padding-left:25px;">
|
357 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
358 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][percentage_value]" style="width:100%;" value="<?php echo esc_attr($tax_rate['percentage_value']) ?>"/>
|
359 |
+
</span>
|
360 |
+
</div>
|
361 |
+
</div>
|
362 |
+
<span class="wpallimport-clear"></span>
|
363 |
+
<div class="form-field wpallimport-radio-field">
|
364 |
+
<input type="radio" id="product_tax_calculate_logic_per_unit_<?php echo $i . '_' . $j; ?>" name="pmwi_order[manual_products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][calculate_logic]" value="per_unit" <?php echo 'per_unit' == $tax_rate['calculate_logic'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
365 |
+
<label for="product_tax_calculate_logic_per_unit_<?php echo $i . '_' . $j; ?>" style="width:auto;"><?php _e('Tax amount per unit', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
366 |
+
<span class="wpallimport-clear"></span>
|
367 |
+
<div class="switcher-target-product_tax_calculate_logic_per_unit_<?php echo $i . '_' . $j; ?>" style="padding-left:25px;">
|
368 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
369 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][amount_per_unit]" style="width:100%;" value="<?php echo esc_attr($tax_rate['amount_per_unit']) ?>"/>
|
370 |
+
</span>
|
371 |
+
</div>
|
372 |
+
</div>
|
373 |
+
<span class="wpallimport-clear"></span>
|
374 |
+
<div class="form-field wpallimport-radio-field">
|
375 |
+
<input type="radio" id="product_tax_calculate_logic_lookup_<?php echo $i . '_' . $j; ?>" name="pmwi_order[manual_products][<?php echo $i; ?>][tax_rates][<?php echo $j; ?>][calculate_logic]" value="loocup" <?php echo 'loocup' == $tax_rate['calculate_logic'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
376 |
+
<label for="product_tax_calculate_logic_lookup_<?php echo $i . '_' . $j; ?>" style="width:auto;"><?php _e('Look up tax rate code', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
377 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If rate code is not found, this tax amount will not be imported.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
378 |
+
</div>
|
379 |
+
<hr style="margin-left: 20px;">
|
380 |
+
</td>
|
381 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
382 |
+
</tr>
|
383 |
+
|
384 |
+
<?php endforeach; ?>
|
385 |
+
<tr class="form-field template">
|
386 |
+
<td>
|
387 |
+
<div class="form-field">
|
388 |
+
<label><?php _e('Tax Rate Code', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
389 |
+
<div class="clear"></div>
|
390 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i;?>][tax_rates][ROWNUMBER][code]" style="width:100%;" value=""/>
|
391 |
+
</div>
|
392 |
+
|
393 |
+
<span class="wpallimport-clear"></span>
|
394 |
+
|
395 |
+
<p class="form-field"><?php _e("Calculate Tax Amount By:", PMWI_Plugin::TEXT_DOMAIN);?></p>
|
396 |
+
|
397 |
+
<div class="form-field wpallimport-radio-field">
|
398 |
+
<input type="radio" id="product_tax_calculate_logic_percentage_<?php echo $i;?>_ROWNUMBER" name="pmwi_order[manual_products][<?php echo $i;?>][tax_rates][ROWNUMBER][calculate_logic]" value="percentage" checked="checked" class="switcher"/>
|
399 |
+
<label for="product_tax_calculate_logic_percentage_<?php echo $i;?>_ROWNUMBER" style="width:auto;"><?php _e('Percentage', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
400 |
+
<span class="wpallimport-clear"></span>
|
401 |
+
<div class="switcher-target-product_tax_calculate_logic_percentage_<?php echo $i;?>_ROWNUMBER" style="padding-left:25px;">
|
402 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
403 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i;?>][tax_rates][ROWNUMBER][percentage_value]" style="width:100%;" value=""/>
|
404 |
+
</span>
|
405 |
+
</div>
|
406 |
+
</div>
|
407 |
+
<span class="wpallimport-clear"></span>
|
408 |
+
<div class="form-field wpallimport-radio-field">
|
409 |
+
<input type="radio" id="product_tax_calculate_logic_per_unit_<?php echo $i;?>_ROWNUMBER" name="pmwi_order[manual_products][<?php echo $i;?>][tax_rates][ROWNUMBER][calculate_logic]" value="per_unit" class="switcher"/>
|
410 |
+
<label for="product_tax_calculate_logic_per_unit_<?php echo $i;?>_ROWNUMBER" style="width:auto;"><?php _e('Tax amount per unit', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
411 |
+
<span class="wpallimport-clear"></span>
|
412 |
+
<div class="switcher-target-product_tax_calculate_logic_per_unit_<?php echo $i;?>_ROWNUMBER" style="padding-left:25px;">
|
413 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
414 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][<?php echo $i;?>][tax_rates][ROWNUMBER][amount_per_unit]" style="width:100%;" value=""/>
|
415 |
+
</span>
|
416 |
+
</div>
|
417 |
+
</div>
|
418 |
+
<span class="wpallimport-clear"></span>
|
419 |
+
<div class="form-field wpallimport-radio-field">
|
420 |
+
<input type="radio" id="product_tax_calculate_logic_lookup_<?php echo $i;?>_ROWNUMBER" name="pmwi_order[manual_products][<?php echo $i;?>][tax_rates][ROWNUMBER][calculate_logic]" value="loocup" class="switcher"/>
|
421 |
+
<label for="product_tax_calculate_logic_lookup_<?php echo $i;?>_ROWNUMBER" style="width:auto;"><?php _e('Look up tax rate code', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
422 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If rate code is not found, this tax amount will not be imported.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
423 |
+
</div>
|
424 |
+
<hr style="margin-left: 20px;">
|
425 |
+
</td>
|
426 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
427 |
+
</tr>
|
428 |
+
<!-- <tr>-->
|
429 |
+
<!-- <td colspan="2">-->
|
430 |
+
<!-- <div class="form-field"> -->
|
431 |
+
<!-- <a class="add-new-line" title="Add Tax" href="javascript:void(0);">--><?php //_e("Add Tax", " wp_all_import_plugin"); ?><!--</a>-->
|
432 |
+
<!-- </div>-->
|
433 |
+
<!-- </td>-->
|
434 |
+
<!-- </tr>-->
|
435 |
+
</table>
|
436 |
+
</span>
|
437 |
+
</div>
|
438 |
+
<!-- <hr> -->
|
439 |
+
</td>
|
440 |
+
<td class="action remove"><!--a href="#remove" style="top: 33px;"></a--></td>
|
441 |
+
</tr>
|
442 |
+
|
443 |
+
<?php endforeach; ?>
|
444 |
+
<tr class="form-field template">
|
445 |
+
<td colspan="2">
|
446 |
+
|
447 |
+
<label><?php _e('Product Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
448 |
+
<div class="clear"></div>
|
449 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][ROWNUMBER][sku]" value="" style="width:100%;"/>
|
450 |
+
|
451 |
+
<span class="wpallimport-clear"></span>
|
452 |
+
|
453 |
+
<table class="form-field">
|
454 |
+
<tr class="form-field template">
|
455 |
+
<td style="padding-right:10px;">
|
456 |
+
<label><?php _e('Meta Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
457 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][ROWNUMBER][meta_name][]" value="" style="width:100%;"/>
|
458 |
+
</td>
|
459 |
+
<td style="padding-left:10px;">
|
460 |
+
<label><?php _e('Meta Value', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
461 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][ROWNUMBER][meta_value][]" value="" style="width:100%;"/>
|
462 |
+
</td>
|
463 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
464 |
+
</tr>
|
465 |
+
<tr>
|
466 |
+
<td colspan="3">
|
467 |
+
<a class="add-new-line" title="Add Product Meta" href="javascript:void(0);" style="display:block; margin: 5px 0; width:140px; top:0;padding-top:4px;"><?php _e("Add Product Meta", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
468 |
+
</td>
|
469 |
+
</tr>
|
470 |
+
</table>
|
471 |
+
|
472 |
+
<table>
|
473 |
+
<tr>
|
474 |
+
<td style="padding-right:10px;">
|
475 |
+
<label><?php _e('Price per Unit', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
476 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][ROWNUMBER][price_per_unit]" value="" style="width:100%;"/>
|
477 |
+
</td>
|
478 |
+
<td style="padding-left:10px;">
|
479 |
+
<label><?php _e('Quantity', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
480 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][ROWNUMBER][qty]" value="" style="width:100%;"/>
|
481 |
+
</td>
|
482 |
+
</tr>
|
483 |
+
</table>
|
484 |
+
|
485 |
+
<!--a class="switcher" id="taxes_manual_products_ROWNUMBER" href="javascript:void(0);" style="display: block;margin: 10px 0 15px;width: 50px;"><span>-</span> <?php _e("Taxes", PMWI_Plugin::TEXT_DOMAIN); ?></a-->
|
486 |
+
<div class="wpallimport-clear"></div>
|
487 |
+
<div class="switcher-target-taxes_manual_products_ROWNUMBER">
|
488 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
489 |
+
<table style="width:45%;" class="taxes-form-table">
|
490 |
+
<tr class="form-field template">
|
491 |
+
<td>
|
492 |
+
<div class="form-field">
|
493 |
+
<label><?php _e('Tax Rate Code', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
494 |
+
<div class="clear"></div>
|
495 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][ROWNUMBER][tax_rates][CELLNUMBER][code]" style="width:100%;" value=""/>
|
496 |
+
</div>
|
497 |
+
|
498 |
+
<span class="wpallimport-clear"></span>
|
499 |
+
|
500 |
+
<p class="form-field"><?php _e("Calculate Tax Amount By:", PMWI_Plugin::TEXT_DOMAIN);?></p>
|
501 |
+
|
502 |
+
<div class="form-field wpallimport-radio-field">
|
503 |
+
<input type="radio" id="product_tax_calculate_logic_percentage_ROWNUMBER_CELLNUMBER" name="pmwi_order[manual_products][ROWNUMBER][tax_rates][CELLNUMBER][calculate_logic]" value="percentage" checked="checked" class="switcher"/>
|
504 |
+
<label for="product_tax_calculate_logic_percentage_ROWNUMBER_CELLNUMBER" style="width:auto;"><?php _e('Percentage', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
505 |
+
<span class="wpallimport-clear"></span>
|
506 |
+
<div class="switcher-target-product_tax_calculate_logic_percentage_ROWNUMBER_CELLNUMBER" style="padding-left:25px;">
|
507 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
508 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][ROWNUMBER][tax_rates][CELLNUMBER][percentage_value]" style="width:100%;" value=""/>
|
509 |
+
</span>
|
510 |
+
</div>
|
511 |
+
</div>
|
512 |
+
<span class="wpallimport-clear"></span>
|
513 |
+
<div class="form-field wpallimport-radio-field">
|
514 |
+
<input type="radio" id="product_tax_calculate_logic_per_unit_ROWNUMBER_CELLNUMBER" name="pmwi_order[manual_products][ROWNUMBER][tax_rates][CELLNUMBER][calculate_logic]" value="per_unit" class="switcher"/>
|
515 |
+
<label for="product_tax_calculate_logic_per_unit_ROWNUMBER_CELLNUMBER" style="width:auto;"><?php _e('Tax amount per unit', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
516 |
+
<span class="wpallimport-clear"></span>
|
517 |
+
<div class="switcher-target-product_tax_calculate_logic_per_unit_ROWNUMBER_CELLNUMBER" style="padding-left:25px;">
|
518 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
519 |
+
<input type="text" class="short rad4" name="pmwi_order[manual_products][ROWNUMBER][tax_rates][CELLNUMBER][amount_per_unit]" style="width:100%;" value=""/>
|
520 |
+
</span>
|
521 |
+
</div>
|
522 |
+
</div>
|
523 |
+
<span class="wpallimport-clear"></span>
|
524 |
+
<div class="form-field wpallimport-radio-field">
|
525 |
+
<input type="radio" id="product_tax_calculate_logic_lookup_ROWNUMBER_CELLNUMBER" name="pmwi_order[manual_products][ROWNUMBER][tax_rates][CELLNUMBER][calculate_logic]" value="loocup" class="switcher"/>
|
526 |
+
<label for="product_tax_calculate_logic_lookup_ROWNUMBER_CELLNUMBER" style="width:auto;"><?php _e('Look up tax rate code', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
527 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If rate code is not found, this tax amount will not be imported.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
528 |
+
</div>
|
529 |
+
<hr style="margin-left: 20px;">
|
530 |
+
</td>
|
531 |
+
<td class="action remove"><a href="#remove" style="top: 33px;"></a></td>
|
532 |
+
</tr>
|
533 |
+
<!-- <tr>-->
|
534 |
+
<!-- <td colspan="2">-->
|
535 |
+
<!-- <div class="form-field"> -->
|
536 |
+
<!-- <a class="add-new-line" title="Add Tax" href="javascript:void(0);">--><?php //_e("Add Tax", " wp_all_import_plugin"); ?><!--</a>-->
|
537 |
+
<!-- </div>-->
|
538 |
+
<!-- </td>-->
|
539 |
+
<!-- </tr>-->
|
540 |
+
</table>
|
541 |
+
</span>
|
542 |
+
</div>
|
543 |
+
<!-- <hr> -->
|
544 |
+
</td>
|
545 |
+
<td class="action remove"><!--a href="#remove" style="top: 33px;"></a--></td>
|
546 |
+
</tr>
|
547 |
+
<tr class="wpallimport-row-actions" style="display:none;">
|
548 |
+
<td colspan="3">
|
549 |
+
<a class="add-new-line" title="Add Product" href="javascript:void(0);" style="width:200px;"><?php _e("Add Product", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
550 |
+
</td>
|
551 |
+
</tr>
|
552 |
+
</table>
|
553 |
+
</span>
|
554 |
+
</div>
|
555 |
+
</div>
|
556 |
+
</div>
|
557 |
+
<div class="wpallimport-collapsed closed wpallimport-section order-imports">
|
558 |
+
<div style="margin:0; background: #FAFAFA;" class="wpallimport-content-section rad4 order-imports">
|
559 |
+
<div class="wpallimport-collapsed-header">
|
560 |
+
<h3 style="color:#40acad; font-size: 14px;"><?php _e("Advanced Options",PMWI_Plugin::TEXT_DOMAIN); ?></h3>
|
561 |
+
</div>
|
562 |
+
<div style="padding: 0px;" class="wpallimport-collapsed-content">
|
563 |
+
<div class="wpallimport-collapsed-content-inner">
|
564 |
+
<?php if ( empty(PMXI_Plugin::$session->options['delimiter']) ): ?>
|
565 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
566 |
+
<input type="radio" id="products_repeater_mode_variable_csv" name="pmwi_order[products_repeater_mode]" value="csv" <?php echo 'csv' == $post['pmwi_order']['products_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
567 |
+
<label for="products_repeater_mode_variable_csv" style="width:auto; float: none;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
568 |
+
<div class="switcher-target-products_repeater_mode_variable_csv wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
569 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
570 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple products separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
571 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[products_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['products_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
572 |
+
</span>
|
573 |
+
</div>
|
574 |
+
</div>
|
575 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
576 |
+
<input type="radio" id="products_repeater_mode_variable_xml" name="pmwi_order[products_repeater_mode]" value="xml" <?php echo 'xml' == $post['pmwi_order']['products_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
577 |
+
<label for="products_repeater_mode_variable_xml" style="width:auto; float: none;"><?php _e('Variable Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
578 |
+
<div class="switcher-target-products_repeater_mode_variable_xml wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
579 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
580 |
+
<label style="width: 60px; line-height: 30px;"><?php _e('For each', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
581 |
+
<input type="text" class="short rad4" name="pmwi_order[products_repeater_mode_foreach]" value="<?php echo esc_attr($post['pmwi_order']['products_repeater_mode_foreach']) ?>" style="width:50%;"/>
|
582 |
+
<label class="foreach-do" style="padding-left: 10px; line-height: 30px;"><?php _e('do...', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
583 |
+
</span>
|
584 |
+
</div>
|
585 |
+
</div>
|
586 |
+
<?php else: ?>
|
587 |
+
<input type="hidden" name="pmwi_order[products_repeater_mode]" value="csv"/>
|
588 |
+
<div class="form-field input" style="margin-bottom: 20px;">
|
589 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple products separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
590 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[products_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['products_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
591 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two products would be imported like this SKU1|SKU2, and their quantities like this 15|20">?</a>
|
592 |
+
</div>
|
593 |
+
<?php endif; ?>
|
594 |
+
</div>
|
595 |
+
</div>
|
596 |
+
</div>
|
597 |
+
</div>
|
598 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_item_refunds.php
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="order_refunds" style="display:none;">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<table class="form-field" style="width:98%;" cellspacing="5">
|
4 |
+
<tr>
|
5 |
+
<td>
|
6 |
+
<label><?php _e('Refund Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
7 |
+
<div class="clear">
|
8 |
+
<input type="text" class="rad4" name="pmwi_order[order_refund_amount]" value="<?php echo esc_attr($post['pmwi_order']['order_refund_amount']) ?>" style="width:100%;"/>
|
9 |
+
</div>
|
10 |
+
</td>
|
11 |
+
<td>
|
12 |
+
<label><?php _e('Reason', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
13 |
+
<div class="clear">
|
14 |
+
<input type="text" class="rad4" name="pmwi_order[order_refund_reason]" value="<?php echo esc_attr($post['pmwi_order']['order_refund_reason']) ?>" style="width:100%;"/>
|
15 |
+
</div>
|
16 |
+
</td>
|
17 |
+
</tr>
|
18 |
+
<tr>
|
19 |
+
<td colspan="2">
|
20 |
+
<label><?php _e('Date', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
21 |
+
<div class="clear">
|
22 |
+
<input type="text" class="datepicker rad4" name="pmwi_order[order_refund_date]" value="<?php echo esc_attr($post['pmwi_order']['order_refund_date']) ?>"/>
|
23 |
+
</div>
|
24 |
+
<span class="wpallimport-clear"></span>
|
25 |
+
|
26 |
+
<label style="padding-top:10px;"><?php _e('Refund Issued By', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
27 |
+
<div class="clear" style="margin-top:0;">
|
28 |
+
<div class="wpallimport-radio-field">
|
29 |
+
<input type="radio" id="order_refund_issued_source_existing" name="pmwi_order[order_refund_issued_source]" value="existing" <?php echo 'existing' == $post['pmwi_order']['order_refund_issued_source'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
30 |
+
<label for="order_refund_issued_source_existing" style="width:auto;"><?php _e('Load details from existing user', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
31 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('If no user is matched, refund issuer will be left blank.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top: 3px;">?</a>
|
32 |
+
</div>
|
33 |
+
<span class="wpallimport-clear"></span>
|
34 |
+
<div class="switcher-target-order_refund_issued_source_existing" style="padding-left:7px;">
|
35 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
36 |
+
<p class="form-field"><?php _e('Match user by:', PMWI_Plugin::TEXT_DOMAIN); ?></p>
|
37 |
+
<!-- Match user by Username -->
|
38 |
+
<div class="form-field wpallimport-radio-field">
|
39 |
+
<input type="radio" id="order_refund_issued_match_by_username" name="pmwi_order[order_refund_issued_match_by]" value="username" <?php echo 'username' == $post['pmwi_order']['order_refund_issued_match_by'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
40 |
+
<label for="order_refund_issued_match_by_username"><?php _e('Username', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
41 |
+
<span class="wpallimport-clear"></span>
|
42 |
+
<div class="switcher-target-order_refund_issued_match_by_username set_with_xpath">
|
43 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
44 |
+
<input type="text" class="short rad4" name="pmwi_order[order_refund_issued_username]" style="" value="<?php echo esc_attr($post['pmwi_order']['order_refund_issued_username']) ?>"/>
|
45 |
+
</span>
|
46 |
+
</div>
|
47 |
+
</div>
|
48 |
+
<div class="clear"></div>
|
49 |
+
<!-- Match user by Email -->
|
50 |
+
<div class="form-field wpallimport-radio-field">
|
51 |
+
<input type="radio" id="order_refund_issued_match_by_email" name="pmwi_order[order_refund_issued_match_by]" value="email" <?php echo 'email' == $post['pmwi_order']['order_refund_issued_match_by'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
52 |
+
<label for="order_refund_issued_match_by_email"><?php _e('Email', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
53 |
+
<span class="wpallimport-clear"></span>
|
54 |
+
<div class="switcher-target-order_refund_issued_match_by_email set_with_xpath">
|
55 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
56 |
+
<input type="text" class="short rad4" name="pmwi_order[order_refund_issued_email]" style="" value="<?php echo esc_attr($post['pmwi_order']['order_refund_issued_email']) ?>"/>
|
57 |
+
</span>
|
58 |
+
</div>
|
59 |
+
</div>
|
60 |
+
<div class="clear"></div>
|
61 |
+
<!-- Match user by Custom Field -->
|
62 |
+
<div class="form-field wpallimport-radio-field">
|
63 |
+
<input type="radio" id="order_refund_issued_by_cf" name="pmwi_order[order_refund_issued_match_by]" value="cf" <?php echo 'cf' == $post['pmwi_order']['order_refund_issued_match_by'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
64 |
+
<label for="order_refund_issued_by_cf"><?php _e('Custom Field', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
65 |
+
<span class="wpallimport-clear"></span>
|
66 |
+
<div class="switcher-target-order_refund_issued_by_cf set_with_xpath">
|
67 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
68 |
+
<p>
|
69 |
+
<label style="line-height: 30px;"><?php _e('Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
70 |
+
<input type="text" class="short rad4" name="pmwi_order[order_refund_issued_cf_name]" style="" value="<?php echo esc_attr($post['pmwi_order']['order_refund_issued_cf_name']) ?>"/>
|
71 |
+
</p>
|
72 |
+
<p>
|
73 |
+
<label style="line-height: 30px;"><?php _e('Value', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
74 |
+
<input type="text" class="short rad4" name="pmwi_order[order_refund_issued_cf_value]" style="" value="<?php echo esc_attr($post['pmwi_order']['order_refund_issued_cf_value']) ?>"/>
|
75 |
+
</p>
|
76 |
+
</span>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
<div class="clear"></div>
|
80 |
+
<!-- Match user by user ID -->
|
81 |
+
<div class="form-field wpallimport-radio-field">
|
82 |
+
<input type="radio" id="order_refund_issued_by_id" name="pmwi_order[order_refund_issued_match_by]" value="id" <?php echo 'id' == $post['pmwi_order']['order_refund_issued_match_by'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
83 |
+
<label for="order_refund_issued_by_id"><?php _e('User ID', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
84 |
+
<span class="wpallimport-clear"></span>
|
85 |
+
<div class="switcher-target-order_refund_issued_by_id set_with_xpath">
|
86 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
87 |
+
<input type="text" class="short rad4" name="pmwi_order[order_refund_issued_id]" style="" value="<?php echo esc_attr($post['pmwi_order']['order_refund_issued_id']) ?>"/>
|
88 |
+
</span>
|
89 |
+
</div>
|
90 |
+
</div>
|
91 |
+
</span>
|
92 |
+
</div>
|
93 |
+
</div>
|
94 |
+
<div class="clear"></div>
|
95 |
+
<div style="margin-top:0;">
|
96 |
+
<div class="wpallimport-radio-field">
|
97 |
+
<input type="radio" id="order_refund_issued_source_blank" name="pmwi_order[order_refund_issued_source]" value="blank" <?php echo 'blank' == $post['pmwi_order']['order_refund_issued_source'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
98 |
+
<label for="order_refund_issued_source_blank" style="width:auto;"><?php _e('Leave refund issuer blank', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
99 |
+
</div>
|
100 |
+
</div>
|
101 |
+
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
</table>
|
105 |
+
</div>
|
106 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_item_shipping.php
ADDED
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="order_shipping" style="display:none;">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<!-- Shipping matching mode -->
|
4 |
+
<!-- <div class="form-field wpallimport-radio-field wpallimport-clear">
|
5 |
+
<input type="radio" id="shipping_repeater_mode_fixed" name="pmwi_order[shipping_repeater_mode]" value="fixed" <?php echo 'fixed' == $post['pmwi_order']['shipping_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
6 |
+
<label for="shipping_repeater_mode_fixed" style="width:auto;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
7 |
+
</div> -->
|
8 |
+
<table class="form-field wpallimport_variable_table" style="width:98%;">
|
9 |
+
<?php
|
10 |
+
foreach ($post['pmwi_order']['shipping'] as $i => $shipping):
|
11 |
+
|
12 |
+
$shipping += array('name' => '', 'amount' => '', 'class' => '', 'class_xpath' => '');
|
13 |
+
|
14 |
+
if (empty($shipping['name'])) continue;
|
15 |
+
|
16 |
+
?>
|
17 |
+
|
18 |
+
<tr class="form-field">
|
19 |
+
<td>
|
20 |
+
<table style="width:100%;" cellspacing="5">
|
21 |
+
<tr>
|
22 |
+
<td>
|
23 |
+
<label><?php _e('Shipping Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
24 |
+
<div class="clear">
|
25 |
+
<input type="text" class="rad4" name="pmwi_order[shipping][<?php echo $i;?>][name]" value="<?php echo esc_attr($shipping['name']) ?>" style="width:100%;"/>
|
26 |
+
</div>
|
27 |
+
</td>
|
28 |
+
<td>
|
29 |
+
<label><?php _e('Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
30 |
+
<div class="clear">
|
31 |
+
<input type="text" class="rad4" name="pmwi_order[shipping][<?php echo $i;?>][amount]" value="<?php echo esc_attr($shipping['amount']) ?>" style="width:100%;"/>
|
32 |
+
</div>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
<tr>
|
36 |
+
<td colspan="2">
|
37 |
+
<label><?php _e('Shipping Method', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
38 |
+
<span class="wpallimport-clear"></span>
|
39 |
+
<select name="pmwi_order[shipping][<?php echo $i;?>][class]" id="order_shipping_class_<?php echo $i; ?>" class="rad4 switcher" style="font-size: 14px !important;">
|
40 |
+
<?php
|
41 |
+
$shipping_for_tooltip = array();
|
42 |
+
foreach ( WC()->shipping->get_shipping_methods() as $method_key => $method ) {
|
43 |
+
echo '<option value="'. $method_key .'" '. ( ($shipping['class'] == $method_key) ? 'selected="selected"' : '' ) .'>' . $method->method_title . '</option>';
|
44 |
+
$shipping_for_tooltip[] = $method_key;
|
45 |
+
}
|
46 |
+
?>
|
47 |
+
<option value="xpath" <?php if ("xpath" == $shipping['class']) echo 'selected="selected"';?>><?php _e("Set with XPath", PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
48 |
+
</select>
|
49 |
+
<span class="wpallimport-clear"></span>
|
50 |
+
<div class="switcher-target-order_shipping_class_<?php echo $i; ?>" style="margin-top:10px;">
|
51 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
52 |
+
<input type="text" class="short rad4" name="pmwi_order[shipping][<?php echo $i;?>][class_xpath]" value="<?php echo esc_attr($shipping['class_xpath']) ?>"/>
|
53 |
+
<a href="#help" class="wpallimport-help" title="<?php printf(__('Shipping method can be matched by Name or ID: %s. If shipping method is not found then no shipping information will be imported.', PMWI_Plugin::TEXT_DOMAIN), implode(", ", $shipping_for_tooltip)); ?>" style="position:relative; top:10px;">?</a>
|
54 |
+
</span>
|
55 |
+
</div>
|
56 |
+
</td>
|
57 |
+
</tr>
|
58 |
+
</table>
|
59 |
+
</td>
|
60 |
+
<td class="action remove"><!--a href="#remove" style="top: 39px;"></a--></td>
|
61 |
+
</tr>
|
62 |
+
|
63 |
+
<?php endforeach; ?>
|
64 |
+
|
65 |
+
<tr class="form-field template">
|
66 |
+
<td>
|
67 |
+
<table style="width:100%;" cellspacing="5">
|
68 |
+
<tr>
|
69 |
+
<td>
|
70 |
+
<label><?php _e('Shipping Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
71 |
+
<div class="clear">
|
72 |
+
<input type="text" class="rad4" name="pmwi_order[shipping][ROWNUMBER][name]" value="" style="width:100%;"/>
|
73 |
+
</div>
|
74 |
+
</td>
|
75 |
+
<td>
|
76 |
+
<label><?php _e('Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
77 |
+
<div class="clear">
|
78 |
+
<input type="text" class="rad4" name="pmwi_order[shipping][ROWNUMBER][amount]" value="" style="width:100%;"/>
|
79 |
+
</div>
|
80 |
+
</td>
|
81 |
+
</tr>
|
82 |
+
<tr>
|
83 |
+
<td colspan="2">
|
84 |
+
<label><?php _e('Shipping Method', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
85 |
+
<span class="wpallimport-clear"></span>
|
86 |
+
<select name="pmwi_order[shipping][ROWNUMBER][class]" id="order_shipping_class_ROWNUMBER" class="rad4 switcher" style="font-size: 14px !important;">
|
87 |
+
<?php
|
88 |
+
foreach ( WC()->shipping->get_shipping_methods() as $method_key => $method ) {
|
89 |
+
$methodTitle = empty($method->method_title) ? $method->title : $method->method_title;
|
90 |
+
echo '<option value="'. $method_key .'">' . $methodTitle . '</option>';
|
91 |
+
}
|
92 |
+
?>
|
93 |
+
<option value="xpath"><?php _e("Set with XPath", PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
94 |
+
</select>
|
95 |
+
<span class="wpallimport-clear"></span>
|
96 |
+
<div class="switcher-target-order_shipping_class_ROWNUMBER" style="margin-top:10px; display: none;">
|
97 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
98 |
+
<input type="text" class="short rad4" name="pmwi_order[shipping][ROWNUMBER][class_xpath]" value=""/>
|
99 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Shipping method can be matched by Name or ID. If shipping method is not found then no shipping information will be imported.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
100 |
+
</span>
|
101 |
+
</div>
|
102 |
+
</td>
|
103 |
+
</tr>
|
104 |
+
</table>
|
105 |
+
</td>
|
106 |
+
<td class="action remove"><!--a href="#remove" style="top: 39px;"></a--></td>
|
107 |
+
</tr>
|
108 |
+
<tr class="wpallimport-row-actions" style="display:none;">
|
109 |
+
<td colspan="2">
|
110 |
+
<hr>
|
111 |
+
<a class="add-new-line" title="Add More" href="javascript:void(0);" style="width:200px;"><?php _e("Add More", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
112 |
+
</td>
|
113 |
+
</tr>
|
114 |
+
</table>
|
115 |
+
</div>
|
116 |
+
<div class="wpallimport-collapsed closed wpallimport-section order-imports">
|
117 |
+
<div style="margin:0; background: #FAFAFA;" class="wpallimport-content-section rad4 order-imports">
|
118 |
+
<div class="wpallimport-collapsed-header">
|
119 |
+
<h3 style="color:#40acad; font-size: 14px;"><?php _e("Advanced Options",PMWI_Plugin::TEXT_DOMAIN); ?></h3>
|
120 |
+
</div>
|
121 |
+
<div style="padding: 0px;" class="wpallimport-collapsed-content">
|
122 |
+
<div class="wpallimport-collapsed-content-inner">
|
123 |
+
<?php if ( empty(PMXI_Plugin::$session->options['delimiter']) ): ?>
|
124 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
125 |
+
<input type="radio" id="shipping_repeater_mode_variable_csv" name="pmwi_order[shipping_repeater_mode]" value="csv" <?php echo 'csv' == $post['pmwi_order']['shipping_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
126 |
+
<label for="shipping_repeater_mode_variable_csv" style="width:auto; float: none;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
127 |
+
<div class="switcher-target-shipping_repeater_mode_variable_csv wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
128 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
129 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple shipping costs separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
130 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[shipping_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['shipping_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
131 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two shipping names would be imported like this 'Shipping 1|Shipping 2' and the shipping amounts like this 10|20">?</a>
|
132 |
+
</span>
|
133 |
+
</div>
|
134 |
+
</div>
|
135 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
136 |
+
<input type="radio" id="shipping_repeater_mode_variable_xml" name="pmwi_order[shipping_repeater_mode]" value="xml" <?php echo 'xml' == $post['pmwi_order']['shipping_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
137 |
+
<label for="shipping_repeater_mode_variable_xml" style="width:auto; float: none;"><?php _e('Variable Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
138 |
+
<div class="switcher-target-shipping_repeater_mode_variable_xml wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
139 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
140 |
+
<label style="width: 60px; line-height: 30px;"><?php _e('For each', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
141 |
+
<input type="text" class="short rad4" name="pmwi_order[shipping_repeater_mode_foreach]" value="<?php echo esc_attr($post['pmwi_order']['shipping_repeater_mode_foreach']) ?>" style="width:50%;"/>
|
142 |
+
<label class="foreach-do" style="padding-left: 10px; line-height: 30px;"><?php _e('do...', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
143 |
+
</span>
|
144 |
+
</div>
|
145 |
+
</div>
|
146 |
+
<?php else: ?>
|
147 |
+
<input type="hidden" name="pmwi_order[shipping_repeater_mode]" value="csv"/>
|
148 |
+
<div class="form-field input" style="margin-bottom: 20px;">
|
149 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple shipping costs separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
150 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[shipping_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['shipping_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
151 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two shipping names would be imported like this 'Shipping 1|Shipping 2' and the shipping amounts like this 10|20">?</a>
|
152 |
+
</div>
|
153 |
+
<?php endif; ?>
|
154 |
+
</div>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
+
</div>
|
158 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_item_taxes.php
ADDED
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="order_taxes" style="display:none;">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<!-- Taxes matching mode -->
|
4 |
+
<!-- <div class="form-field wpallimport-radio-field wpallimport-clear">
|
5 |
+
<input type="radio" id="taxes_repeater_mode_fixed" name="pmwi_order[taxes_repeater_mode]" value="fixed" <?php echo 'fixed' == $post['pmwi_order']['taxes_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
6 |
+
<label for="taxes_repeater_mode_fixed" style="width:auto;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
7 |
+
</div> -->
|
8 |
+
<table class="form-field wpallimport_variable_table" style="width:98%;">
|
9 |
+
<?php
|
10 |
+
$tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) );
|
11 |
+
$classes_options = array();
|
12 |
+
$classes_options[''] = __( 'Standard', PMWI_Plugin::TEXT_DOMAIN );
|
13 |
+
if ( $tax_classes )
|
14 |
+
{
|
15 |
+
foreach ( $tax_classes as $class )
|
16 |
+
{
|
17 |
+
$classes_options[ sanitize_title( $class ) ] = esc_html( $class );
|
18 |
+
}
|
19 |
+
}
|
20 |
+
|
21 |
+
foreach ($post['pmwi_order']['taxes'] as $i => $tax):
|
22 |
+
|
23 |
+
$tax += array('tax_code' => '', 'tax_amount' => '', 'shipping_tax_amount' => '', 'tax_code_xpath' => '');
|
24 |
+
|
25 |
+
if (empty($tax['tax_code'])) continue;
|
26 |
+
|
27 |
+
?>
|
28 |
+
|
29 |
+
<tr class="form-field">
|
30 |
+
<td>
|
31 |
+
<table style="width:100%;" cellspacing="5">
|
32 |
+
<tr>
|
33 |
+
<td>
|
34 |
+
<label><?php _e('Tax Rate Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
35 |
+
<div class="clear">
|
36 |
+
<input type="text" class="rad4" name="pmwi_order[taxes][<?php echo $i;?>][tax_amount]" value="<?php echo esc_attr($tax['tax_amount']) ?>" style="width:100%;"/>
|
37 |
+
</div>
|
38 |
+
</td>
|
39 |
+
<td>
|
40 |
+
<label><?php _e('Shipping Tax Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
41 |
+
<div class="clear">
|
42 |
+
<input type="text" class="rad4" name="pmwi_order[taxes][<?php echo $i;?>][shipping_tax_amount]" value="<?php echo esc_attr($tax['shipping_tax_amount']) ?>" style="width:100%;"/>
|
43 |
+
</div>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
<tr>
|
47 |
+
<td colspan="2">
|
48 |
+
<label><?php _e('Tax Rate', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
49 |
+
<span class="wpallimport-clear"></span>
|
50 |
+
<select name="pmwi_order[taxes][<?php echo $i;?>][tax_code]" id="order_tax_code_<?php echo $i;?>" class="rad4 switcher" style="font-size: 14px !important;">
|
51 |
+
<?php
|
52 |
+
$taxes_for_tooltip = array();
|
53 |
+
foreach ($classes_options as $key => $value):?>
|
54 |
+
<optgroup label="<?php echo $value; ?>">
|
55 |
+
<?php foreach ( WC_Tax::get_rates_for_tax_class($key) as $rate_key => $rate): $taxes_for_tooltip[] = $rate->tax_rate_id . " - " . $rate->tax_rate_name;?>
|
56 |
+
<option value="<?php echo $rate->tax_rate_id;?>" <?php if ($tax['tax_code'] == $rate->tax_rate_id) echo 'selected="selected"';?>><?php echo $rate->tax_rate_name;?></option>
|
57 |
+
<?php endforeach; ?>
|
58 |
+
</optgroup>
|
59 |
+
<?php endforeach; ?>
|
60 |
+
<option value="xpath" <?php if ("xpath" == $tax['tax_code']) echo 'selected="selected"';?>><?php _e("Set with XPath", PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
61 |
+
</select>
|
62 |
+
<span class="wpallimport-clear"></span>
|
63 |
+
<div class="switcher-target-order_tax_code_<?php echo $i; ?>" style="margin-top:10px;">
|
64 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
65 |
+
<input type="text" class="short rad4" name="pmwi_order[taxes][<?php echo $i;?>][tax_code_xpath]" value="<?php echo esc_attr($tax['tax_code_xpath']) ?>"/>
|
66 |
+
<a href="#help" class="wpallimport-help" title="<?php printf(__('Tax rate method can be matched by ID: %s. If tax method is not found then no tax information will be imported.', PMWI_Plugin::TEXT_DOMAIN), implode(", ", $taxes_for_tooltip)); ?>" style="position:relative; top:10px;">?</a>
|
67 |
+
</span>
|
68 |
+
</div>
|
69 |
+
</td>
|
70 |
+
</tr>
|
71 |
+
</table>
|
72 |
+
</td>
|
73 |
+
<td class="action remove"><!--a href="#remove" style="top: 39px;"></a--></td>
|
74 |
+
</tr>
|
75 |
+
|
76 |
+
<?php endforeach; ?>
|
77 |
+
|
78 |
+
<tr class="form-field template">
|
79 |
+
<td>
|
80 |
+
<table style="width:100%;" cellspacing="5">
|
81 |
+
<tr>
|
82 |
+
<td>
|
83 |
+
<label><?php _e('Tax Rate Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
84 |
+
<div class="clear">
|
85 |
+
<input type="text" class="rad4" name="pmwi_order[taxes][ROWNUMBER][tax_amount]" value="" style="width:100%;"/>
|
86 |
+
</div>
|
87 |
+
</td>
|
88 |
+
<td>
|
89 |
+
<label><?php _e('Shipping Tax Amount', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
90 |
+
<div class="clear">
|
91 |
+
<input type="text" class="rad4" name="pmwi_order[taxes][ROWNUMBER][shipping_tax_amount]" value="" style="width:100%;"/>
|
92 |
+
</div>
|
93 |
+
</td>
|
94 |
+
</tr>
|
95 |
+
<tr>
|
96 |
+
<td colspan="2">
|
97 |
+
<label><?php _e('Tax Rate', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
98 |
+
<span class="wpallimport-clear"></span>
|
99 |
+
<select name="pmwi_order[taxes][ROWNUMBER][tax_code]" id="order_tax_code_ROWNUMBER" class="rad4 switcher" style="font-size: 14px !important;">
|
100 |
+
<option value=""><?php _e("Select",PMWI_Plugin::TEXT_DOMAIN);?></option>
|
101 |
+
<?php foreach ($classes_options as $key => $value):?>
|
102 |
+
<optgroup label="<?php echo $value; ?>">
|
103 |
+
<?php foreach ( WC_Tax::get_rates_for_tax_class($key) as $rate_key => $rate): ?>
|
104 |
+
<option value="<?php echo $rate->tax_rate_id;?>"><?php echo $rate->tax_rate_name;?></option>
|
105 |
+
<?php endforeach; ?>
|
106 |
+
</optgroup>
|
107 |
+
<?php endforeach; ?>
|
108 |
+
<option value="xpath"><?php _e("Set with XPath", PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
109 |
+
</select>
|
110 |
+
<span class="wpallimport-clear"></span>
|
111 |
+
<div class="switcher-target-order_tax_code_ROWNUMBER" style="margin-top:10px; display: none;">
|
112 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
113 |
+
<input type="text" class="short rad4" name="pmwi_order[taxes][ROWNUMBER][tax_code_xpath]" value=""/>
|
114 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Tax rate method can be matched by ID. If tax method is not found then no tax information will be imported.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
115 |
+
</span>
|
116 |
+
</div>
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
</table>
|
120 |
+
</td>
|
121 |
+
<td class="action remove"><!--a href="#remove" style="top: 39px;"></a--></td>
|
122 |
+
</tr>
|
123 |
+
<tr class="wpallimport-row-actions" style="display:none;">
|
124 |
+
<td colspan="2">
|
125 |
+
<hr>
|
126 |
+
<a class="add-new-line" title="Add More" href="javascript:void(0);" style="width:200px;"><?php _e("Add More", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
127 |
+
</td>
|
128 |
+
</tr>
|
129 |
+
</table>
|
130 |
+
</div>
|
131 |
+
<div class="wpallimport-collapsed closed wpallimport-section order-imports">
|
132 |
+
<div style="margin:0; background: #FAFAFA;" class="wpallimport-content-section rad4 order-imports">
|
133 |
+
<div class="wpallimport-collapsed-header">
|
134 |
+
<h3 style="color:#40acad; font-size: 14px;"><?php _e("Advanced Options",PMWI_Plugin::TEXT_DOMAIN); ?></h3>
|
135 |
+
</div>
|
136 |
+
<div style="padding: 0px;" class="wpallimport-collapsed-content">
|
137 |
+
<div class="wpallimport-collapsed-content-inner">
|
138 |
+
<?php if ( empty(PMXI_Plugin::$session->options['delimiter']) ): ?>
|
139 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
140 |
+
<input type="radio" id="taxes_repeater_mode_variable_csv" name="pmwi_order[taxes_repeater_mode]" value="csv" <?php echo 'csv' == $post['pmwi_order']['taxes_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
141 |
+
<label for="taxes_repeater_mode_variable_csv" style="width:auto; float: none;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
142 |
+
<div class="switcher-target-taxes_repeater_mode_variable_csv wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
143 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
144 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple taxes separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
145 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[taxes_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['taxes_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
146 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two tax rate amounts would be imported like this '10|20'">?</a>
|
147 |
+
</span>
|
148 |
+
</div>
|
149 |
+
</div>
|
150 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear">
|
151 |
+
<input type="radio" id="taxes_repeater_mode_variable_xml" name="pmwi_order[taxes_repeater_mode]" value="xml" <?php echo 'xml' == $post['pmwi_order']['taxes_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
152 |
+
<label for="taxes_repeater_mode_variable_xml" style="width:auto; float: none;"><?php _e('Variable Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
153 |
+
<div class="switcher-target-taxes_repeater_mode_variable_xml wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
154 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
155 |
+
<label style="width: 60px; line-height: 30px;"><?php _e('For each', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
156 |
+
<input type="text" class="short rad4" name="pmwi_order[taxes_repeater_mode_foreach]" value="<?php echo esc_attr($post['pmwi_order']['taxes_repeater_mode_foreach']) ?>" style="width:50%;"/>
|
157 |
+
<label class="foreach-do" style="padding-left: 10px; line-height: 30px;"><?php _e('do...', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
158 |
+
</span>
|
159 |
+
</div>
|
160 |
+
</div>
|
161 |
+
<?php else: ?>
|
162 |
+
<input type="hidden" name="pmwi_order[taxes_repeater_mode]" value="csv"/>
|
163 |
+
<div class="form-field input" style="margin-bottom: 20px;">
|
164 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple taxes separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
165 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[taxes_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['taxes_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
166 |
+
<a href="#help" class="wpallimport-help" style="top:10px;left:8px;" original-title="For example, two tax rate amounts would be imported like this '10|20'">?</a>
|
167 |
+
</div>
|
168 |
+
<?php endif; ?>
|
169 |
+
</div>
|
170 |
+
</div>
|
171 |
+
</div>
|
172 |
+
</div>
|
173 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_payment.php
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="payment_order_data" style="display:none;">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<table class="form-table" style="max-width:none;">
|
4 |
+
<tr>
|
5 |
+
<td>
|
6 |
+
<!-- Payment Method -->
|
7 |
+
<div class="form-field">
|
8 |
+
<p class="form-field"><?php _e('Payment Method', PMWI_Plugin::TEXT_DOMAIN) ?></p>
|
9 |
+
<div class="form-field">
|
10 |
+
<select id="payment_method" name="pmwi_order[payment_method]" style="width: 200px; font-size: 14px !important;" class="switcher rad4">
|
11 |
+
<?php
|
12 |
+
$payment_gateways = WC_Payment_Gateways::instance()->payment_gateways();
|
13 |
+
$payment_gateways_for_tooltip = array();
|
14 |
+
foreach ( $payment_gateways as $id => $gateway ) {
|
15 |
+
echo '<option value="' . esc_attr( $id ) . '" ' . selected( $id, $post['pmwi_order']['payment_method'], false ) . '>' . esc_html( $gateway->title ) . '</option>';
|
16 |
+
$payment_gateways_for_tooltip[] = esc_attr( $id );
|
17 |
+
}
|
18 |
+
?>
|
19 |
+
<option value="xpath" <?php if ("xpath" == $post['pmwi_order']['payment_method']) echo 'selected="selected"';?>><?php _e("Set with XPath", PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
20 |
+
</select>
|
21 |
+
<span class="wpallimport-clear"></span>
|
22 |
+
<div class="switcher-target-payment_method" style="margin-top:10px;">
|
23 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
24 |
+
<input type="text" class="short rad4" name="pmwi_order[payment_method_xpath]" value="<?php echo esc_attr($post['pmwi_order']['payment_method_xpath']) ?>"/>
|
25 |
+
<a href="#help" class="wpallimport-help" title="<?php printf(__('Payment method can be matched by title or slug: %s. If payment method is not found \'N/A\' will be applied to order.', PMWI_Plugin::TEXT_DOMAIN), implode(", ", $payment_gateways_for_tooltip)); ?>" style="position:relative; top:10px;">?</a>
|
26 |
+
</span>
|
27 |
+
</div>
|
28 |
+
</div>
|
29 |
+
</div>
|
30 |
+
</td>
|
31 |
+
</tr>
|
32 |
+
<tr>
|
33 |
+
<td>
|
34 |
+
<div class="form-field">
|
35 |
+
<div class="form-field">
|
36 |
+
<label><?php _e('Transaction ID', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
37 |
+
<div class="clear">
|
38 |
+
<input type="text" class="rad4" name="pmwi_order[transaction_id]" value="<?php echo esc_attr($post['pmwi_order']['transaction_id']) ?>"/>
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
+
</div>
|
42 |
+
</td>
|
43 |
+
</tr>
|
44 |
+
</table>
|
45 |
+
</div>
|
46 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_shipping.php
ADDED
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="shipping_order_data" style="display:none;">
|
2 |
+
<div class="options_group hide_if_grouped">
|
3 |
+
<div class="input">
|
4 |
+
<div class="form-field wpallimport-radio-field">
|
5 |
+
<input type="radio" id="shipping_source_copy" name="pmwi_order[shipping_source]" value="copy" <?php echo 'copy' == $post['pmwi_order']['shipping_source'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
6 |
+
<label for="shipping_source_copy" style="width:auto;"><?php _e('Copy from billing', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
7 |
+
</div>
|
8 |
+
</div>
|
9 |
+
<div class="clear"></div>
|
10 |
+
<div style="margin-top:0; padding-left:8px;">
|
11 |
+
<div class="form-field wpallimport-radio-field">
|
12 |
+
<input type="radio" id="shipping_source_guest" name="pmwi_order[shipping_source]" value="guest" <?php echo 'guest' == $post['pmwi_order']['shipping_source'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
13 |
+
<label for="shipping_source_guest" style="width:auto;"><?php _e('Import shipping address', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
14 |
+
</div>
|
15 |
+
<span class="wpallimport-clear"></span>
|
16 |
+
<div class="switcher-target-shipping_source_guest" style="padding-left:45px;">
|
17 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
18 |
+
<div class="form-field wpallimport-radio-field" style="padding-left: 3px;">
|
19 |
+
<input type="hidden" name="pmwi_order[copy_from_billing]" value="0"/>
|
20 |
+
<input type="checkbox" id="shipping_copy_from_billing" name="pmwi_order[copy_from_billing]" value="1" <?php echo $post['pmwi_order']['copy_from_billing'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
21 |
+
<label for="shipping_copy_from_billing" style="width:auto;"><?php _e('If order has no shipping info, copy from billing', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
22 |
+
</div>
|
23 |
+
<table cellspacing="5" class="wpallimport-order-billing-fields">
|
24 |
+
<tr>
|
25 |
+
<td>
|
26 |
+
<label><?php _e('First Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
27 |
+
<div class="clear">
|
28 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_first_name]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_first_name']) ?>"/>
|
29 |
+
</div>
|
30 |
+
</td>
|
31 |
+
<td>
|
32 |
+
<label><?php _e('Last Name', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
33 |
+
<div class="clear">
|
34 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_last_name]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_last_name']) ?>"/>
|
35 |
+
</div>
|
36 |
+
</td>
|
37 |
+
</tr>
|
38 |
+
<tr>
|
39 |
+
<td colspan="2">
|
40 |
+
<label><?php _e('Company', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
41 |
+
<div class="clear">
|
42 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_company]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_company']) ?>"/>
|
43 |
+
</div>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
<tr>
|
47 |
+
<td>
|
48 |
+
<label><?php _e('Address 1', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
49 |
+
<div class="clear">
|
50 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_address_1]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_address_1']) ?>"/>
|
51 |
+
</div>
|
52 |
+
</td>
|
53 |
+
<td>
|
54 |
+
<label><?php _e('Address 2', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
55 |
+
<div class="clear">
|
56 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_address_2]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_address_2']) ?>"/>
|
57 |
+
</div>
|
58 |
+
</td>
|
59 |
+
</tr>
|
60 |
+
<tr>
|
61 |
+
<td>
|
62 |
+
<label><?php _e('City', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
63 |
+
<div class="clear">
|
64 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_city]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_city']) ?>"/>
|
65 |
+
</div>
|
66 |
+
</td>
|
67 |
+
<td>
|
68 |
+
<label><?php _e('Postcode', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
69 |
+
<div class="clear">
|
70 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_postcode]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_postcode']) ?>"/>
|
71 |
+
</div>
|
72 |
+
</td>
|
73 |
+
</tr>
|
74 |
+
<tr>
|
75 |
+
<td>
|
76 |
+
<label><?php _e('Country', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
77 |
+
<div class="clear">
|
78 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_country]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_country']) ?>"/>
|
79 |
+
</div>
|
80 |
+
</td>
|
81 |
+
<td>
|
82 |
+
<label><?php _e('State/Country', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
83 |
+
<div class="clear">
|
84 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_state]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_state']) ?>"/>
|
85 |
+
</div>
|
86 |
+
</td>
|
87 |
+
</tr>
|
88 |
+
<tr>
|
89 |
+
<td>
|
90 |
+
<label><?php _e('Email', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
91 |
+
<div class="clear">
|
92 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_email]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_email']) ?>"/>
|
93 |
+
</div>
|
94 |
+
</td>
|
95 |
+
<td>
|
96 |
+
<label><?php _e('Phone', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
97 |
+
<div class="clear">
|
98 |
+
<input type="text" class="rad4" name="pmwi_order[shipping_phone]" style="" value="<?php echo esc_attr($post['pmwi_order']['shipping_phone']) ?>"/>
|
99 |
+
</div>
|
100 |
+
</td>
|
101 |
+
</tr>
|
102 |
+
</table>
|
103 |
+
</span>
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
<div class="clear"></div>
|
107 |
+
<div class="input">
|
108 |
+
<div class="form-field">
|
109 |
+
<label><?php _e('Customer Provided Note', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
110 |
+
<textarea name="pmwi_order[customer_provided_note]" class="rad4" style="width:97%;"><?php echo esc_attr($post['pmwi_order']['customer_provided_note']) ?></textarea>
|
111 |
+
</div>
|
112 |
+
</div>
|
113 |
+
</div>
|
114 |
+
</div>
|
views/admin/import/shop_order/_tabs/_order_total.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="panel woocommerce_options_panel" id="order_total" style="display:none;">
|
2 |
+
<div class="options_group hide_if_grouped" style="margin-top:10px;">
|
3 |
+
<div class="form-field wpallimport-radio-field">
|
4 |
+
<input type="radio" id="order_total_logic_auto" name="pmwi_order[order_total_logic]" value="auto" <?php echo 'auto' == $post['pmwi_order']['order_total_logic'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
5 |
+
<label for="order_total_logic_auto" style="width:auto;"><?php _e('Calculate order total automatically', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
6 |
+
</div>
|
7 |
+
<span class="wpallimport-clear"></span>
|
8 |
+
<div class="form-field wpallimport-radio-field">
|
9 |
+
<input type="radio" id="order_total_logic_manually" name="pmwi_order[order_total_logic]" value="manually" <?php echo 'manually' == $post['pmwi_order']['order_total_logic'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
10 |
+
<label for="order_total_logic_manually" style="width:auto;"><?php _e('Set order total manually', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
11 |
+
</div>
|
12 |
+
<span class="wpallimport-clear"></span>
|
13 |
+
<div class="switcher-target-order_total_logic_manually" style="padding-left:45px;">
|
14 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
15 |
+
<input type="text" class="short rad4" name="pmwi_order[order_total_xpath]" style="" value="<?php echo esc_attr($post['pmwi_order']['order_total_xpath']) ?>"/>
|
16 |
+
</span>
|
17 |
+
</div>
|
18 |
+
</div>
|
19 |
+
</div>
|
views/admin/import/shop_order/index.php
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!-- Order Details Section -->
|
2 |
+
|
3 |
+
<?php include( 'order_details_section.php' ); ?>
|
4 |
+
|
5 |
+
<!-- Billing & Shipping Details Section -->
|
6 |
+
|
7 |
+
<?php include( 'order_bs_section.php' ); ?>
|
8 |
+
|
9 |
+
<!-- Order Items Section -->
|
10 |
+
|
11 |
+
<?php include( 'order_items_section.php' ); ?>
|
12 |
+
|
13 |
+
<!-- Order Notes Section -->
|
14 |
+
|
15 |
+
<?php include( 'order_notes_section.php' ); ?>
|
views/admin/import/shop_order/order_bs_section.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpallimport-collapsed closed">
|
2 |
+
<div class="wpallimport-content-section">
|
3 |
+
<div class="wpallimport-collapsed-header">
|
4 |
+
<h3><?php _e('Billing & Shipping Details',PMWI_Plugin::TEXT_DOMAIN);?></h3>
|
5 |
+
</div>
|
6 |
+
<div class="wpallimport-collapsed-content" style="padding:0;">
|
7 |
+
<div class="wpallimport-collapsed-content-inner">
|
8 |
+
<table class="form-table" style="max-width:none;">
|
9 |
+
<tr>
|
10 |
+
<td colspan="3">
|
11 |
+
<div class="postbox woocommerce-order-data" id="woocommerce-product-data">
|
12 |
+
<div class="clear"></div>
|
13 |
+
<div style="min-height: 200px;">
|
14 |
+
<div class="panel-wrap product_data">
|
15 |
+
|
16 |
+
<ul class="product_data_tabs wc-tabs shop_order_tabs">
|
17 |
+
|
18 |
+
<li class="woocommerce-order-billing-data active">
|
19 |
+
<a href="javascript:void(0);" rel="billing_order_data"><?php _e('Billing',PMWI_Plugin::TEXT_DOMAIN);?></a>
|
20 |
+
</li>
|
21 |
+
|
22 |
+
<li class="woocommerce-order-shipping-data">
|
23 |
+
<a href="javascript:void(0);" rel="shipping_order_data"><?php _e('Shipping', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
24 |
+
</li>
|
25 |
+
|
26 |
+
<li class="woocommerce-order-payment-data">
|
27 |
+
<a href="javascript:void(0);" rel="payment_order_data"><?php _e('Payment', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
28 |
+
</li>
|
29 |
+
|
30 |
+
</ul>
|
31 |
+
|
32 |
+
<!-- BILLING -->
|
33 |
+
|
34 |
+
<?php include( '_tabs/_order_billing.php' ); ?>
|
35 |
+
|
36 |
+
<!-- SHIPPING -->
|
37 |
+
|
38 |
+
<?php include( '_tabs/_order_shipping.php' ); ?>
|
39 |
+
|
40 |
+
<!-- PAYMENT -->
|
41 |
+
|
42 |
+
<?php include( '_tabs/_order_payment.php' ); ?>
|
43 |
+
|
44 |
+
</div>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
|
48 |
+
<div class="clear"></div>
|
49 |
+
</td>
|
50 |
+
</tr>
|
51 |
+
</table>
|
52 |
+
</div>
|
53 |
+
</div>
|
54 |
+
</div>
|
55 |
+
</div>
|
views/admin/import/shop_order/order_details_section.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpallimport-collapsed wpallimport-section">
|
2 |
+
<div class="wpallimport-content-section">
|
3 |
+
<div class="wpallimport-collapsed-header">
|
4 |
+
<h3><?php _e('Order Details',PMWI_Plugin::TEXT_DOMAIN);?></h3>
|
5 |
+
</div>
|
6 |
+
<div class="wpallimport-collapsed-content" style="padding:0;">
|
7 |
+
<div class="wpallimport-collapsed-content-inner">
|
8 |
+
<table class="form-table" style="max-width:none;">
|
9 |
+
<tr>
|
10 |
+
<td>
|
11 |
+
<!-- Order Status -->
|
12 |
+
<div class="input">
|
13 |
+
<h4><?php _e('Order Status', PMWI_Plugin::TEXT_DOMAIN) ?></h4>
|
14 |
+
<select id="order_status" name="pmwi_order[status]" style="width: 200px;" class="switcher">
|
15 |
+
<?php
|
16 |
+
$statuses = wc_get_order_statuses();
|
17 |
+
$statuses_for_tooltip = array();
|
18 |
+
foreach ( $statuses as $status => $status_name ) {
|
19 |
+
echo '<option value="' . esc_attr( $status ) . '" ' . selected( $status, $post['pmwi_order']['status'], false ) . '>' . esc_html( $status_name ) . '</option>';
|
20 |
+
$statuses_for_tooltip[] = esc_attr( $status );
|
21 |
+
}
|
22 |
+
?>
|
23 |
+
<option value="xpath" <?php if ("xpath" == $post['pmwi_order']['status']) echo 'selected="selected"';?>><?php _e("Set with XPath", PMWI_Plugin::TEXT_DOMAIN); ?></option>
|
24 |
+
</select>
|
25 |
+
<span class="wpallimport-clear"></span>
|
26 |
+
<div class="switcher-target-order_status" style="margin-top:10px;">
|
27 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
28 |
+
<input type="text" class="short" name="pmwi_order[status_xpath]" value="<?php echo esc_attr($post['pmwi_order']['status_xpath']) ?>"/>
|
29 |
+
<a href="#help" class="wpallimport-help" title="<?php printf(__('Order status can be matched by title or slug: %s. If order status is not found \'Pending Payment\' will be applied to order.', PMWI_Plugin::TEXT_DOMAIN), implode(", ", $statuses_for_tooltip)); ?>" style="position:relative; top:-2px;">?</a>
|
30 |
+
</span>
|
31 |
+
</div>
|
32 |
+
</div>
|
33 |
+
</td>
|
34 |
+
</tr>
|
35 |
+
<tr>
|
36 |
+
<td>
|
37 |
+
<!-- Order Date -->
|
38 |
+
<div class="input">
|
39 |
+
<h4><?php _e('Date', PMWI_Plugin::TEXT_DOMAIN) ?><a href="#help" class="wpallimport-help" style="position:relative; top: 1px;" title="<?php _e('Use any format supported by the PHP <b>strtotime</b> function. That means pretty much any human-readable date will work.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a></h4>
|
40 |
+
<div class="input">
|
41 |
+
<input type="text" class="datepicker" name="pmwi_order[date]" value="<?php echo esc_attr($post['pmwi_order']['date']) ?>"/>
|
42 |
+
</div>
|
43 |
+
</div>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
</table>
|
47 |
+
</div>
|
48 |
+
</div>
|
49 |
+
</div>
|
50 |
+
</div>
|
views/admin/import/shop_order/order_items_section.php
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpallimport-collapsed closed">
|
2 |
+
<div class="wpallimport-content-section">
|
3 |
+
<div class="wpallimport-collapsed-header">
|
4 |
+
<h3><?php _e('Order Items',PMWI_Plugin::TEXT_DOMAIN);?></h3>
|
5 |
+
</div>
|
6 |
+
<div class="wpallimport-collapsed-content" style="padding:0;">
|
7 |
+
<div class="wpallimport-collapsed-content-inner">
|
8 |
+
<table class="form-table" style="max-width:none;">
|
9 |
+
<tr>
|
10 |
+
<td colspan="3">
|
11 |
+
<div class="postbox woocommerce-order-data" id="woocommerce-product-data">
|
12 |
+
<div class="clear"></div>
|
13 |
+
<div style="min-height: 295px;">
|
14 |
+
<div class="panel-wrap product_data">
|
15 |
+
|
16 |
+
<ul class="product_data_tabs wc-tabs shop_order_tabs">
|
17 |
+
|
18 |
+
<li class="woocommerce-order-products-data active">
|
19 |
+
<a href="javascript:void(0);" rel="order_products"><?php _e('Products',PMWI_Plugin::TEXT_DOMAIN);?></a>
|
20 |
+
</li>
|
21 |
+
|
22 |
+
<li class="woocommerce-order-fees-data">
|
23 |
+
<a href="javascript:void(0);" rel="order_fees"><?php _e('Fees', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
24 |
+
</li>
|
25 |
+
|
26 |
+
<li class="woocommerce-order-coupons-data">
|
27 |
+
<a href="javascript:void(0);" rel="order_coupons"><?php _e('Coupons', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
28 |
+
</li>
|
29 |
+
|
30 |
+
<li class="woocommerce-order-shipping-data">
|
31 |
+
<a href="javascript:void(0);" rel="order_shipping"><?php _e('Shipping', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
32 |
+
</li>
|
33 |
+
|
34 |
+
<li class="woocommerce-order-taxes-data">
|
35 |
+
<a href="javascript:void(0);" rel="order_taxes"><?php _e('Taxes', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
36 |
+
</li>
|
37 |
+
|
38 |
+
<li class="woocommerce-order-refunds-data">
|
39 |
+
<a href="javascript:void(0);" rel="order_refunds"><?php _e('Refunds', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
40 |
+
</li>
|
41 |
+
|
42 |
+
<li class="woocommerce-order-total-data">
|
43 |
+
<a href="javascript:void(0);" rel="order_total"><?php _e('Total', PMWI_Plugin::TEXT_DOMAIN);?></a>
|
44 |
+
</li>
|
45 |
+
|
46 |
+
</ul>
|
47 |
+
|
48 |
+
<!-- PRODUCTS -->
|
49 |
+
|
50 |
+
<?php include( '_tabs/_order_item_products.php' ); ?>
|
51 |
+
|
52 |
+
<!-- FEES -->
|
53 |
+
|
54 |
+
<?php include( '_tabs/_order_item_fees.php' ); ?>
|
55 |
+
|
56 |
+
<!-- COUPONS -->
|
57 |
+
|
58 |
+
<?php include( '_tabs/_order_item_coupons.php' ); ?>
|
59 |
+
|
60 |
+
<!-- SHIPPING -->
|
61 |
+
|
62 |
+
<?php include( '_tabs/_order_item_shipping.php' ); ?>
|
63 |
+
|
64 |
+
<!-- TAXES -->
|
65 |
+
|
66 |
+
<?php include( '_tabs/_order_item_taxes.php' ); ?>
|
67 |
+
|
68 |
+
<!-- REFUNDS -->
|
69 |
+
|
70 |
+
<?php include( '_tabs/_order_item_refunds.php' ); ?>
|
71 |
+
|
72 |
+
<!-- TOTAL -->
|
73 |
+
|
74 |
+
<?php include( '_tabs/_order_total.php' ); ?>
|
75 |
+
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
</div>
|
79 |
+
|
80 |
+
<div class="clear"></div>
|
81 |
+
</td>
|
82 |
+
</tr>
|
83 |
+
</table>
|
84 |
+
</div>
|
85 |
+
</div>
|
86 |
+
</div>
|
87 |
+
</div>
|
views/admin/import/shop_order/order_notes_section.php
ADDED
@@ -0,0 +1,210 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="wpallimport-collapsed wpallimport-section closed">
|
2 |
+
<div class="wpallimport-content-section" style="padding-bottom: 0;">
|
3 |
+
<div class="wpallimport-collapsed-header" style="margin-bottom: 15px;">
|
4 |
+
<h3><?php _e('Notes',PMWI_Plugin::TEXT_DOMAIN);?></h3>
|
5 |
+
</div>
|
6 |
+
<div class="wpallimport-collapsed-content" style="padding:0;">
|
7 |
+
<div class="wpallimport-collapsed-content-inner options_group">
|
8 |
+
<table class="form-table" style="max-width:none;">
|
9 |
+
<tr>
|
10 |
+
<td>
|
11 |
+
<!-- Notes matching mode -->
|
12 |
+
<!-- <div class="form-field wpallimport-radio-field wpallimport-clear">
|
13 |
+
<input type="radio" id="notes_repeater_mode_fixed" name="pmwi_order[notes_repeater_mode]" value="fixed" <?php echo 'fixed' == $post['pmwi_order']['notes_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
14 |
+
<label for="notes_repeater_mode_fixed" style="width:auto;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
15 |
+
</div> -->
|
16 |
+
<table class="form-field wpallimport_variable_table" style="width:98%;">
|
17 |
+
<?php
|
18 |
+
foreach ($post['pmwi_order']['notes'] as $i => $note):
|
19 |
+
|
20 |
+
$note += array('content' => '', 'date' => 'now', 'username' => '', 'email' => '', 'visibility' => 'private', 'visibility_xpath' => '');
|
21 |
+
|
22 |
+
if (empty($note['content'])) continue;
|
23 |
+
|
24 |
+
?>
|
25 |
+
|
26 |
+
<tr class="form-field">
|
27 |
+
<td>
|
28 |
+
<table style="width:100%;" cellspacing="5">
|
29 |
+
<tr>
|
30 |
+
<td colspan="2">
|
31 |
+
<h4 style="margin-top:0;"><?php _e('Content', PMWI_Plugin::TEXT_DOMAIN) ?></h4>
|
32 |
+
<div class="input">
|
33 |
+
<textarea name="pmwi_order[notes][<?php echo $i; ?>][content]" style="width: 100%;font-size: 15px !important;" class="rad4"><?php echo esc_attr($note['content']); ?></textarea>
|
34 |
+
</div>
|
35 |
+
</td>
|
36 |
+
</tr>
|
37 |
+
<tr>
|
38 |
+
<td colspan="2">
|
39 |
+
<h4><?php _e('Date', PMWI_Plugin::TEXT_DOMAIN) ?><a href="#help" class="wpallimport-help" style="position:relative; top: 1px;" title="<?php _e('Use any format supported by the PHP <b>strtotime</b> function. That means pretty much any human-readable date will work.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a></h4>
|
40 |
+
<div class="input">
|
41 |
+
<input type="text" class="datepicker" name="pmwi_order[notes][<?php echo $i; ?>][date]" value="<?php echo esc_attr($note['date']) ?>"/>
|
42 |
+
</div>
|
43 |
+
</td>
|
44 |
+
</tr>
|
45 |
+
<tr>
|
46 |
+
<td colspan="2">
|
47 |
+
<h4><?php _e('Visibility', PMWI_Plugin::TEXT_DOMAIN) ?></h4>
|
48 |
+
<div class="form-field wpallimport-radio-field">
|
49 |
+
<input type="radio" id="order_note_visibility_privat_<?php echo $i; ?>" name="pmwi_order[notes][<?php echo $i; ?>][visibility]" value="private" <?php echo 'private' == $note['visibility'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
50 |
+
<label for="order_note_visibility_privat_<?php echo $i; ?>" style="width:auto;"><?php _e('Private note', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
51 |
+
</div>
|
52 |
+
<div class="form-field wpallimport-radio-field clear">
|
53 |
+
<input type="radio" id="order_note_visibility_customer_<?php echo $i; ?>" name="pmwi_order[notes][<?php echo $i; ?>][visibility]" value="customer" <?php echo 'customer' == $note['visibility'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
54 |
+
<label for="order_note_visibility_customer_<?php echo $i; ?>" style="width:auto;"><?php _e('Note to customer', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
55 |
+
</div>
|
56 |
+
<div class="form-field wpallimport-radio-field clear">
|
57 |
+
<input type="radio" id="order_note_visibilityy_xpath_<?php echo $i; ?>" name="pmwi_order[notes][<?php echo $i; ?>][visibility]" value="xpath" <?php echo 'xpath' == $note['visibility'] ? 'checked="checked"' : '' ?> class="switcher"/>
|
58 |
+
<label for="order_note_visibilityy_xpath_<?php echo $i; ?>" style="width:auto;"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
59 |
+
</div>
|
60 |
+
<span class="wpallimport-clear"></span>
|
61 |
+
<div class="switcher-target-order_note_visibilityy_xpath_<?php echo $i; ?>">
|
62 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
63 |
+
<input type="text" class="short" name="pmwi_order[notes][<?php echo $i; ?>][visibility_xpath]" style="" value="<?php echo esc_attr($note['visibility_xpath']); ?>"/>
|
64 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Use \'private\' or \'customer\'.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
65 |
+
</span>
|
66 |
+
</div>
|
67 |
+
</td>
|
68 |
+
</tr>
|
69 |
+
<tr>
|
70 |
+
<td>
|
71 |
+
<label><?php _e('Username', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
72 |
+
<div class="clear">
|
73 |
+
<input type="text" name="pmwi_order[notes][<?php echo $i; ?>][username]" value="<?php if ( ! empty($note['username']) ) echo $note['username']; ?>" style="width:100%;"/>
|
74 |
+
</div>
|
75 |
+
</td>
|
76 |
+
<td>
|
77 |
+
<label><?php _e('Email', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
78 |
+
<div class="clear">
|
79 |
+
<input type="text" name="pmwi_order[notes][<?php echo $i; ?>][email]" value="<?php if ( ! empty($note['email']) ) echo $note['email']; ?>" style="width:100%;"/>
|
80 |
+
</div>
|
81 |
+
</td>
|
82 |
+
</tr>
|
83 |
+
</table>
|
84 |
+
<!-- <hr style="margin: 20px 0;"> -->
|
85 |
+
</td>
|
86 |
+
<td class="action remove"><!--a href="#remove" style="top: 5px;"></a--></td>
|
87 |
+
</tr>
|
88 |
+
|
89 |
+
<?php endforeach; ?>
|
90 |
+
<tr class="form-field template">
|
91 |
+
<td>
|
92 |
+
<table style="width:100%;" cellspacing="5">
|
93 |
+
<tr>
|
94 |
+
<td colspan="2">
|
95 |
+
<h4 style="margin-top:0;"><?php _e('Content', PMWI_Plugin::TEXT_DOMAIN) ?></h4>
|
96 |
+
<div class="input">
|
97 |
+
<textarea name="pmwi_order[notes][ROWNUMBER][content]" style="width: 100%;" class="rad4"></textarea>
|
98 |
+
</div>
|
99 |
+
</td>
|
100 |
+
</tr>
|
101 |
+
<tr>
|
102 |
+
<td colspan="2">
|
103 |
+
<h4><?php _e('Date', PMWI_Plugin::TEXT_DOMAIN) ?><a href="#help" class="wpallimport-help" style="position:relative; top: 1px;" title="<?php _e('Use any format supported by the PHP <b>strtotime</b> function. That means pretty much any human-readable date will work.', PMWI_Plugin::TEXT_DOMAIN) ?>">?</a></h4>
|
104 |
+
<div class="input">
|
105 |
+
<input type="text" name="pmwi_order[notes][ROWNUMBER][date]" class="date-picker" value="now"/>
|
106 |
+
</div>
|
107 |
+
</td>
|
108 |
+
</tr>
|
109 |
+
<tr>
|
110 |
+
<td colspan="2">
|
111 |
+
<h4><?php _e('Visibility', PMWI_Plugin::TEXT_DOMAIN) ?></h4>
|
112 |
+
<div class="input">
|
113 |
+
<div class="form-field wpallimport-radio-field">
|
114 |
+
<input type="radio" id="order_note_visibility_privat_ROWNUMBER" name="pmwi_order[notes][ROWNUMBER][visibility]" value="private" checked="checked" class="switcher"/>
|
115 |
+
<label for="order_note_visibility_privat_ROWNUMBER" style="width:auto;"><?php _e('Private note', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
116 |
+
</div>
|
117 |
+
<div class="form-field wpallimport-radio-field clear">
|
118 |
+
<input type="radio" id="order_note_visibility_customer_ROWNUMBER" name="pmwi_order[notes][ROWNUMBER][visibility]" value="customer" class="switcher"/>
|
119 |
+
<label for="order_note_visibility_customer_ROWNUMBER" style="width:auto;"><?php _e('Note to customer', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
120 |
+
</div>
|
121 |
+
<div class="form-field wpallimport-radio-field clear">
|
122 |
+
<input type="radio" id="order_note_visibilityy_xpath_ROWNUMBER" name="pmwi_order[notes][ROWNUMBER][visibility]" value="xpath" class="switcher"/>
|
123 |
+
<label for="order_note_visibilityy_xpath_ROWNUMBER" style="width:auto;"><?php _e('Set with XPath', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
124 |
+
</div>
|
125 |
+
<span class="wpallimport-clear"></span>
|
126 |
+
<div class="switcher-target-order_note_visibilityy_xpath_ROWNUMBER" style="display:none;">
|
127 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
128 |
+
<input type="text" class="short" name="pmwi_order[notes][ROWNUMBER][visibility_xpath]" value=""/>
|
129 |
+
<a href="#help" class="wpallimport-help" title="<?php _e('Use \'private\' or \'customer\'.', PMWI_Plugin::TEXT_DOMAIN) ?>" style="position:relative; top:0px;">?</a>
|
130 |
+
</span>
|
131 |
+
</div>
|
132 |
+
</div>
|
133 |
+
</td>
|
134 |
+
</tr>
|
135 |
+
<tr>
|
136 |
+
<td>
|
137 |
+
<h4><?php _e('Username', PMWI_Plugin::TEXT_DOMAIN); ?></h4>
|
138 |
+
<div class="clear">
|
139 |
+
<input type="text" name="pmwi_order[notes][ROWNUMBER][username]" value="" style="width:100%;"/>
|
140 |
+
</div>
|
141 |
+
</td>
|
142 |
+
<td>
|
143 |
+
<h4><?php _e('Email', PMWI_Plugin::TEXT_DOMAIN); ?></h4>
|
144 |
+
<div class="clear">
|
145 |
+
<input type="text" name="pmwi_order[notes][ROWNUMBER][email]" value="" style="width:100%;"/>
|
146 |
+
</div>
|
147 |
+
</td>
|
148 |
+
</tr>
|
149 |
+
</table>
|
150 |
+
<!-- <hr style="margin: 20px 0;"> -->
|
151 |
+
</td>
|
152 |
+
<td class="action remove"><!--a href="#remove" style="top: 5px;"></a--></td>
|
153 |
+
</tr>
|
154 |
+
<tr class="wpallimport-row-actions" style="display:none;">
|
155 |
+
<td colspan="2">
|
156 |
+
<a class="add-new-line" title="Add Another Note" href="javascript:void(0);" style="width:200px;"><?php _e("Add Another Note", PMWI_Plugin::TEXT_DOMAIN); ?></a>
|
157 |
+
</td>
|
158 |
+
</tr>
|
159 |
+
</table>
|
160 |
+
</td>
|
161 |
+
</tr>
|
162 |
+
</table>
|
163 |
+
|
164 |
+
</div>
|
165 |
+
|
166 |
+
<div class="wpallimport-collapsed closed wpallimport-section">
|
167 |
+
<div style="margin:0; border-top:1px solid #ddd; border-bottom: none; border-right: none; border-left: none; background: #f1f2f2;" class="wpallimport-content-section rad0">
|
168 |
+
<div class="wpallimport-collapsed-header">
|
169 |
+
<h3 style="color:#40acad;"><?php _e("Advanced Options", PMWI_Plugin::TEXT_DOMAIN);?></h3>
|
170 |
+
</div>
|
171 |
+
<div style="padding: 0px;" class="wpallimport-collapsed-content">
|
172 |
+
<div class="wpallimport-collapsed-content-inner">
|
173 |
+
<?php if ( empty(PMXI_Plugin::$session->options['delimiter']) ): ?>
|
174 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear pmxi_option">
|
175 |
+
<input type="radio" id="notes_repeater_mode_variable_csv" name="pmwi_order[notes_repeater_mode]" value="csv" <?php echo 'csv' == $post['pmwi_order']['notes_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
176 |
+
<label for="notes_repeater_mode_variable_csv" style="width:auto;"><?php _e('Fixed Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
177 |
+
<div class="switcher-target-notes_repeater_mode_variable_csv wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
178 |
+
<span class="order-separator-label wpallimport-slide-content" style="padding-left:0;">
|
179 |
+
<label><?php _e('Multiple notes separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
180 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[notes_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['notes_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
181 |
+
<a href="#help" class="wpallimport-help" style="top:0px;left:8px;" original-title="For example, two notes would be imported like this Note 1|Note 2">?</a>
|
182 |
+
</span>
|
183 |
+
</div>
|
184 |
+
</div>
|
185 |
+
<div class="form-field wpallimport-radio-field wpallimport-clear pmxi_option">
|
186 |
+
<input type="radio" id="notes_repeater_mode_variable_xml" name="pmwi_order[notes_repeater_mode]" value="xml" <?php echo 'xml' == $post['pmwi_order']['notes_repeater_mode'] ? 'checked="checked"' : '' ?> class="switcher variable_repeater_mode"/>
|
187 |
+
<label for="notes_repeater_mode_variable_xml" style="width:auto;"><?php _e('Variable Repeater Mode', PMWI_Plugin::TEXT_DOMAIN) ?></label>
|
188 |
+
<div class="switcher-target-notes_repeater_mode_variable_xml wpallimport-clear" style="padding: 10px 0 10px 25px; overflow: hidden;">
|
189 |
+
<span class="wpallimport-slide-content" style="padding-left:0;">
|
190 |
+
<label style="width: 60px;"><?php _e('For each', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
191 |
+
<input type="text" class="short rad4" name="pmwi_order[notes_repeater_mode_foreach]" value="<?php echo esc_attr($post['pmwi_order']['notes_repeater_mode_foreach']) ?>" style="width:50%;"/>
|
192 |
+
<label style="padding-left: 10px;"><?php _e('do...', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
193 |
+
</span>
|
194 |
+
</div>
|
195 |
+
</div>
|
196 |
+
<?php else: ?>
|
197 |
+
<input type="hidden" name="pmwi_order[notes_repeater_mode]" value="csv"/>
|
198 |
+
<div class="form-field input" style="padding-left: 20px;">
|
199 |
+
<label class="order-separator-label" style="line-height: 30px;"><?php _e('Multiple notes separated by', PMWI_Plugin::TEXT_DOMAIN); ?></label>
|
200 |
+
<input type="text" class="short rad4 order-separator-input" name="pmwi_order[notes_repeater_mode_separator]" value="<?php echo esc_attr($post['pmwi_order']['notes_repeater_mode_separator']) ?>" style="width:10%; text-align: center;"/>
|
201 |
+
<a href="#help" class="wpallimport-help" style="top:0px;left:8px;" original-title="For example, two notes would be imported like this 'Note 1|Note 2'">?</a>
|
202 |
+
</div>
|
203 |
+
<?php endif; ?>
|
204 |
+
</div>
|
205 |
+
</div>
|
206 |
+
</div>
|
207 |
+
</div>
|
208 |
+
</div>
|
209 |
+
</div>
|
210 |
+
</div>
|