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; } ?>
[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 '[atkp_product id=\'' . $ean . '\' template=\'' . $template . '\'][/atkp_product]
' ); } else { echo do_shortcode( '[atkp_product ean=\'' . $ean . '\' template=\'' . $template . '\'][/atkp_product]
' ); } } } ?>