register_listPostType(); $this->register_filter(); add_action( 'add_meta_boxes', array(&$this, 'list_boxes' )); add_action( 'save_post', array(&$this, 'list_detail_save' )); ATKPTools::add_column(ATKP_LIST_POSTTYPE, __('Status', ATKP_PLUGIN_PREFIX), function($post_id){ $selectedshopid = ATKPTools::get_post_setting($post_id, ATKP_LIST_POSTTYPE.'_shopid', 0); try { if($selectedshopid != '' && atkp_shop::exists($selectedshopid)) $shps = atkp_shop::load($selectedshopid, false); } catch(Exception $ex) { echo 'parent shop not found. '; $shps = null; } echo '' . __( 'ID', ATKP_PLUGIN_PREFIX ) . ': ' . $post_id . ', '; if(!isset($shps) || $shps == null) echo ''.__('Manual list', ATKP_PLUGIN_PREFIX).''; else echo ''. __('Shop', ATKP_PLUGIN_PREFIX).': '.$shps->title.''; $updatedon = ATKPTools::get_post_setting($post_id, ATKP_LIST_POSTTYPE.'_updatedon', true ); if(isset($updatedon) && $updatedon != '') { $infotext = __('%refresh_date% at %refresh_time%', ATKP_PLUGIN_PREFIX); $infotext = str_replace('%refresh_date%', ATKPTools::get_formatted_date($updatedon), $infotext); $infotext = str_replace('%refresh_time%', ATKPTools::get_formatted_time($updatedon), $infotext); echo '
'. __('Updated on', ATKP_PLUGIN_PREFIX).': '.$infotext.''; } $selectedsourceval = ATKPTools::get_post_setting($post_id, ATKP_LIST_POSTTYPE.'_source', 10); $durations = array( 10 => __('Category - Best Seller', ATKP_PLUGIN_PREFIX), 11 => __('Category - New Releases', ATKP_PLUGIN_PREFIX), 20 => __('Search', ATKP_PLUGIN_PREFIX), 30 => __('Extended Search', ATKP_PLUGIN_PREFIX), //24 => __('Search - Order items by keywords. Rank is determined by the keywords in the product description.', ATKP_PLUGIN_PREFIX), //25 => __('Search - Order items by customer reviews, from highest to lowest ranked..', ATKP_PLUGIN_PREFIX), 40 => __('Similarity - Find similar products', ATKP_PLUGIN_PREFIX), ); foreach ($durations as $value => $name) if ($value == $selectedsourceval) { echo '
'. __('Type', ATKP_PLUGIN_PREFIX).': '.$name.''; break; } $message = ATKPTools::get_post_setting($post_id, ATKP_LIST_POSTTYPE.'_message', true ); if(isset($message) && $message != '') { echo '
'. __('Message', ATKP_PLUGIN_PREFIX).': '.esc_html($message).''; } }, 2); } function register_filter(){ add_filter( 'parse_query', array(&$this, 'admin_posts_filter' )); add_action( 'restrict_manage_posts', array(&$this, 'admin_posts_filter_restrict_manage_posts' )); } function admin_posts_filter( $query ) { $filterfield = ATKPTools::get_get_parameter(ATKP_PLUGIN_PREFIX.'_filterfield', 'string'); $posttype = ATKPTools::get_get_parameter( 'post_type', 'string' ); if($posttype == ATKP_LIST_POSTTYPE && !atkp_posttypes_list::$overridefilter) { global $pagenow; if ( is_admin() && $pagenow == 'edit.php' && isset( $filterfield ) && $filterfield != '' ) { if ( $filterfield == 'filter_error' ) { $query->query_vars['meta_key'] = ATKP_LIST_POSTTYPE . '_message'; $query->query_vars['meta_value'] = ''; $query->query_vars['meta_compare'] = 'EXISTS'; } else { $parts = explode( '_', $filterfield ); $query->set('meta_query', array( array( 'key' => ATKP_LIST_POSTTYPE . '_shopid', 'value' => isset( $parts[1] ) ? $parts[1] : '', 'compare' => isset( $parts[1] ) && $parts[1] != '' ? '=' : 'NOT EXISTS' ) )); } } } } private static $overridefilter; function admin_posts_filter_restrict_manage_posts() { $posttype = ATKPTools::get_get_parameter('post_type', 'string'); if($posttype != ATKP_LIST_POSTTYPE) return; atkp_posttypes_list::$overridefilter = true; $shops = atkp_shop::get_list( '', true); atkp_posttypes_list::$overridefilter = false; ?> __( 'Lists', ATKP_PLUGIN_PREFIX ), 'singular_name' => __( 'List', ATKP_PLUGIN_PREFIX ), 'add_new_item' => __( 'Add New List', ATKP_PLUGIN_PREFIX ), 'edit_item' => __( 'Edit List' , ATKP_PLUGIN_PREFIX), 'new_item' => __( 'New List' , ATKP_PLUGIN_PREFIX), 'all_items' => __( 'Lists' , ATKP_PLUGIN_PREFIX), 'view_item' => __( 'View List' , ATKP_PLUGIN_PREFIX), 'search_items' => __( 'Search Lists' , ATKP_PLUGIN_PREFIX), 'not_found' => __( 'No lists found' , ATKP_PLUGIN_PREFIX), 'not_found_in_trash' => __( 'No lists found in the Trash' , ATKP_PLUGIN_PREFIX), 'parent_item_colon' => '', 'menu_name' => __( 'AT Lists' , ATKP_PLUGIN_PREFIX), ); $args = array( 'labels' => $labels, 'description' => 'Holds our lists', 'public' => false, // it's not public, it shouldn't have it's own permalink, and so on 'publicly_queriable' => true, // you should be able to query it 'show_ui' => true, // you should be able to edit it in wp-admin 'exclude_from_search' => true, // you should exclude it from search results 'show_in_nav_menus' => true, // you shouldn't be able to add it to menus 'has_archive' => false, // it shouldn't have archive page 'rewrite' => false, // it shouldn't have rewrite rules 'supports' => array( 'title' ), 'capability_type' => 'post', 'menu_position' => 20, 'menu_icon' => plugin_dir_url( ATKP_PLUGIN_FILE ).'/images/affiliate_toolkit_menu.png', ); $args = apply_filters( 'atkp_list_register_post_type', $args ); register_post_type(ATKP_LIST_POSTTYPE, $args ); } function list_boxes() { add_meta_box( ATKP_LIST_POSTTYPE.'_shop_box', __( 'Shop Information', ATKP_PLUGIN_PREFIX), array(&$this, 'list_shop_box_content'), ATKP_LIST_POSTTYPE, 'normal', 'default' ); add_meta_box( ATKP_LIST_POSTTYPE.'_detail_box', __( 'List Information', ATKP_PLUGIN_PREFIX), array(&$this, 'list_detail_box_content'), ATKP_LIST_POSTTYPE, 'normal', 'default' ); add_meta_box( ATKP_LIST_POSTTYPE.'_preview_box', __( 'List Preview', ATKP_PLUGIN_PREFIX), array(&$this, 'list_preview_box_content'), ATKP_LIST_POSTTYPE, 'normal', 'default' ); } function list_shop_box_content( $post ) { wp_nonce_field( plugin_basename( __FILE__ ), 'list_shop_box_content_nonce' ); ?> ID, ATKP_LIST_POSTTYPE.'_updatedon', true ); $message = ATKPTools::get_post_setting($post->ID, ATKP_LIST_POSTTYPE.'_message', true ); ?>

'.esc_html($message).''; ?>
ID, ATKP_LIST_POSTTYPE.'_source', 10); ?>
ID, ATKP_LIST_POSTTYPE.'_source') == '' ? true : ATKPTools::get_post_setting($post->ID, ATKP_LIST_POSTTYPE.'_preferlocalproduct'), true); ?>>
ID, ATKP_LIST_POSTTYPE.'_autoimportproducts'), true); ?>>
ID, ATKP_LIST_POSTTYPE.'_loadmoreoffers')); ?>>

ID, ATKP_LIST_POSTTYPE.'_search_titelfilter', true ); ?>
ID, ATKP_LIST_POSTTYPE.'_products', true ); ?>
|
|
ID, ATKP_LIST_POSTTYPE.'_productlist'); // echo("$productlist: ".serialize($productlist)); $preferlocalproductinfo = ATKPTools::get_post_setting( $post->ID, ATKP_LIST_POSTTYPE.'_preferlocalproduct'); if($productlist != null) { $posts_found = get_posts(array( 'posts_per_page' => -1, 'post_status' => 'publish', 'post_type' => ATKP_PRODUCT_POSTTYPE )); ?> ID, ATKP_PRODUCT_POSTTYPE.'_asin') == $value->asin) $value = atkp_product::load($mypost->ID); break; } break; case 'productid': $value = atkp_product::load($value); break; } $prdid = $value->productid; if($prdid=='') $prdid='-'; ?>get_offers_by_listid($post->ID,$value->asin ); break; case 'productid': $offers = $atkp_offertable_helper->get_offers_by_productid($product['value'] ); break; } if ( is_array( $offers ) ) { foreach ( $offers as $offer ) { ?> getMessage(), "\n"; } } ?>

Shipping
Availability', ATKP_PLUGIN_PREFIX ) ?>
producturl !='') echo( $counter.'. '.substr($value->title,0, 180).' ('.$value->asin.', '.$prdid.')
'); else echo( $counter.'. '. substr($value->title,0, 180).' ('.$value->asin.', '.$prdid.')
'); ?>
shopid == $shop->id || $offer->oldid == $shop->id ) { echo esc_attr( $shop->title ); break; } } ?>: link != '') { echo ''.esc_attr($offer->number). ''; } else { echo $offer->number; } ?> price; ?> price != '' ) { ?> (pricefloat; ?>) updatedon == null ? __( 'marked for price update', ATKP_PLUGIN_PREFIX ) : 'last update: ' . $offer->updatedon ) ; echo ($offer->message != '' ? ' / ' : ''); echo ( $offer->message != '' && strlen( $offer->message ) > 183 ? substr( $offer->message, 0, 180 ) . '...' : $offer->message ); ?>
post_type; //ATKPTools::get_post_parameter('post_type', 'string'); if (ATKP_LIST_POSTTYPE != $posttype ) { return; } $shopid = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_shopid', 'string'); $source = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_source', 'string'); $nodeid = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_node_id', 'string'); $searchdepartment = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_search_department', 'string'); $searchkeyword = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_search_keyword', 'string'); $searchorderby = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_search_orderby', 'string'); $autoimportproducts= ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_autoimportproducts', 'bool'); $preferlocalproduct= ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_preferlocalproduct', 'bool'); $loadmoreoffers= ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_loadmoreoffers', 'bool'); $productid = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_productid', 'string'); $listurl = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_listurl', 'url'); $extsearchlimit = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_extendedsearch_limit', 'int'); $searchlimit = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_search_limit', 'int'); $searchtitelfilter = implode( "\n", array_map( 'sanitize_text_field', explode( "\n", ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_search_titelfilter', 'multistring') ) ) ); $filterfield1 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield1', 'string'); $filtertext1 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext1', 'string'); $filterfield2 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield2', 'string'); $filtertext2 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext2', 'string'); $filterfield3 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield3', 'string'); $filtertext3 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext3', 'string'); $filterfield4 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield4', 'string'); $filtertext4 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext4', 'string'); $filterfield5 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield5', 'string'); $filtertext5 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext5', 'string'); $filterfield6 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield6', 'string'); $filtertext6 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext6', 'string'); $filterfield7 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield7', 'string'); $filtertext7 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext7', 'string'); $filterfield8 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield8', 'string'); $filtertext8 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext8', 'string'); $filterfield9 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield9', 'string'); $filtertext9 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext9', 'string'); $filterfield10 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filterfield10', 'string'); $filtertext10 = ATKPTools::get_post_parameter(ATKP_LIST_POSTTYPE.'_filtertext10', 'string'); $products = ''; $productpara = isset($_POST[ATKP_LIST_POSTTYPE.'_products']) ? $_POST[ATKP_LIST_POSTTYPE.'_products'] : null; if(isset($productpara) && $productpara != null) foreach($productpara as $selectedproduct) { if($products =='') $products = $selectedproduct; else $products .= "\n".$selectedproduct; } ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_shopid', $shopid); if($shopid == '') { ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_listurl', $listurl); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_products', $products); } else { ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_source', $source); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_autoimportproducts', $autoimportproducts); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_preferlocalproduct', $preferlocalproduct); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_loadmoreoffers', $loadmoreoffers); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_search_department', $searchdepartment); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_search_keyword', $searchkeyword); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_search_orderby', $searchorderby); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_node_id', $nodeid); //ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_keyword', $keyword); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_productid', $productid); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_extendedsearch_limit', $extsearchlimit); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_search_limit', $searchlimit); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_search_titelfilter', $searchtitelfilter); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield1', $filterfield1); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext1', $filtertext1); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield2', $filterfield2); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext2', $filtertext2); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield3', $filterfield3); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext3', $filtertext3); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield4', $filterfield4); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext4', $filtertext4); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield5', $filterfield5); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext5', $filtertext5); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield6', $filterfield6); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext6', $filtertext6); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield7', $filterfield7); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext7', $filtertext7); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield8', $filterfield8); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext8', $filtertext8); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield9', $filterfield9); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext9', $filtertext9); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filterfield10', $filterfield10); ATKPTools::set_post_setting( $post_id, ATKP_LIST_POSTTYPE.'_filtertext10', $filtertext10); } //wenn die Extension nicht geladen ist, kann das Plugin nicht arbeiten //Wenn keine Einstellungen definiert wurden um Daten zu laden, keine Liste generieren $listservice = new atkp_listservice( array() ); $shop = $shopid != '' ? atkp_shop::load( $shopid, true ) : null; $listservice->update_lists($shop, array($post_id)); } } ?>