Package reference #36
@@ -148,6 +148,7 @@ class Wiaas_Admin_CL_Packages {
|
||||
|
||||
$cl_columns['thumb'] = $columns['thumb'];
|
||||
$cl_columns['wiaas_cl_name'] = $columns['name'];
|
||||
$cl_columns['taxonomy-product_tag'] = __( 'Reference', 'wiaas' );
|
||||
$cl_columns['taxonomy-package_type'] = __('Type', 'wiaas');
|
||||
$cl_columns['taxonomy-package_status'] = __('Status', 'wiaas');
|
||||
$cl_columns['taxonomy-product_country'] = $columns['taxonomy-product_country'];
|
||||
|
||||
@@ -11,6 +11,7 @@ class Wiaas_Admin_Package {
|
||||
require_once dirname( __FILE__ ) . '/package/class-wiaas-admin-linked-packages.php';
|
||||
require_once dirname( __FILE__ ) . '/package/class-wiaas-admin-package-types.php';
|
||||
|
||||
add_action( 'manage_product_posts_columns', array( __CLASS__, 'manage_list_table_products_columns' ), 999, 2 );
|
||||
add_action( 'woocommerce_product_data_tabs', array( __CLASS__, 'package_data_tabs' ), 999);
|
||||
}
|
||||
|
||||
@@ -33,6 +34,19 @@ class Wiaas_Admin_Package {
|
||||
|
||||
return $tabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customize list table product columns
|
||||
*
|
||||
* @param array $columns
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function manage_list_table_products_columns($columns) {
|
||||
$columns['product_tag'] = __( 'Reference', 'wiaas' );
|
||||
|
||||
return $columns;
|
||||
}
|
||||
}
|
||||
|
||||
Wiaas_Admin_Package::init();
|
||||
@@ -23,7 +23,8 @@ class Wiaas_DB_Update {
|
||||
'201810180544702' => 'wiaas_db_update_update_commercial_lead_capabilities',
|
||||
'201810180644703' => 'wiaas_db_update_add_organization_info_ui_fields',
|
||||
'201910190145700' => 'wiaas_db_update_add_general_ui_fields',
|
||||
'201910190146700' => 'wiaas_db_update_add_product_properties_ui_fields'
|
||||
'201910190146700' => 'wiaas_db_update_add_product_properties_ui_fields',
|
||||
'201810190644704' => 'wiaas_db_update_add_reference_ui_field'
|
||||
);
|
||||
|
||||
public static function execute() {
|
||||
|
||||
@@ -32,6 +32,9 @@ class Wiaas_Package {
|
||||
|
||||
$data = self::_append_country_info($data, $package, $request);
|
||||
|
||||
// append package reference field
|
||||
$data['reference'] = ! empty($data['tags']) ? $data['tags'][0]['name'] : '';
|
||||
|
||||
if (isset($request['id'])) {
|
||||
$data = self::_append_package_prices($data, $package, $request);
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ class Wiaas_Product {
|
||||
require_once dirname( __FILE__ ) . '/product/class-wiaas-product-supplier.php';
|
||||
|
||||
add_filter('woocommerce_register_post_type_product', array(__CLASS__, 'manage_product_settings'));
|
||||
|
||||
add_filter('woocommerce_taxonomy_args_product_tag', array(__CLASS__, 'manage_tags_as_references'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -16,7 +18,7 @@ class Wiaas_Product {
|
||||
*
|
||||
* @param $args
|
||||
*
|
||||
* @return mixed
|
||||
* @return array
|
||||
*/
|
||||
public static function manage_product_settings($args) {
|
||||
|
||||
@@ -34,6 +36,38 @@ class Wiaas_Product {
|
||||
$args['supports'] = array( 'title', 'thumbnail' );
|
||||
|
||||
|
||||
return $args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide default metabox for product tags
|
||||
*
|
||||
* @param $args
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function manage_tags_as_references($args) {
|
||||
// hide metabox
|
||||
$args['meta_box_cb'] = false;
|
||||
|
||||
// update labels
|
||||
$args['labels'] = array(
|
||||
'name' => __( 'Product references', 'wiaas' ),
|
||||
'singular_name' => __( 'Reference', 'wiaas' ),
|
||||
'menu_name' => _x( 'References', 'Admin menu name', 'wiaas' ),
|
||||
'search_items' => __( 'Search references', 'wiaas' ),
|
||||
'all_items' => __( 'All references', 'wiaas' ),
|
||||
'edit_item' => __( 'Edit reference', 'wiaas' ),
|
||||
'update_item' => __( 'Update reference', 'wiaas' ),
|
||||
'add_new_item' => __( 'Add new reference', 'wiaas' ),
|
||||
'new_item_name' => __( 'New reference name', 'wiaas' ),
|
||||
'popular_items' => __( 'Popular references', 'wiaas' ),
|
||||
'separate_items_with_commas' => __( 'Separate references with commas', 'wiaas' ),
|
||||
'add_or_remove_items' => __( 'Add or remove references', 'wiaas' ),
|
||||
'choose_from_most_used' => __( 'Choose from the most used references', 'wiaas' ),
|
||||
'not_found' => __( 'No references found', 'wiaas' ),
|
||||
);
|
||||
|
||||
return $args;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"taxonomy": "category",
|
||||
"taxonomy": "supplier",
|
||||
"field_type": "select",
|
||||
"allow_null": 0,
|
||||
"add_term": 1,
|
||||
"add_term": 0,
|
||||
"save_terms": 1,
|
||||
"load_terms": 1,
|
||||
"return_format": "id",
|
||||
@@ -63,7 +63,7 @@
|
||||
"taxonomy": "product_cat",
|
||||
"field_type": "select",
|
||||
"allow_null": 0,
|
||||
"add_term": 1,
|
||||
"add_term": 0,
|
||||
"save_terms": 1,
|
||||
"load_terms": 1,
|
||||
"return_format": "id",
|
||||
@@ -102,7 +102,7 @@
|
||||
]
|
||||
],
|
||||
"menu_order": 0,
|
||||
"position": "side",
|
||||
"position": "acf_after_title",
|
||||
"style": "default",
|
||||
"label_placement": "top",
|
||||
"instruction_placement": "label",
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
[
|
||||
{
|
||||
"key": "group_5bc845c001de4",
|
||||
"title": "Package Reference",
|
||||
"fields": [
|
||||
{
|
||||
"key": "field_5bc845dc7eed5",
|
||||
"label": "Reference",
|
||||
"name": "_wiaas_package_reference",
|
||||
"type": "taxonomy",
|
||||
"instructions": "",
|
||||
"required": 0,
|
||||
"conditional_logic": 0,
|
||||
"wrapper": {
|
||||
"width": "",
|
||||
"class": "",
|
||||
"id": ""
|
||||
},
|
||||
"taxonomy": "product_tag",
|
||||
"field_type": "select",
|
||||
"allow_null": 0,
|
||||
"add_term": 1,
|
||||
"save_terms": 1,
|
||||
"load_terms": 1,
|
||||
"return_format": "id",
|
||||
"multiple": 0
|
||||
}
|
||||
],
|
||||
"location": [
|
||||
[
|
||||
{
|
||||
"param": "post_type",
|
||||
"operator": "==",
|
||||
"value": "product"
|
||||
},
|
||||
{
|
||||
"param": "post_taxonomy",
|
||||
"operator": "==",
|
||||
"value": "product_type:bundle"
|
||||
}
|
||||
]
|
||||
],
|
||||
"menu_order": 0,
|
||||
"position": "acf_after_title",
|
||||
"style": "seamless",
|
||||
"label_placement": "top",
|
||||
"instruction_placement": "label",
|
||||
"hide_on_screen": "",
|
||||
"active": 1,
|
||||
"description": ""
|
||||
}
|
||||
]
|
||||
@@ -18,6 +18,33 @@ function wiaas_db_update_add_user_organization_ui_fields() {
|
||||
_wiaas_import_field_group($ui_json);
|
||||
}
|
||||
|
||||
function wiaas_db_update_add_reference_ui_field() {
|
||||
|
||||
$ui_json = file_get_contents( dirname( __FILE__ ) . '/data/wiaas-ui-field-reference.json' );
|
||||
|
||||
$ui_json = json_decode( $ui_json, true );
|
||||
|
||||
_wiaas_import_field_group($ui_json);
|
||||
}
|
||||
|
||||
function wiaas_db_update_add_general_ui_fields() {
|
||||
|
||||
$ui_json = file_get_contents( dirname( __FILE__ ) . '/data/wiaas-ui-field-general.json' );
|
||||
|
||||
$ui_json = json_decode( $ui_json, true );
|
||||
|
||||
_wiaas_import_field_group($ui_json);
|
||||
}
|
||||
|
||||
function wiaas_db_update_add_product_properties_ui_fields() {
|
||||
|
||||
$ui_json = file_get_contents( dirname( __FILE__ ) . '/data/wiaas-ui-field-product-properties.json' );
|
||||
|
||||
$ui_json = json_decode( $ui_json, true );
|
||||
|
||||
_wiaas_import_field_group($ui_json);
|
||||
}
|
||||
|
||||
|
||||
// private helper function
|
||||
|
||||
@@ -100,21 +127,3 @@ function _wiaas_import_field_group($json) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function wiaas_db_update_add_general_ui_fields() {
|
||||
|
||||
$ui_json = file_get_contents( dirname( __FILE__ ) . '/data/wiaas-ui-field-general.json' );
|
||||
|
||||
$ui_json = json_decode( $ui_json, true );
|
||||
|
||||
acf_import_field_group($ui_json[0]);
|
||||
}
|
||||
|
||||
function wiaas_db_update_add_product_properties_ui_fields() {
|
||||
|
||||
$ui_json = file_get_contents( dirname( __FILE__ ) . '/data/wiaas-ui-field-product-properties.json' );
|
||||
|
||||
$ui_json = json_decode( $ui_json, true );
|
||||
|
||||
acf_import_field_group($ui_json[0]);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ function extractGroups(wcPackageGroups) {
|
||||
export const fromWCPackage = wcPackage => {
|
||||
return {
|
||||
id: wcPackage.id,
|
||||
reference: wcPackage.slug,
|
||||
reference: wcPackage.reference,
|
||||
image: wcPackage.images[0].src || DEFAULT_PACKAGE_IMG,
|
||||
hasImage: !!wcPackage.images.length,
|
||||
name: wcPackage.name,
|
||||
|
||||
Reference in New Issue
Block a user