check(); update_option( ATKP_PLUGIN_PREFIX . '_woo_message', $message ); $importresults = array(); if ( $isactive == 'woo-at' ) { array_push( $importresults, '*** import started: ' . date( "Y-m-d H:i:s" ) ); if ( $message != '' ) { array_push( $importresults, '*** import error: ' . $message ); } else { $message = $export->checklogon(); //importiere alle woo produkte ins at $args = array( 'post_type' => array( 'product' ), 'posts_per_page' => - 1 ); $the_query = new WP_Query( $args ); while ( $the_query->have_posts() ) { try { $the_query->the_post(); $prdid = $export->import_product( $the_query->post->ID ); array_push( $importresults, '*** product ' . $the_query->post->ID . ' imported: ' . $the_query->post->ID ); } catch ( Exception $e ) { array_push( $importresults, '*** product ' . $the_query->post->ID . ' exception: ' . $e->getMessage() ); } } wp_reset_postdata(); } array_push( $importresults, '*** import finished: ' . date( "Y-m-d H:i:s" ) ); update_option( ATKP_PLUGIN_PREFIX . '_woo_importresult', implode( "\n", $importresults ) ); } if ( $update_keys ) { //lade alle woocommerce produkte //lade das ean oder das product id feld //suche das produkt im AT //wenn gefunden, dann setze die gegenüber ID in das keyfeld $args = array( 'post_type' => array( 'product' ), 'posts_per_page' => - 1 ); $the_query = new WP_Query( $args ); while ( $the_query->have_posts() ) { try { $the_query->the_post(); $message = $export->update_key_product( $the_query->post->ID ); array_push( $importresults, '*** product-key ' . $the_query->post->ID . ' updated: ' . $the_query->post->ID . ' ' . $message ); } catch ( Exception $e ) { array_push( $importresults, '*** product-key ' . $the_query->post->ID . ' exception: ' . $e->getMessage() ); } } wp_reset_postdata(); update_option( ATKP_PLUGIN_PREFIX . '_woo_importresult', implode( "\n", $importresults ) ); } } } $mytab = ATKPTools::get_get_parameter( 'tab', 'int' ); //$apikey = get_option(ATKP_PLUGIN_PREFIX.'_woo_access_key'); //$apisecretkey = get_option(ATKP_PLUGIN_PREFIX.'_woo_access_secret_key'); $error = get_option( ATKP_PLUGIN_PREFIX . '_woo_message' ); //if($apikey == '') { // $error = __('Access data not defined.', ATKP_PLUGIN_PREFIX); //} if ( ! class_exists( 'WooCommerce' ) ) { $access_test = '' . __( 'Not connected', ATKP_PLUGIN_PREFIX ) . ' (' . __( 'WooCommmerce Plugin is not installed', ATKP_PLUGIN_PREFIX ) . ')'; } else { if ( ( $error == null || empty( $error ) ) ) { $access_test = '' . __( 'Connected', ATKP_PLUGIN_PREFIX ) . ''; } else { $access_test = '' . __( 'Not connected', ATKP_PLUGIN_PREFIX ) . ' (' . $error . ')'; } } if ( $mytab != 0 ) { $tab = $mytab; } else { $tab = 1; } ?>
>
>
type="checkbox" id="" name="" value="1" >

> > >

Features

[atkp_product field=\'features_text\'][/atkp_product]

[atkp_product field=\'shoplogo\'][/atkp_product] ', ATKP_PLUGIN_PREFIX ) ) ), ATKP_PLUGIN_PREFIX . '_woo_product_template', array( 'media_buttons' => false, 'textarea_name' => ATKP_PLUGIN_PREFIX . '_woo_product_template', 'textarea_rows' => 15, ) ); ?>
> > >
false, 'textarea_name' => ATKP_PLUGIN_PREFIX . '_woo_product_shorttemplate', 'textarea_rows' => 10, ) ); ?>
>
 
checklogon(); if ( $message != '' ) { if ( ATKPLog::$logenabled ) { ATKPLog::LogError( 'import_product woo message: ' . $message ); } } else { $export->import_product( $post_id ); } ATKPTools::set_post_setting( $post_id, ATKP_PRODUCT_POSTTYPE . '_message', null ); } catch ( Exception $e ) { if ( ATKPLog::$logenabled ) { ATKPLog::LogError( 'import_product woo error: ' . $e->getMessage() ); } } } if ( class_exists( 'WooCommerce' ) && get_option( ATKP_PLUGIN_PREFIX . '_woo_mode', '' ) != '' ) { ATKPTools::add_column( 'product', __( 'affiliate-toolkit', ATKP_PLUGIN_PREFIX ), function ( $woo_id ) { affiliate_toolkit_display_woo_link($woo_id); }, 3 ); /* * Add the extra options to the 'Publish' box */ add_action('post_submitbox_misc_actions', 'my_affiliate_toolkit_add_publish_meta_options'); if ( get_option( ATKP_PLUGIN_PREFIX . '_woo_activatetab', 0 ) ) { add_filter( 'woocommerce_product_tabs', 'my_affiliate_toolkit_woo_product_tab' ); } if ( get_option( ATKP_PLUGIN_PREFIX . '_woo_showdisclaimer', 0 ) ) { add_action( 'woocommerce_after_single_product', 'my_affiliate_toolkit_woo_product_content' ); } } function affiliate_toolkit_display_woo_link($woo_id) { $eanfield = get_option( ATKP_PLUGIN_PREFIX . '_woo_ean_field', '' ); $keytype = get_option( ATKP_PLUGIN_PREFIX . '_woo_keytype', 'ean' ); if ( $eanfield == '' || $eanfield == 'sku' ) { $ean = ATKPTools::get_post_setting( $woo_id, '_sku' ); } else { $ean = ATKPTools::get_post_setting( $woo_id, $eanfield ); } if ( $keytype == 'id' ) { $exists = atkp_product::exists( $ean ); if ( $exists ) { $product = $ean; } } else { $product = atkp_product::idbyean( $ean ); } if ( isset( $product ) && $product != '' && $product != 0 ) { $title = __( 'Show AT product', ATKP_PLUGIN_PREFIX ); echo sprintf( __( '%s ', ATKP_PLUGIN_PREFIX ), get_edit_post_link( $product ), $title ); } else { echo '-'; } } function my_affiliate_toolkit_add_publish_meta_options($post_obj) { global $post; if($post != null && 'product'==$post->post_type) { echo '
'; affiliate_toolkit_display_woo_link($post_obj->ID); echo '
'; } } function my_affiliate_toolkit_woo_product_content() { $content = ''; if ( is_single() && get_post_type() == 'product' ) { $content .= '

[atkp_product field=\'disclaimer\'][/atkp_product]

'; } echo do_shortcode( $content ); } function my_affiliate_toolkit_woo_product_tab( $tabs ) { // Adds the new tab $tabs['offers'] = array( 'title' => __( 'Price Comparison', ATKP_PLUGIN_PREFIX ), 'priority' => 15, 'callback' => 'my_affiliate_toolkit_woo_product_tabcontent' ); return $tabs; } function my_affiliate_toolkit_woo_product_tabcontent() { global $post; $product_id = $post->ID; $template = get_option( ATKP_PLUGIN_PREFIX . '_woo_tab_template', 'detailoffers' ); if ( $template == '' ) { $template = 'detailoffers'; } $product = new WC_Product( $product_id ); $eanfield = get_option( ATKP_PLUGIN_PREFIX . '_woo_ean_field', '' ); $keytype = get_option( ATKP_PLUGIN_PREFIX . '_woo_keytype', 'ean' ); $ean = ''; if ( $eanfield == '' || $eanfield == 'sku' ) { $ean = $product->get_sku(); } else { $ean = ATKPTools::get_post_setting( $product_id, $eanfield ); } //echo '

'.__( 'Price Compare', ATKP_PLUGIN_PREFIX ).'

'; if ( $ean == '' ) { echo __( 'Price comparison is not available.', ATKP_PLUGIN_PREFIX ); } else { if ( $keytype == 'id' ) { echo do_shortcode( '

[atkp_product id=\'' . $ean . '\' template=\'' . $template . '\'][/atkp_product]

' ); } else { echo do_shortcode( '

[atkp_product ean=\'' . $ean . '\' template=\'' . $template . '\'][/atkp_product]

' ); } } } ?>