/
wcfm-view-products-manage.php
650 lines (577 loc) · 46.5 KB
/
wcfm-view-products-manage.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
<?php
global $wp, $WCFM, $wc_product_attributes;
if( !current_user_can( 'edit_products' ) ) {
wcfm_restriction_message_show( "Products" );
return;
}
$product_id = 0;
$product = array();
$product_type = '';
$is_virtual = '';
$title = '';
$sku = '';
$visibility = 'visible';
$excerpt = '';
$description = '';
$regular_price = '';
$sale_price = '';
$sale_date_from = '';
$sale_date_upto = '';
$product_url = '';
$button_text = '';
$is_downloadable = '';
$children = array();
$featured_img = '';
$gallery_img_ids = array();
$gallery_img_urls = array();
$categories = array();
$product_tags = '';
$manage_stock = '';
$stock_qty = 0;
$backorders = '';
$stock_status = '';
$sold_individually = '';
$weight = '';
$length = '';
$width = '';
$height = '';
$shipping_class = '';
$tax_status = '';
$tax_class = '';
$attributes = array();
$default_attributes = '';
$attributes_select_type = array();
$variations = array();
$upsell_ids = array();
$crosssell_ids = array();
if( isset( $wp->query_vars['wcfm-products-manage'] ) && !empty( $wp->query_vars['wcfm-products-manage'] ) ) {
$product = wc_get_product( $wp->query_vars['wcfm-products-manage'] );
// Fetching Product Data
if($product && !empty($product)) {
$product_id = $wp->query_vars['wcfm-products-manage'];
$wcfm_products_single = get_post($product_id);
$product_type = $product->get_type();
$title = $product->get_title();
$sku = $product->get_sku();
//$visibility = get_post_meta( $product_id, '_visibility', true);
$excerpt = $product->get_short_description();
$description = $product->get_description();
$regular_price = $product->get_regular_price();
$sale_price = $product->get_sale_price();
// External product option
$product_url = get_post_meta( $product_id, '_product_url', true);
$button_text = get_post_meta( $product_id, '_button_text', true);
// Virtual
$is_virtual = ( get_post_meta( $product_id, '_virtual', true) == 'yes' ) ? 'enable' : '';
// Download ptions
$is_downloadable = ( get_post_meta( $product_id, '_downloadable', true) == 'yes' ) ? 'enable' : '';
if( $product_type != 'simple' ) $is_downloadable = '';
// Product Images
$featured_img = ($product->get_image_id()) ? $product->get_image_id() : '';
if($featured_img) $featured_img = wp_get_attachment_url($featured_img);
if(!$featured_img) $featured_img = '';
$gallery_img_ids = $product->get_gallery_image_ids();
if(!empty($gallery_img_ids)) {
foreach($gallery_img_ids as $gallery_img_id) {
$gallery_img_urls[]['image'] = wp_get_attachment_url($gallery_img_id);
}
}
// Product Categories
$pcategories = get_the_terms( $product_id, 'product_cat' );
if( !empty($pcategories) ) {
foreach($pcategories as $pkey => $pcategory) {
$categories[] = $pcategory->term_id;
}
} else {
$categories = array();
}
// Product Tags
$product_tag_list = wp_get_post_terms($product_id, 'product_tag', array("fields" => "names"));
$product_tags = implode(',', $product_tag_list);
// Product Stock options
$manage_stock = $product->managing_stock() ? 'enable' : '';
$stock_qty = $product->get_stock_quantity();
$backorders = $product->get_backorders();
$stock_status = $product->get_stock_status();
$sold_individually = $product->is_sold_individually() ? 'enable' : '';
// Product Shipping Data
$weight = $product->get_weight();
$length = $product->get_length();
$width = $product->get_width();
$height = $product->get_height();
$shipping_class = $product->get_shipping_class_id();
// Product Tax Data
$tax_status = $product->get_tax_status();
$tax_class = $product->get_tax_class();
// Product Attributes
$wcfm_attributes = get_post_meta( $product_id, '_product_attributes', true );
if(!empty($wcfm_attributes)) {
$acnt = 0;
foreach($wcfm_attributes as $wcfm_attribute) {
if ( $wcfm_attribute['is_taxonomy'] ) {
$att_taxonomy = $wcfm_attribute['name'];
if ( ! taxonomy_exists( $att_taxonomy ) ) {
continue;
}
$attribute_taxonomy = $wc_product_attributes[ $att_taxonomy ];
$attributes[$acnt]['term_name'] = $att_taxonomy;
$attributes[$acnt]['name'] = wc_attribute_label( $att_taxonomy );
$attributes[$acnt]['attribute_taxonomy'] = $attribute_taxonomy;
$attributes[$acnt]['tax_name'] = $att_taxonomy;
$attributes[$acnt]['is_taxonomy'] = 1;
if ( 'select' === $attribute_taxonomy->attribute_type ) {
$args = array(
'orderby' => 'name',
'hide_empty' => 0
);
$all_terms = get_terms( $att_taxonomy, apply_filters( 'wcfm_product_attribute_terms', $args ) );
$attributes_option = array();
if ( $all_terms ) {
foreach ( $all_terms as $term ) {
$attributes_option[$term->term_id] = esc_attr( apply_filters( 'woocommerce_product_attribute_term_name', $term->name, $term ) );
}
}
$attributes[$acnt]['attribute_type'] = 'select';
$attributes[$acnt]['option_values'] = $attributes_option;
$attributes[$acnt]['value'] = wp_get_post_terms( $product_id, $att_taxonomy, array( 'fields' => 'ids' ) );
} else {
$attributes[$acnt]['attribute_type'] = 'text';
$attributes[$acnt]['value'] = esc_attr( implode( ' ' . WC_DELIMITER . ' ', wp_get_post_terms( $product_id, $att_taxonomy, array( 'fields' => 'names' ) ) ) );
}
} else {
$attributes[$acnt]['term_name'] = apply_filters( 'woocommerce_attribute_label', $wcfm_attribute['name'], $wcfm_attribute['name'], true );
$attributes[$acnt]['name'] = apply_filters( 'woocommerce_attribute_label', $wcfm_attribute['name'], $wcfm_attribute['name'], true );
$attributes[$acnt]['value'] = $wcfm_attribute['value'];
$attributes[$acnt]['tax_name'] = '';
$attributes[$acnt]['is_taxonomy'] = 0;
$attributes[$acnt]['attribute_type'] = 'text';
}
$attributes[$acnt]['is_visible'] = $wcfm_attribute['is_visible'] ? 'enable' : '';
$attributes[$acnt]['is_variation'] = $wcfm_attribute['is_variation'] ? 'enable' : '';
if( 'select' === $attributes[$acnt]['attribute_type'] ) {
$attributes_select_type[$acnt] = $attributes[$acnt];
unset($attributes[$acnt]);
}
$acnt++;
}
}
// Product Default Attributes
$default_attributes = json_encode( (array) get_post_meta( $product_id, '_default_attributes', true ) );
// Variable Product Variations
$variation_ids = $product->get_children();
if(!empty($variation_ids)) {
foreach($variation_ids as $variation_id_key => $variation_id) {
$variation_data = new WC_Product_Variation($variation_id);
$variations[$variation_id_key]['id'] = $variation_id;
$variations[$variation_id_key]['enable'] = $variation_data->is_purchasable() ? 'enable' : '';
$variations[$variation_id_key]['sku'] = $variation_data->get_sku();
// Variation Image
$variation_img = $variation_data->get_image_id();
if($variation_img) $variation_img = wp_get_attachment_url($variation_img);
else $variation_img = '';
$variations[$variation_id_key]['image'] = $variation_img;
// Variation Price
$variations[$variation_id_key]['regular_price'] = $variation_data->get_regular_price();
$variations[$variation_id_key]['sale_price'] = $variation_data->get_sale_price();
// Variation Stock Data
$variations[$variation_id_key]['manage_stock'] = $variation_data->managing_stock() ? 'enable' : '';
$variations[$variation_id_key]['stock_status'] = $variation_data->get_stock_status();
$variations[$variation_id_key]['stock_qty'] = $variation_data->get_stock_quantity();
$variations[$variation_id_key]['backorders'] = $variation_data->get_backorders();
// Variation Virtual Data
$variations[$variation_id_key]['is_virtual'] = ( 'yes' == get_post_meta($variation_id, '_virtual', true) ) ? 'enable' : '';
// Variation Downloadable Data
$variations[$variation_id_key]['is_downloadable'] = ( 'yes' == get_post_meta($variation_id, '_downloadable', true) ) ? 'enable' : '';
$variations[$variation_id_key]['downloadable_files'] = get_post_meta($variation_id, '_downloadable_files', true);
$variations[$variation_id_key]['download_limit'] = ( -1 == get_post_meta($variation_id, '_download_limit', true) ) ? '' : get_post_meta($variation_id, '_download_limit', true);
$variations[$variation_id_key]['download_expiry'] = ( -1 == get_post_meta($variation_id, '_download_expiry', true) ) ? '' : get_post_meta($variation_id, '_download_expiry', true);
if(!empty($variations[$variation_id_key]['downloadable_files'])) {
foreach($variations[$variation_id_key]['downloadable_files'] as $variations_downloadable_files) {
$variations[$variation_id_key]['downloadable_file'] = $variations_downloadable_files['file'];
$variations[$variation_id_key]['downloadable_file_name'] = $variations_downloadable_files['name'];
}
}
// Variation Shipping Data
$variations[$variation_id_key]['weight'] = $variation_data->get_weight();
$variations[$variation_id_key]['length'] = $variation_data->get_length();
$variations[$variation_id_key]['width'] = $variation_data->get_width();
$variations[$variation_id_key]['height'] = $variation_data->get_height();
$variations[$variation_id_key]['shipping_class'] = $variation_data->get_shipping_class_id();
// Variation Tax
$variations[$variation_id_key]['tax_class'] = $variation_data->get_tax_class();
// Variation Attributes
$variations[$variation_id_key]['attributes'] = json_encode( $variation_data->get_variation_attributes() );
// Description
$variations[$variation_id_key]['description'] = get_post_meta($variation_id, '_variation_description', true);
$variations = apply_filters( 'wcfm_variation_edit_data', $variations, $variation_id, $variation_id_key );
}
}
$upsell_ids = get_post_meta( $product_id, '_upsell_ids', true ) ? get_post_meta( $product_id, '_upsell_ids', true ) : array();
$crosssell_ids = get_post_meta( $product_id, '_crosssell_ids', true ) ? get_post_meta( $product_id, '_crosssell_ids', true ) : array();
$children = get_post_meta( $product_id, '_children', true ) ? get_post_meta( $product_id, '_children', true ) : array();
}
}
$current_user_id = get_current_user_id();
// Shipping Class List
$product_shipping_class = get_terms( 'product_shipping_class', array('hide_empty' => 0));
$product_shipping_class = apply_filters( 'wcfm_product_shipping_class', $product_shipping_class );
$variation_shipping_option_array = array('-1' => __('Same as parent', 'wc-frontend-manager'));
$shipping_option_array = array('_no_shipping_class' => __('No shipping class', 'wc-frontend-manager'));
if( $product_shipping_class && !empty( $product_shipping_class ) ) {
foreach($product_shipping_class as $product_shipping) {
$variation_shipping_option_array[$product_shipping->term_id] = $product_shipping->name;
$shipping_option_array[$product_shipping->term_id] = $product_shipping->name;
}
}
// Tax Class List
$tax_classes = WC_Tax::get_tax_classes();
$classes_options = array();
$variation_tax_classes_options['parent'] = __( 'Same as parent', 'wc-frontend-manager' );
$variation_tax_classes_options[''] = __( 'Standard', 'wc-frontend-manager' );
$tax_classes_options[''] = __( 'Standard', 'wc-frontend-manager' );
if ( ! empty( $tax_classes ) ) {
foreach ( $tax_classes as $class ) {
$tax_classes_options[ sanitize_title( $class ) ] = esc_html( $class );
$variation_tax_classes_options[ sanitize_title( $class ) ] = esc_html( $class );
}
}
$args = array(
'posts_per_page' => -1,
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'product',
'post_mime_type' => '',
'post_parent' => '',
//'author' => get_current_user_id(),
'post_status' => array('publish'),
'suppress_filters' => true
);
$args = apply_filters( 'wcfm_products_args', $args );
$products_objs = get_posts( $args );
$products_array = array();
if( !empty($products_objs) ) {
foreach( $products_objs as $products_obj ) {
$products_array[esc_attr( $products_obj->ID )] = esc_html( $products_obj->post_title );
}
}
$product_types = apply_filters( 'wcfm_product_types', array('simple' => __('Simple Product', 'wc-frontend-manager'), 'variable' => __('Variable Product', 'wc-frontend-manager'), 'grouped' => __('Grouped Product', 'wc-frontend-manager'), 'external' => __('External/Affiliate Product', 'wc-frontend-manager') ) );
$product_categories = get_terms( 'product_cat', 'orderby=name&hide_empty=0&parent=0' );
?>
<div class="collapse wcfm-collapse" id="">
<div class="wcfm-page-headig">
<span class="fa fa-cube"></span>
<span class="wcfm-page-heading-text"><?php _e( 'Manage Product', 'wc-frontend-manager' ); ?></span>
<?php do_action( 'wcfm_page_heading' ); ?>
</div>
<div class="wcfm-collapse-content">
<div id="wcfm_page_load"><i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i></div>
<?php do_action( 'before_wcfm_product_simple' ); ?>
<h2><?php if( $product_id ) { _e('Edit Product', 'wc-frontend-manager' ); } else { _e('Add Product', 'wc-frontend-manager' ); } ?></h2>
<?php
if( $product_id ) {
?>
<span class="product-status product-status-<?php echo $wcfm_products_single->post_status; ?>"><?php echo ucfirst( $wcfm_products_single->post_status ); ?></span>
<?php
if( $wcfm_products_single->post_status == 'publish' ) {
echo '<a target="_blank" href="' . get_permalink( $wcfm_products_single->ID ) . '">';
?>
<span class="view_count"><span class="fa fa-eye text_tip" data-tip="<?php _e( 'Views', 'wc-frontend-manager' ); ?>"></span>
<?php
echo get_post_meta( $wcfm_products_single->ID, '_wcfm_product_views', true ) . '</span></a>';
}
}
if( $allow_wp_admin_view = apply_filters( 'wcfm_allow_wp_admin_view', true ) ) {
?>
<a target="_blank" class="wcfm_wp_admin_view text_tip" href="<?php echo admin_url('post-new.php?post_type=product'); ?>" data-tip="<?php _e( 'WP Admin View', 'wc-frontend-manager' ); ?>"><span class="fa fa-user-secret"></span></a>
<?php
}
if( $has_new = apply_filters( 'wcfm_add_new_product_sub_menu', true ) ) {
echo '<a id="add_new_product_dashboard" class="add_new_wcfm_ele_dashboard text_tip" href="'.get_wcfm_edit_product_url().'" data-tip="' . __('Add New Product', 'wc-frontend-manager') . '"><span class="fa fa-cube"></span><span class="text">' . __( 'Add New', 'wc-frontend-manager') . '</span></a>';
}
?>
<div class="wcfm-clearfix"></div>
<form id="wcfm_products_manage_form" class="wcfm">
<?php do_action( 'begin_wcfm_products_manage_form' ); ?>
<!-- collapsible -->
<div class="wcfm-container simple variable external grouped booking">
<div id="wcfm_products_manage_form_general_expander" class="wcfm-content">
<div class="wcfm_product_manager_general_fields">
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'wcfm_product_manage_fields_general', array(
"product_type" => array('type' => 'select', 'options' => $product_types, 'class' => 'wcfm-select wcfm_ele wcfm_product_type simple variable external grouped booking', 'label_class' => 'wcfm_title wcfm_ele simple variable external grouped booking', 'value' => $product_type ),
"title" => array( 'placeholder' => __('Product Title', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele wcfm_product_title wcfm_full_ele simple variable external grouped booking', 'value' => $title),
//"visibility" => array('label' => __('Visibility', 'wc-frontend-manager'), 'type' => 'select', 'options' => array('visible' => __('Catalog/Search', 'wc-frontend-manager'), 'catalog' => __('Catalog', 'wc-frontend-manager'), 'search' => __('Search', 'wc-frontend-manager'), 'hidden' => __('Hidden', 'wc-frontend-manager')), 'class' => 'wcfm-select wcfm_ele wcfm_half_ele wcfm_half_ele_right simple variable external', 'label_class' => 'wcfm_ele wcfm_half_ele_title wcfm_title simple variable external', 'value' => $visibility, 'hints' => __('Choose where this product should be displayed in your catalog. The product will always be accessible directly.', 'wc-frontend-manager'))
), $product_id, $product_type ) );
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'wcfm_product_manage_fields_pricing', array(
"product_url" => array('label' => __('URL', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele wcfm_half_ele external', 'label_class' => 'wcfm_ele wcfm_half_ele_title wcfm_title external', 'value' => $product_url, 'hints' => __( 'Enter the external URL to the product.', 'wc-frontend-manager' )),
"button_text" => array('label' => __('Button Text', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele wcfm_half_ele wcfm_half_ele_right external', 'label_class' => 'wcfm_ele wcfm_half_ele_title wcfm_title external', 'value' => $button_text, 'hints' => __( 'This text will be shown on the button linking to the external product.', 'wc-frontend-manager' )),
"regular_price" => array('label' => __('Price', 'wc-frontend-manager') . '(' . get_woocommerce_currency_symbol() . ')', 'type' => 'text', 'class' => 'wcfm-text wcfm_ele wcfm_half_ele simple external non-subscription non-variable-subscription non-auction non-redq_rental', 'label_class' => 'wcfm_ele wcfm_half_ele_title wcfm_title simple external non-subscription non-variable-subscription non-auction non-redq_rental', 'value' => $regular_price ),
"sale_price" => array('label' => __('Sale Price', 'wc-frontend-manager') . '(' . get_woocommerce_currency_symbol() . ')', 'type' => 'text', 'class' => 'wcfm-text wcfm_ele wcfm_half_ele wcfm_half_ele_right simple external non-variable-subscription non-auction non-redq_rental', 'label_class' => 'wcfm_ele wcfm_half_ele_title wcfm_title simple external non-variable-subscription non-auction non-redq_rental', 'value' => $sale_price, 'desc_class' => 'wcfm_ele simple external non-variable-subscription non-auction non-redq_rental sales_schedule', 'desc' => __( 'schedule', 'wc-frontend-manager' ) ),
), $product_id, $product_type ) );
// Sales scheduling missing message
if( !WCFM_Dependencies::wcfmu_plugin_active_check() ) {
if( $is_wcfmu_inactive_notice_show = apply_filters( 'is_wcfmu_inactive_notice_show', true ) ) {
echo '<div class="sales_schedule_ele">';
wcfmu_feature_help_text_show( __( 'Sales scheduling', 'wc-frontend-manager' ) );
echo '</div>';
}
}
?>
<div class="wcfm_clearfix"></div>
<?php if( $wcfm_is_allow_tags = apply_filters( 'wcfm_is_allow_tags', true ) ) { $catlimit = apply_filters( 'wcfm_catlimit', -1 ); ?>
<p class="wcfm_title"><strong><?php _e( 'Categories', 'wc-frontend-manager' ); ?></strong></p><label class="screen-reader-text" for="product_cats"><?php _e( 'Categories', 'wc-frontend-manager' ); ?></label>
<select id="product_cats" name="product_cats[]" class="wcfm-select wcfm_ele simple variable external grouped booking" multiple="multiple" data-catlimit="<?php echo $catlimit; ?>" style="width: 100%; margin-bottom: 10px;">
<?php
if ( $product_categories ) {
$this->generateTaxonomyHTML( 'product_cat', $product_categories, $categories );
}
?>
</select>
<?php
$product_taxonomies = get_object_taxonomies( 'product', 'objects' );
if( !empty( $product_taxonomies ) ) {
foreach( $product_taxonomies as $product_taxonomy ) {
if( !in_array( $product_taxonomy->name, array( 'product_cat', 'product_tag', 'wcpv_product_vendors' ) ) ) {
if( $product_taxonomy->public && $product_taxonomy->show_ui ) {
// Fetching Saved Values
$taxonomy_values_arr = array();
if($product && !empty($product)) {
$taxonomy_values = get_the_terms( $product_id, $product_taxonomy->name );
if( !empty($taxonomy_values) ) {
foreach($taxonomy_values as $pkey => $ptaxonomy) {
$taxonomy_values_arr[] = $ptaxonomy->term_id;
}
}
}
?>
<p class="wcfm_title"><strong><?php _e( $product_taxonomy->label, 'wc-frontend-manager' ); ?></strong></p><label class="screen-reader-text" for="<?php echo $product_taxonomy->name; ?>"><?php _e( $product_taxonomy->label, 'wc-frontend-manager' ); ?></label>
<select id="<?php echo $product_taxonomy->name; ?>" name="product_custom_taxonomies[<?php echo $product_taxonomy->name; ?>][]" class="wcfm-select product_taxonomies wcfm_ele simple variable external grouped booking" multiple="multiple" style="width: 100%; margin-bottom: 10px;">
<?php
$product_taxonomy_terms = get_terms( $product_taxonomy->name, 'orderby=name&hide_empty=0&parent=0' );
if ( $product_taxonomy_terms ) {
$this->generateTaxonomyHTML( $product_taxonomy->name, $product_taxonomy_terms, $taxonomy_values_arr );
}
?>
</select>
<?php
}
}
}
}
}
if( $wcfm_is_allow_tags = apply_filters( 'wcfm_is_allow_tags', true ) ) {
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'product_simple_fields_taxonomy', array( "product_tags" => array('label' => __('Tags', 'wc-frontend-manager') , 'type' => 'textarea', 'class' => 'wcfm-textarea wcfm_ele wcfm_full_ele simple variable external grouped booking', 'label_class' => 'wcfm_title wcfm_full_ele', 'value' => $product_tags, 'placeholder' => __('Separate Product Tags with commas', 'wc-frontend-manager'))
) ) );
}
?>
</div>
<div class="wcfm_product_manager_gallery_fields">
<?php
if( $wcfm_is_allow_featured = apply_filters( 'wcfm_is_allow_featured', true ) ) {
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'wcfm_product_manage_fields_gallery', array( "featured_img" => array( 'type' => 'upload', 'class' => 'wcfm-product-feature-upload wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title', 'prwidth' => 250, 'value' => $featured_img)
), $gallery_img_urls ) );
// Product Gallary missing message
if( !WCFM_Dependencies::wcfmu_plugin_active_check() ) {
if( $is_wcfmu_inactive_notice_show = apply_filters( 'is_wcfmu_inactive_notice_show', true ) ) {
wcfmu_feature_help_text_show( __( 'Image Gallery', 'wc-frontend-manager' ), false, true );
}
}
}
?>
</div>
</div>
<div class="wcfm-content">
<div class="wcfm_product_manager_content_fields">
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'wcfm_product_manage_fields_content', array(
"excerpt" => array('label' => __('Short Description', 'wc-frontend-manager') , 'type' => 'textarea', 'class' => 'wcfm-textarea wcfm_ele wcfm_full_ele simple variable external grouped booking' , 'label_class' => 'wcfm_title wcfm_full_ele', 'value' => $excerpt),
"description" => array('label' => __('Description', 'wc-frontend-manager') , 'type' => 'textarea', 'class' => 'wcfm-textarea wcfm_ele wcfm_full_ele simple variable external grouped booking', 'label_class' => 'wcfm_title wcfm_full_ele', 'value' => $description),
"pro_id" => array('type' => 'hidden', 'value' => $product_id)
), $product_id, $product_type ) );
?>
</div>
</div>
</div>
<!-- end collapsible -->
<div class="wcfm_clearfix"></div><br />
<!-- wrap -->
<div class="wcfm-tabWrap">
<?php if( $allow_inventory = apply_filters( 'wcfm_is_allow_inventory', true ) ) { ?>
<!-- collapsible 2 -->
<div class="page_collapsible products_manage_inventory simple variable grouped external booking" id="wcfm_products_manage_form_inventory_head"><label class="fa fa-database"></label><?php _e('Inventory', 'wc-frontend-manager'); ?><span></span></div>
<div class="wcfm-container simple variable grouped external booking">
<div id="wcfm_products_manage_form_inventory_expander" class="wcfm-content">
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'product_simple_fields_stock', array(
"sku" => array('label' => __('SKU', 'wc-frontend-manager') , 'type' => 'text', 'class' => 'wcfm-text', 'label_class' => 'wcfm_title', 'value' => $sku, 'hints' => __( 'SKU refers to a Stock-keeping unit, a unique identifier for each distinct product and service that can be purchased.', 'wc-frontend-manager' )),
"manage_stock" => array('label' => __('Manage Stock?', 'wc-frontend-manager') , 'type' => 'checkbox', 'class' => 'wcfm-checkbox wcfm_ele simple variable manage_stock_ele non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'value' => 'enable', 'label_class' => 'wcfm_title wcfm_ele checkbox_title simple variable non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'hints' => __('Enable stock management at product level', 'wc-frontend-manager'), 'dfvalue' => $manage_stock),
"stock_qty" => array('label' => __('Stock Qty', 'wc-frontend-manager') , 'type' => 'number', 'class' => 'wcfm-text wcfm_ele simple variable non_manage_stock_ele non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'label_class' => 'wcfm_title simple variable non_manage_stock_ele non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'value' => $stock_qty, 'hints' => __( 'Stock quantity. If this is a variable product this value will be used to control stock for all variations, unless you define stock at variation level.', 'wc-frontend-manager' )),
"backorders" => array('label' => __('Allow Backorders?', 'wc-frontend-manager') , 'type' => 'select', 'options' => array('no' => __('Do not Allow', 'wc-frontend-manager'), 'notify' => __('Allow, but notify customer', 'wc-frontend-manager'), 'yes' => __('Allow', 'wc-frontend-manager')), 'class' => 'wcfm-select wcfm_ele simple variable non_manage_stock_ele non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'label_class' => 'wcfm_title wcfm_ele simple variable non_manage_stock_ele non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'value' => $backorders, 'hints' => __( 'If managing stock, this controls whether or not backorders are allowed. If enabled, stock quantity can go below 0.', 'wc-frontend-manager' )),
"stock_status" => array('label' => __('Stock status', 'wc-frontend-manager') , 'type' => 'select', 'options' => array('instock' => __('In stock', 'wc-frontend-manager'), 'outofstock' => __('Out of stock', 'wc-frontend-manager')), 'class' => 'wcfm-select wcfm_ele simple variable grouped non-variable-subscription non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'label_class' => 'wcfm_ele wcfm_title simple variable grouped non-variable-subscription non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'value' => $stock_status, 'hints' => __( 'Controls whether or not the product is listed as "in stock" or "out of stock" on the frontend.', 'wc-frontend-manager' )),
"sold_individually" => array('label' => __('Sold Individually', 'wc-frontend-manager') , 'type' => 'checkbox', 'value' => 'enable', 'class' => 'wcfm-checkbox wcfm_ele simple variable non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'hints' => __('Enable this to only allow one of this item to be bought in a single order', 'wc-frontend-manager'), 'label_class' => 'wcfm_title wcfm_ele simple variable checkbox_title non-job_package non-resume_package non-auction non-redq_rental non-appointment', 'dfvalue' => $sold_individually)
), $product_id, $product_type ) );
?>
</div>
</div>
<!-- end collapsible -->
<div class="wcfm_clearfix"></div>
<?php } ?>
<?php do_action( 'after_wcfm_products_manage_general', $product_id, $product_type ); ?>
<!-- collapsible 3 - Grouped Product -->
<div class="page_collapsible products_manage_grouped grouped" id="wcfm_products_manage_form_grouped_head"><label class="fa fa-object-group"></label><?php _e('Grouped Products', 'wc-frontend-manager'); ?><span></span></div>
<div class="wcfm-container grouped">
<div id="wcfm_products_manage_form_grouped_expander" class="wcfm-content">
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'product_manage_fields_grouped', array(
"grouped_products" => array('label' => __('Grouped products', 'wc-frontend-manager') , 'type' => 'select', 'attributes' => array( 'multiple' => 'multiple', 'style' => 'width: 60%;' ), 'class' => 'wcfm-select wcfm_ele grouped', 'label_class' => 'wcfm_title wcfm_ele grouped', 'options' => $products_array, 'value' => $children, 'hints' => __( 'This lets you choose which products are part of this group.', 'wc-frontend-manager' ))
)) );
?>
</div>
</div>
<!-- end collapsible -->
<div class="wcfm_clearfix"></div>
<?php if( $allow_shipping = apply_filters( 'wcfm_is_allow_shipping', true ) ) { ?>
<!-- collapsible 4 -->
<div class="page_collapsible products_manage_shipping simple variable nonvirtual booking non-appointment" id="wcfm_products_manage_form_shipping_head"><label class="fa fa-truck"></label><?php _e('Shipping', 'wc-frontend-manager'); ?><span></span></div>
<div class="wcfm-container simple variable nonvirtual booking non-appointment">
<div id="wcfm_products_manage_form_shipping_expander" class="wcfm-content">
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'wcfm_product_manage_fields_shipping', array( "weight" => array( 'label' => __('Weight', 'wc-frontend-manager') . ' ('.get_option( 'woocommerce_weight_unit', 'kg' ).')' , 'type' => 'text', 'class' => 'wcfm-text wcfm_ele simple variable booking', 'label_class' => 'wcfm_title', 'value' => $weight),
"length" => array( 'label' => __('Dimensions', 'wc-frontend-manager') . ' ('.get_option( 'woocommerce_dimension_unit', 'cm' ).')', 'placeholder' => __('Length', 'wc-frontend-manager'), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele simple variable booking', 'label_class' => 'wcfm_title', 'value' => $length),
"width" => array( 'placeholder' => __('Width', 'wc-frontend-manager'), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele simple variable booking', 'label_class' => 'wcfm_title', 'value' => $width),
"height" => array( 'placeholder' => __('Height', 'wc-frontend-manager'), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele simple variable booking', 'label_class' => 'wcfm_title', 'value' => $height),
"shipping_class" => array('label' => __('Shipping class', 'wc-frontend-manager') , 'type' => 'select', 'options' => $shipping_option_array, 'class' => 'wcfm-select wcfm_ele simple variable booking', 'label_class' => 'wcfm_title', 'value' => $shipping_class)
), $product_id ) );
?>
</div>
</div>
<!-- end collapsible -->
<div class="wcfm_clearfix"></div>
<?php } ?>
<?php if( $allow_tax = apply_filters( 'wcfm_is_allow_tax', true ) ) { ?>
<?php if ( wc_tax_enabled() ) { ?>
<!-- collapsible 5 -->
<div class="page_collapsible products_manage_tax simple variable" id="wcfm_products_manage_form_tax_head"><label class="fa fa-paypal"></label><?php _e('Tax', 'wc-frontend-manager'); ?><span></span></div>
<div class="wcfm-container simple variable">
<div id="wcfm_products_manage_form_tax_expander" class="wcfm-content">
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'product_simple_fields_tax', array(
"tax_status" => array('label' => __('Tax Status', 'wc-frontend-manager') , 'type' => 'select', 'options' => array( 'taxable' => __( 'Taxable', 'wc-frontend-manager' ), 'shipping' => __( 'Shipping only', 'wc-frontend-manager' ), 'none' => _x( 'None', 'Tax status', 'wc-frontend-manager' ) ), 'class' => 'wcfm-select wcfm_ele simple variable', 'label_class' => 'wcfm_title', 'value' => $tax_status, 'hints' => __( 'Define whether or not the entire product is taxable, or just the cost of shipping it.', 'wc-frontend-manager' )),
"tax_class" => array('label' => __('Tax Class', 'wc-frontend-manager') , 'type' => 'select', 'options' => $tax_classes_options, 'class' => 'wcfm-select wcfm_ele simple variable', 'label_class' => 'wcfm_title', 'value' => $tax_class, 'hints' => __( 'Choose a tax class for this product. Tax classes are used to apply different tax rates specific to certain types of product.', 'wc-frontend-manager' ))
)) );
?>
</div>
</div>
<!-- end collapsible -->
<div class="wcfm_clearfix"></div>
<?php } ?>
<?php } ?>
<?php if( $allow_attribute = apply_filters( 'wcfm_is_allow_attribute', true ) ) { ?>
<!-- collapsible 6 -->
<div class="page_collapsible products_manage_attribute simple variable external grouped booking" id="wcfm_products_manage_form_attribute_head"><label class="fa fa-server"></label><?php _e('Attributes', 'wc-frontend-manager'); ?><span></span></div>
<div class="wcfm-container simple variable external grouped booking">
<div id="wcfm_products_manage_form_attribute_expander" class="wcfm-content">
<?php do_action( 'wcfm_products_manage_attributes' ); ?>
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'product_simple_fields_attributes', array(
"attributes" => array('label' => __('Attributes', 'wc-frontend-manager') , 'type' => 'multiinput', 'class' => 'wcfm-text wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title', 'value' => $attributes, 'options' => array(
"term_name" => array('type' => 'hidden'),
"name" => array('label' => __('Name', 'wc-frontend-manager'), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title'),
"value" => array('label' => __('Value(s):', 'wc-frontend-manager'), 'type' => 'textarea', 'class' => 'wcfm-textarea wcfm_ele simple variable external grouped booking', 'placeholder' => __('Enter some text, some attributes by "|" separating values.', 'wc-frontend-manager'), 'label_class' => 'wcfm_title'),
"is_visible" => array('label' => __('Visible on the product page', 'wc-frontend-manager'), 'type' => 'checkbox', 'value' => 'enable', 'class' => 'wcfm-checkbox wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title checkbox_title'),
"is_variation" => array('label' => __('Use as Variation', 'wc-frontend-manager'), 'type' => 'checkbox', 'value' => 'enable', 'class' => 'wcfm-checkbox wcfm_ele variable variable-subscription', 'label_class' => 'wcfm_title checkbox_title wcfm_ele variable variable-subscription'),
"tax_name" => array('type' => 'hidden'),
"is_taxonomy" => array('type' => 'hidden')
))
)) );
if( !empty($attributes_select_type) ) {
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'product_simple_fields_attributes', array(
"select_attributes" => array('type' => 'multiinput', 'class' => 'wcfm-text wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title', 'value' => $attributes_select_type, 'options' => array(
"term_name" => array('type' => 'hidden'),
"name" => array('label' => __('Name', 'wc-frontend-manager'), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title'),
"value" => array('label' => __('Value(s):', 'wc-frontend-manager'), 'type' => 'select', 'attributes' => array( 'multiple' => 'multiple', 'style' => 'width: 60%;' ), 'class' => 'wcfm-select wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title'),
"is_visible" => array('label' => __('Visible on the product page', 'wc-frontend-manager'), 'type' => 'checkbox', 'value' => 'enable', 'class' => 'wcfm-checkbox wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title checkbox_title'),
"is_variation" => array('label' => __('Use as Variation', 'wc-frontend-manager'), 'type' => 'checkbox', 'value' => 'enable', 'class' => 'wcfm-checkbox wcfm_ele variable variable-subscription', 'label_class' => 'wcfm_title checkbox_title wcfm_ele variable variable-subscription'),
"tax_name" => array('type' => 'hidden'),
"is_taxonomy" => array('type' => 'hidden')
))
)) );
}
?>
</div>
</div>
<!-- end collapsible -->
<div class="wcfm_clearfix"></div>
<?php } ?>
<?php if( $allow_attribute = apply_filters( 'wcfm_is_allow_variable', true ) ) { ?>
<!-- collapsible 7 -->
<div class="page_collapsible products_manage_variations variable variations variable-subscription" id="wcfm_products_manage_form_variations_head"><label class="fa fa-tasks"></label><?php _e('Variations', 'wc-frontend-manager'); ?><span></span></div>
<div class="wcfm-container variable variable-subscription">
<div id="wcfm_products_manage_form_variations_expander" class="wcfm-content">
<p>
<div class="default_attributes_holder">
<p class="wcfm_title selectbox_title"><strong><?php _e( 'Default Form Values:', 'wc-frontend-manager' ); ?></strong></p>
<input type="hidden" name="default_attributes_hidden" data-name="default_attributes_hidden" value="<?php echo esc_attr( $default_attributes ); ?>" />
</div>
</p>
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( array(
"variations" => array('type' => 'multiinput', 'class' => 'wcfm_ele variable variable-subscription', 'label_class' => 'wcfm_title', 'value' => $variations, 'options' =>
apply_filters( 'wcfm_product_manage_fields_variations', array(
"id" => array('type' => 'hidden', 'class' => 'variation_id'),
"enable" => array('label' => __('Enable', 'wc-frontend-manager'), 'type' => 'checkbox', 'value' => 'enable', 'class' => 'wcfm-checkbox wcfm_ele variable variable-subscription', 'label_class' => 'wcfm_title checkbox_title'),
"manage_stock" => array('label' => __('Manage Stock', 'wc-frontend-manager'), 'type' => 'checkbox', 'value' => 'enable', 'value' => 'enable', 'class' => 'wcfm-checkbox wcfm_ele variable variable-subscription variation_manage_stock_ele', 'label_class' => 'wcfm_title checkbox_title'),
"image" => array('label' => __('Image', 'wc-frontend-manager'), 'type' => 'upload', 'class' => 'wcfm-text wcfm_ele variable variable-subscription', 'label_class' => 'wcfm_title wcfm_half_ele_upload_title'),
"regular_price" => array('label' => __('Regular Price', 'wc-frontend-manager') . '(' . get_woocommerce_currency_symbol() . ')', 'type' => 'text', 'class' => 'wcfm-text wcfm_ele wcfm_half_ele variable', 'label_class' => 'wcfm_title wcfm_ele wcfm_half_ele_title variable'),
"sale_price" => array('label' => __('Sale Price', 'wc-frontend-manager') . '(' . get_woocommerce_currency_symbol() . ')', 'type' => 'text', 'class' => 'wcfm-text wcfm_ele wcfm_half_ele variable variable-subscription', 'label_class' => 'wcfm_title wcfm_ele wcfm_half_ele_title variable variable-subscription'),
"stock_qty" => array('label' => __('Stock Qty', 'wc-frontend-manager') , 'type' => 'number', 'class' => 'wcfm-text wcfm_ele wcfm_half_ele variable variable-subscription variation_non_manage_stock_ele', 'label_class' => 'wcfm_title wcfm_half_ele_title variation_non_manage_stock_ele'),
"backorders" => array('label' => __('Backorders?', 'wc-frontend-manager') , 'type' => 'select', 'options' => array('no' => __('Do not Allow', 'wc-frontend-manager'), 'notify' => __('Allow, but notify customer', 'wc-frontend-manager'), 'yes' => __('Allow', 'wc-frontend-manager')), 'class' => 'wcfm-select wcfm_ele wcfm_half_ele variable variable-subscription variation_non_manage_stock_ele', 'label_class' => 'wcfm_title wcfm_half_ele_title variation_non_manage_stock_ele'),
"sku" => array('label' => __('SKU', 'wc-frontend-manager'), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele wcfm_half_ele variable variable-subscription', 'label_class' => 'wcfm_title wcfm_half_ele_title'),
"stock_status" => array('label' => __('Stock status', 'wc-frontend-manager') , 'type' => 'select', 'options' => array('instock' => __('In stock', 'wc-frontend-manager'), 'outofstock' => __('Out of stock', 'wc-frontend-manager')), 'class' => 'wcfm-select wcfm_ele wcfm_half_ele variable variable-subscription', 'label_class' => 'wcfm_title wcfm_half_ele_title'),
"attributes" => array('type' => 'hidden')
), $variations, $variation_shipping_option_array, $variation_tax_classes_options ) )
) );
?>
</div>
</div>
<!-- end collapsible -->
<div class="wcfm_clearfix"></div>
<?php } ?>
<?php if( $allow_advanced = apply_filters( 'wcfm_is_allow_linked', true ) ) { ?>
<!-- collapsible 8 - Linked Product -->
<div class="page_collapsible products_manage_linked simple variable external grouped" id="wcfm_products_manage_form_linked_head"><label class="fa fa-link"></label><?php _e('Linked', 'wc-frontend-manager'); ?><span></span></div>
<div class="wcfm-container simple variable external grouped">
<div id="wcfm_products_manage_form_linked_expander" class="wcfm-content">
<?php
$WCFM->wcfm_fields->wcfm_generate_form_field( apply_filters( 'product_manage_fields_linked', array(
"upsell_ids" => array('label' => __('Up-sells', 'wc-frontend-manager') , 'type' => 'select', 'attributes' => array( 'multiple' => 'multiple', 'style' => 'width: 60%;' ), 'class' => 'wcfm-select wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title', 'options' => $products_array, 'value' => $upsell_ids, 'hints' => __( 'Up-sells are products which you recommend instead of the currently viewed product, for example, products that are more profitable or better quality or more expensive.', 'wc-frontend-manager' )),
"crosssell_ids" => array('label' => __('Cross-sells', 'wc-frontend-manager') , 'type' => 'select', 'attributes' => array( 'multiple' => 'multiple', 'style' => 'width: 60%;' ), 'class' => 'wcfm-select wcfm_ele simple variable external grouped booking', 'label_class' => 'wcfm_title', 'options' => $products_array, 'value' => $crosssell_ids, 'hints' => __( 'Cross-sells are products which you promote in the cart, based on the current product.', 'wc-frontend-manager' ))
)) );
?>
</div>
</div>
<!-- end collapsible -->
<div class="wcfm_clearfix"></div>
<?php } ?>
<?php do_action( 'end_wcfm_products_manage', $product_id ); ?>
</div> <!-- tabwrap -->
<div class="wcfm-message" tabindex="-1"></div>
<div id="wcfm_products_simple_submit">
<input type="submit" name="submit-data" value="<?php if( current_user_can( 'publish_products' ) ) { _e( 'Submit', 'wc-frontend-manager' ); } else { _e( 'Submit for Review', 'wc-frontend-manager' ); } ?>" id="wcfm_products_simple_submit_button" class="wcfm_submit_button" />
<?php if( ( isset( $wp->query_vars['wcfm-products-manage'] ) && empty( $wp->query_vars['wcfm-products-manage'] ) ) || ( isset( $wp->query_vars['wcfm-products-manage'] ) && !empty( $wp->query_vars['wcfm-products-manage'] ) && ( get_post_status( $wp->query_vars['wcfm-products-manage'] ) == 'draft' ) ) ) { ?>
<input type="submit" name="draft-data" value="<?php _e( 'Draft', 'wc-frontend-manager' ); ?>" id="wcfm_products_simple_draft_button" class="wcfm_submit_button" />
<?php } ?>
</div>
</form>
<?php
do_action( 'after_wcfm_products_manage' );
?>
</div>
</div>