AFFILILABS_CPT_PRODUCT, 'posts_per_page' => -1, ); $products_query = new WP_Query($products_args); $products = $products_query->posts; $categories = get_terms(array( 'taxonomy' => AFFILILABS_TAXONOMY_PRODUCT_CATEGORY, 'hide_empty' => false, )); $marketplaces_args = array( 'post_type' => AFFILILABS_CPT_MARKETPLACE, 'posts_per_page' => -1, ); $marketplaces_query = new WP_Query($marketplaces_args); $marketplaces = $marketplaces_query->posts; // @TODO: Keep this for the filter dropdown below, maybe refactor later $all_marketplaces = AFFLMarketplaceService::get_all_marketplaces(['orderby' => 'name', 'order' => 'ASC']); $digistore_marketplace_id = null; $finder_marketplaces = []; $digistore_affiliate_id = null; $digistore_marketplace_id = get_option(AFFILILABS_DIGISTORE_MARKETPLACE_ID, null); $finder_marketplaces = array_filter($all_marketplaces, function($marketplace) use ($digistore_marketplace_id) { return !empty($digistore_marketplace_id) && $marketplace['id'] == $digistore_marketplace_id; }); if ($digistore_marketplace_id > 1) { $digistore_affiliate_id = get_post_meta($digistore_marketplace_id, AFFILILABS_META_KEY_MARKETPLACE_AFFILIATE_ID, true); } $navbar = new AffiliLabs_Navbar(); $navbar->load_scripts(); $button = new AffiliLabs_Button(); $modal = new AffiliLabs_Modal(); $modal->load_scripts(); $modal->init(); $spinner = new AffiliLabs_Spinner(); $spinner->load_scripts(); $spinner->init(); $video_frame = new AffiliLabs_VideoFrame(); $video_frame->load_scripts(); $video_frame->init(); wp_enqueue_media(); wp_enqueue_style('affililabs-products-edit', AFFILILABS_PRODUCTS_EDIT_CSS_URL, array(), AFFILILABS_VERSION); wp_enqueue_style('affililabs-products', AFFILILABS_PRODUCTS_CSS_URL, array(), AFFILILABS_VERSION); wp_enqueue_script('affililabs-products', AFFILILABS_PRODUCTS_JS_URL, array('jquery'), AFFILILABS_VERSION, true); wp_localize_script('affililabs-products', 'affililabs_products', array( 'find_products_nonce' => wp_create_nonce('affl_admin_nonce'), 'find_products_action' => 'affl_find_products', 'save_imported_product_action' => 'affililabs_save_product', 'digistore_marketplace_id' => $digistore_marketplace_id, 'digistore_affiliate_id' => $digistore_affiliate_id, 'i18n' => array( 'delete' => esc_html__('Delete', 'affililabs'), 'delete_confirm' => esc_html__('Are you sure you want to delete this product?', 'affililabs'), 'delete_success' => esc_html__('Product deleted successfully.', 'affililabs'), 'delete_error' => esc_html__('Error deleting product.', 'affililabs'), 'delete_error_unknown' => esc_html__('An error occurred while trying to delete the product.', 'affililabs'), 'import_success_title' => esc_html__('Success', 'affililabs'), 'import_success_message' => esc_html__('Product imported successfully.', 'affililabs'), 'error' => esc_html__('Error', 'affililabs'), 'no_products_found' => esc_html__('No products found matching your criteria.', 'affililabs'), 'finding_products' => esc_html__('Finding products...', 'affililabs'), 'find_products_error' => esc_html__('Error finding products. Please try again.', 'affililabs'), 'no_results_found' => esc_html__('No products found for this keyword.', 'affililabs'), 'add_to_my_products' => esc_html__('Add to My Products', 'affililabs'), 'enter_keyword' => esc_html__('Please enter a keyword.', 'affililabs'), 'import_success_title' => esc_html__('Success', 'affililabs'), 'import_success_message' => esc_html__('Product imported successfully!', 'affililabs'), 'copied' => esc_html__('Copied!', 'affililabs'), 'failed_to_copy' => esc_html__('Failed to copy', 'affililabs'), 'button_edit_text' => esc_html__('Edit', 'affililabs'), 'button_view_text' => esc_html__('View', 'affililabs'), ), 'assets' => array( 'trash_icon_url' => esc_url(AFFILILABS_ASSETS_TRASH_SVG), 'star_full_url' => esc_url(AFFILILABS_ASSETS_STAR_FULL_SVG), 'star_half_url' => esc_url(AFFILILABS_ASSETS_STAR_HALF_SVG), 'star_empty_url' => esc_url(AFFILILABS_ASSETS_STAR_EMPTY_SVG), 'default_image_url' => esc_url(AFFILILABS_DEFAULT_PRODUCT_IMAGE), 'copy_icon_url' => esc_url(AFFILILABS_ASSETS_COPY_SVG), ), )); ?>
render(); ?>

render(__('Add New Product', 'affililabs') . ' +', esc_url(wp_nonce_url(admin_url('admin.php?page=affililabs-product-edit'), 'affl_admin_nonce', 'nonce'))); ?>

render(__('Add New Product', 'affililabs') . ' +', esc_url(wp_nonce_url(admin_url('admin.php?page=affililabs-product-edit'), 'affl_admin_nonce', 'nonce'))); ?>
render(''); ?>

ID, AFFILILABS_META_KEY_RATING, true); $product_price = get_post_meta($post->ID, AFFILILABS_META_KEY_PRICE, true); $marketplace_id = get_post_meta($post->ID, AFFILILABS_META_KEY_MARKETPLACE, true); $category_terms = wp_get_post_terms($post->ID, AFFILILABS_TAXONOMY_PRODUCT_CATEGORY); $category_ids = array(); if (!is_wp_error($category_terms) && !empty($category_terms)) { foreach ($category_terms as $term) { $category_ids[] = (string)$term->term_id; } } $category_ids_string = implode(',', $category_ids); ?>
ID: ID)); ?>
<?php affl_print(esc_attr($post->post_title)); ?>
post_title)); ?> post_title)); ?>

ID, AFFILILABS_META_KEY_PRICE_CURRENCY, true); if ($currency) { affl_print(esc_html($currency)); } else { affl_print(esc_html('$')); } affl_print(esc_html($product_price)); ?>

name)); ?>

×

×
Product Image Preview