product_type = 'nft_auction'; parent::__construct( $product ); } } } add_action( 'plugins_loaded', 'register_nft_auction_product_type' ); add_action( 'wp_enqueue_scripts', 'nf_auction_enqueue_scripts' ); add_action( 'admin_enqueue_scripts', 'nf_auction_enqueue_backend_scripts' ); function nf_auction_enqueue_backend_scripts(){ wp_enqueue_style( 'flatpickr_date_picker_css', ABSZAN_ASSETS_URL . '/js/flatpickr.min.css' ); wp_enqueue_script( 'abszan_web3_min', ABSZAN_ASSETS_URL . '/js/web3.min.js', array(), false, false ); wp_enqueue_script( 'abszan_web3modal_min', ABSZAN_ASSETS_URL . '/js/web3modal.js', array(), false, false ); wp_enqueue_script( 'abszan_evm_min', ABSZAN_ASSETS_URL . '/js/evmchain.js', array(), false, false ); wp_enqueue_script( 'abszan_walletconnect_min', ABSZAN_ASSETS_URL . '/js/walletconnect.js', array(), false, false ); wp_enqueue_script( 'abszan_abis', ABSZAN_ASSETS_URL . '/js/abis.js', array(), false, false ); wp_enqueue_script( 'abszan_data', ABSZAN_ASSETS_URL . '/js/data.js', array(), false, false ); wp_enqueue_script( 'abszan_networks', ABSZAN_ASSETS_URL . '/js/networks.js', array(), false, false ); wp_enqueue_script( 'abszan_block_script', ABSZAN_ASSETS_URL . '/js/Block.js', array(), false, false ); wp_localize_script( 'abszan_block_script', 'nftData', array( 'network_options' => get_option( 'nft_network_options' ) ) ); wp_enqueue_script( 'flatpickr_date_picker_js', ABSZAN_ASSETS_URL . '/js/flatpickr.js', array(), false, false ); wp_enqueue_script( 'jquery_duration_picker_js', ABSZAN_ASSETS_URL . '/js/jquery.durationpicker.min.js', array(), false, false ); } function nf_auction_enqueue_scripts(){ wp_enqueue_script( 'abszan_web3_min', ABSZAN_ASSETS_URL . '/js/web3.min.js', array(), false, false ); wp_enqueue_script( 'abszan_web3modal_min', ABSZAN_ASSETS_URL . '/js/web3modal.js', array(), false, false ); wp_enqueue_script( 'abszan_evm_min', ABSZAN_ASSETS_URL . '/js/evmchain.js', array(), false, false ); wp_enqueue_script( 'abszan_walletconnect_min', ABSZAN_ASSETS_URL . '/js/walletconnect.js', array(), false, false ); wp_enqueue_script( 'abszan_abis', ABSZAN_ASSETS_URL . '/js/abis.js', array(), false, false ); wp_enqueue_script( 'abszan_data', ABSZAN_ASSETS_URL . '/js/data.js', array(), false, false ); wp_enqueue_script( 'abszan_networks', ABSZAN_ASSETS_URL . '/js/networks.js', array(), false, false ); wp_enqueue_script( 'abszan_block_script', ABSZAN_ASSETS_URL . '/js/Block.js', array(), false, false ); if( is_product() || is_shop() ){ global $post; $nft_network_options = get_option( 'nft_network_options' ); $selectedNetworkKey = null; foreach( $nft_network_options as $key => $network ){ if( $network['chain_id'] == get_post_meta( $post->ID ,'_token_network', true ) ){ $selectedNetworkKey = $key; break; } } wp_enqueue_script( 'fro_nft_product', ABSZAN_ASSETS_URL . '/js/nft-product.js', array(), false, true ); wp_localize_script( 'fro_nft_product', 'nftData', array( 'token' => get_post_meta( $post->ID, '_token_id', true ), 'tokenContract' => get_post_meta( $post->ID, '_token_contract', true ), 'auction' => get_post_meta( $post->ID, '_auction_id', true ), 'block' => get_post_meta( $post->ID, '_block_number', true ), 'auctionTxn' => get_post_meta( $post->ID, '_auction_txn', true ), 'network_option' => $nft_network_options[$selectedNetworkKey] ) ); wp_enqueue_script( 'abszan_web3modal_script', ABSZAN_ASSETS_URL . '/js/web3modal.js', array(), false, false ); wp_enqueue_script( 'abszan_evmchain_script', ABSZAN_ASSETS_URL . '/js/evmchain.js', array(), false, false ); wp_enqueue_script( 'abszan_walletconnect_script', ABSZAN_ASSETS_URL . '/js/walletconnect.js', array(), false, false ); } } /** * Add to product type drop down. */ function add_nft_auction_product( $types ){ // Key should be exactly the same as in the class $types[ 'nft_auction' ] = __( 'NFT Auction' ); return $types; } add_filter( 'product_type_selector', 'add_nft_auction_product' ); /** * Show pricing fields for nft_auction product. */ function nft_auction_custom_js() { if ( 'product' != get_post_type() ) : return; endif; ?> __( 'NFT Auction', 'woocommerce' ), 'target' => 'nft_auction_options', 'class' => array( 'show_if_nft_auction' ), ); return $tabs; } add_filter( 'woocommerce_product_data_tabs', 'custom_product_tabs' ); /** * Contents of the nft options product tab. */ function nft_auction_options_product_tab_content() { global $post; ?>
get_type() ){ ?>