diff --git a/src/acore-wp-plugin/src/Hooks/WooCommerce/FieldElements.php b/src/acore-wp-plugin/src/Hooks/WooCommerce/FieldElements.php index 407ce4cc..dffc8524 100644 --- a/src/acore-wp-plugin/src/Hooks/WooCommerce/FieldElements.php +++ b/src/acore-wp-plugin/src/Hooks/WooCommerce/FieldElements.php @@ -121,7 +121,8 @@ public static function get3dViewer(int $itemId = 0): void { $race = get_post_meta($post->ID, '_3d_race', true); $gender = get_post_meta($post->ID, '_3d_gender', true); $gender = $gender === '2' ? rand(0, 1) : $gender; - $creatureDisplayId = get_post_meta($post->ID, '_3d_displayid', true); + $creatureDisplayId = get_post_meta($post->ID, '_3d_npc_displayid', true); + $itemDisplayId = get_post_meta($post->ID, '_3d_item_displayid', true); $isSingleItem = get_post_meta($post->ID, '_3d_single_item', true) === 'yes'; if ($itemId === 0 && $creatureDisplayId === '') { @@ -199,6 +200,11 @@ function show3dModel(displayId, entity, inventoryType=0, race=1, gender=0) { .then(response => response.text()) .then(data => { let [displayId, entity, inventoryType] = data.split(','); + + + displayId = ; + + inventoryType = Number(inventoryType); show3dModel(displayId, entity, inventoryType, , ); diff --git a/src/acore-wp-plugin/src/Hooks/WooCommerce/Products.php b/src/acore-wp-plugin/src/Hooks/WooCommerce/Products.php index cbffbd2a..df1d9466 100644 --- a/src/acore-wp-plugin/src/Hooks/WooCommerce/Products.php +++ b/src/acore-wp-plugin/src/Hooks/WooCommerce/Products.php @@ -26,12 +26,19 @@ function add_custom_3d_checkbox_fields() { )); woocommerce_wp_text_input(array( - 'id' => '_3d_displayid', - 'label' => __('Force displayid', 'woocommerce'), + 'id' => '_3d_npc_displayid', + 'label' => __('Force NPC displayid', 'woocommerce'), 'description' => __('Enter a specific Creature displayid.', 'woocommerce'), 'desc_tip' => 'true', )); - + + woocommerce_wp_text_input(array( + 'id' => '_3d_item_displayid', + 'label' => __('Force item displayid', 'woocommerce'), + 'description' => __('Enter a specific Item displayid.', 'woocommerce'), + 'desc_tip' => 'true', + )); + woocommerce_wp_select(array( 'id' => '_3d_race', 'label' => __('Race (optional)', 'woocommerce'), @@ -78,8 +85,11 @@ function save_3d_checkbox_field($post_id) { $isSingleItem = isset($_POST['_3d_single_item']) ? 'yes' : 'no'; update_post_meta($post_id, '_3d_single_item', $isSingleItem); - $custom_text_input = isset($_POST['_3d_displayid']) ? sanitize_text_field($_POST['_3d_displayid']) : ''; - update_post_meta($post_id, '_3d_displayid', $custom_text_input); + $custom_npc_text_input = isset($_POST['_3d_npc_displayid']) ? sanitize_text_field($_POST['_3d_npc_displayid']) : ''; + update_post_meta($post_id, '_3d_npc_displayid', $custom_npc_text_input); + + $custom_item_text_input = isset($_POST['_3d_item_displayid']) ? sanitize_text_field($_POST['_3d_item_displayid']) : ''; + update_post_meta($post_id, '_3d_item_displayid', $custom_item_text_input); $custom_select = isset($_POST['_3d_race']) ? sanitize_text_field($_POST['_3d_race']) : ''; update_post_meta($post_id, '_3d_race', $custom_select);