'product', 'fields' => 'ids', 'post_status' => 'publish', 'posts_per_page' => '-1' ); //Woocommerce verzio $version =waruk_get_woo_number(); $products = new WP_Query($args); //while ( $products->have_posts() ) : $products->the_post(); //global $post; foreach ($products->posts as $postitem) { //$theid =$theid; $theid =$postitem; if ($version <3.0) { $product = get_product( $theid); } else { $product = wc_get_product($theid); } if( ($product->is_type( 'simple' ) || $product->is_type( 'variable' )) && (get_post_meta($theid,'arukereso_hide',true) != 'yes') ) { if($product->is_type( 'simple' )) { $thetitle = get_the_title($theid); $excerpt =""; if (has_excerpt($theid)) { $excerpt =str_replace( '"', '""', get_the_excerpt($theid) ); } $manufacturer =get_post_meta( $theid, 'manufacturer', true ); $ean_code =get_post_meta( $theid, 'ean_code', true ); $shipping_cost =get_post_meta( $theid, 'shipping_cost', true ); $shipping_time =get_post_meta( $theid, 'shipping_time', true ); $category =get_post_meta( $theid, 'woo_prod_category', true ); if ($version <3.0) { $sku =$product->sku; //Cikkszám if ($product->get_sale_price() >0) { $price =$product->get_sale_price(); //Ha létezik akciós ár } else { //$price =$product->get_regular_price(); $price =$product->get_price_including_tax();//Ha van áfa, az is kell } $net_price =round($product->get_price_excluding_tax()); } else { $sku =$product->get_sku(); //Cikkszám $price =wc_get_price_including_tax($product);//Ha van áfa, az is kell $net_price =round(wc_get_price_excluding_tax($product)); } $url =get_permalink( $theid); if (empty($category)) { $category =""; $terms =get_the_terms($theid, 'product_cat'); if (!empty($terms) &&is_array($terms) &&count($terms) >0) { foreach ($terms as $term) { $category.=", ".$term->name; } } $category =trim($category, ", "); } $_temp = wp_get_attachment_image_src( get_post_thumbnail_id( $theid), 'full' ); //Fotólink if ( $_temp ) { $picture_link =wp_get_attachment_url( get_post_thumbnail_id($theid) ); } else { $picture_link =""; } $full_product_list[] = array("title"=>$thetitle, "sku"=>$sku, "id"=>$theid, "category" =>$category, "manufacturer" =>$manufacturer, "ean_code" =>$ean_code, "net_price" =>$net_price, "price"=>$price, "url" =>$url, "kep" =>$picture_link, "excerpt" =>$excerpt, "shipping_cost" =>$shipping_cost, "shipping_time" =>$shipping_time); } if($product->is_type( 'variable' )) { foreach($product->get_available_variations() as $variation) { $variation_data = new WC_Product_Variation($variation['variation_id']); if (get_post_meta($variation['variation_id'],'arukereso_hide',true) != 'yes') { $sku =$variation["sku"]; //Cikkszám $thetitle = get_post_meta( $variation['variation_id'], 'waruk_prod_name', true ); if (empty($thetitle)) { $thetitle =get_the_title($theid); } $excerpt =""; if (has_excerpt($theid)) { $excerpt =str_replace( '"', '""', get_the_excerpt($theid) ); } //$shipping_cost =get_post_meta( $theid, 'shipping_cost', true ); $shipping_cost =get_post_meta( $variation['variation_id'], 'shipping_cost', true ); //$shipping_time =get_post_meta( $theid, 'shipping_time', true ); $shipping_time =get_post_meta($variation['variation_id'], 'shipping_time', true); //$manufacturer =get_post_meta( $theid, 'manufacturer', true ); $manufacturer =get_post_meta($variation['variation_id'], 'manufacturer', true); $ean_code =get_post_meta( $variation['variation_id'], 'ean_code', true ); //$category =get_post_meta( $theid, 'woo_prod_category', true ); $category =get_post_meta($variation['variation_id'], 'woo_prod_category', true); if ($version <3.0) { if ($product->get_sale_price() >0) { $price =$variation_data->get_sale_price(); //Ha létezik akciós ár } else { $price =$variation_data->get_regular_price(); } $net_price =$variation_data->get_price_excluding_tax(); } else { $price =wc_get_price_including_tax($variation_data);//Ha van áfa, az is kell $net_price =wc_get_price_excluding_tax($variation_data); } $url =get_permalink( $theid); if (empty($category )) { $category =""; $terms =get_the_terms($theid, 'product_cat'); if (!empty($terms) &&is_array($terms) &&count($terms) >0) { foreach ($terms as $term) { $category.=", ".$term->name; } } $category =trim($category, ", "); } $_temp = wp_get_attachment_image_src( get_post_thumbnail_id( $theid), 'full' ); //Fotólink if ( $_temp ) { $picture_link =wp_get_attachment_url( get_post_thumbnail_id($theid) ); } else { $picture_link =""; } $full_product_list[] = array("title"=>$thetitle, "sku"=>$sku, "id"=>$variation['variation_id'], "category" =>$category, "net_price" =>$net_price, "price"=>$price, "url" =>$url, "kep" =>$picture_link, "excerpt" =>$excerpt, "shipping_cost" =>$shipping_cost, "shipping_time" =>$shipping_time, "manufacturer" =>$manufacturer, "ean_code" =>$ean_code); } } } } //endwhile; } wp_reset_query(); return $full_product_list; } //Feed elkészítése function waruk_customRSS(){ if (!is_feed("arukereso")){//csak egyszer kell lefutnia add_feed('arukereso', 'waruk_arukeresoXML'); global $wp_rewrite; $wp_rewrite->flush_rules(); } if (!is_feed("argep")){//csak egyszer kell lefutnia add_feed('argep', 'waruk_argepXML'); global $wp_rewrite; $wp_rewrite->flush_rules(); } } function waruk_arukeresoXML() { header("Content-type: text/xml"); echo ""; echo ""; $products =waruk_get_all_product(); if (count($products) >0) { foreach ($products as $product) { echo ""; echo "".$product['id'].""; echo "".$product['title'].""; if (!empty($product['manufacturer'])) { echo "".$product['manufacturer'].""; } if (!empty($product['ean_code'])) { echo "".$product['ean_code'].""; } echo "".$product['category'].""; echo "".$product['price'].""; echo "".$product['net_price'].""; echo "".$product['url'].""; if (!empty($product['kep'])) { echo "".$product['kep'].""; } echo ""; $shipping_max_free =get_option('waruk_shipping_max_free'); if (!empty($shipping_max_free) &&$shipping_max_free <$product['price'] ) { $shipping_cost ="ingyenes"; } else { $shipping_cost =get_option('waruk_shipping_cost'); } $shipping_time =get_option('waruk_shipping_time'); if (!empty($product['shipping_cost'])) { echo "".$product['shipping_cost'].""; } elseif (!empty($shipping_cost)){ echo "".$shipping_cost.""; } if (!empty($product['shipping_time'])) { echo "".$product['shipping_time'].""; } elseif (!empty($shipping_time)){ echo "".get_option('waruk_shipping_time').""; } echo ""; } } else { echo "Hiba: Nincs elérhető termék!"; } echo ""; } function waruk_argepXML() { header("Content-type: text/xml"); echo ""; echo ""; $products =waruk_get_all_product(); if (count($products) >0) { foreach ($products as $product) { echo ""; echo "".$product['id'].""; echo "".$product['title'].""; echo "".$product['price'].""; echo "".$product['url'].""; if (!empty($product['kep'])) { echo "".$product['kep'].""; } echo ""; if (!empty($shipping_max_free) &&$shipping_max_free <$product['price'] ) { $shipping_cost ="ingyenes"; } else { $shipping_cost =get_option('waruk_shipping_cost'); } $shipping_time =get_option('waruk_shipping_time'); if (!empty($product['shipping_cost'])) { echo "".$product['shipping_cost'].""; } elseif (!empty($shipping_cost)){ echo "".$shipping_cost.""; } if (!empty($product['shipping_time'])) { echo "".$product['shipping_time'].""; } elseif (!empty($shipping_time)){ echo "".get_option('waruk_shipping_time').""; } echo ""; } } else { echo "Hiba: Nincs elérhető termék!"; } echo ""; } function waruk_add_menu_page () { add_options_page("Árukereső beállításai", "Árukereső", "manage_options", "arukereso", "waruk_settings"); } function waruk_settings () { ?>

Árukereső és Árgép beállításai

ahhoz, hogy megjelenjünk az Árukereső listájában, regisztrálni kell cégünket oldalukon. Bővebb információk a regisztráció menetéről

Árgéphez történő regisztrációhoz bővebb információk itt olvashatóak: Árgép vásárlói tájékoztató

Sikeres regisztráció után meg kell adnunk azt az url-t, ahol a termékeink elérhetőek. Ez az alábbi cím:

Árukereső:

Árgép:

'arukereso_hide', 'label' => 'A termék elrejtése az Árukereső xml-ből', 'description' => 'Ha be van pipálva, ez a termék nem lesz bent az árukereső xml-ben.' ) ); woocommerce_wp_text_input( array( 'id' => 'waruk_prod_name', 'label' =>'Megjelenő terméknév az Árukeresőben', 'placeholder' => 'Akkor töltsük ki, ha termékünk neve eltér az Árukeresőben megjelenő névtől.', 'desc_tip' => 'true', 'description' => 'Akkor használjuk, ha egyedi terméknevet szeretnénk megadni az Árukereső számára' ) ); woocommerce_wp_text_input( array( 'id' => 'manufacturer', 'label' =>'Termék gyártójának megnevezése', 'placeholder' => 'Termék gyártójának megnevezése', 'desc_tip' => 'true', 'description' => 'A termék gyártójának megnevezése (ha nem szerepel a termék névben)' ) ); woocommerce_wp_text_input( array( 'id' => 'ean_code', 'label' =>'Termék azonosító', 'placeholder' => 'gyártó által adott EAn kód', 'desc_tip' => 'true', 'description' => 'Min. 8 - max. 13 számjegyű gyártó által adott termékazonosító; egyedinek kell lennie. (European Article Number)' ) ); woocommerce_wp_text_input( array( 'id' => 'shipping_time', 'label' =>'Termék kiszállítási ideje', 'placeholder' => 'Termék kiszállításának ideje', 'desc_tip' => 'true', 'description' => 'A termékhez tartozókiszállítási idő napban' ) ); woocommerce_wp_text_input( array( 'id' => 'shipping_cost', 'label' =>'Termék szállítási költsége', 'placeholder' => 'Termék szállítási költsége', 'desc_tip' => 'true', 'description' => 'A termékhez tartozó szálítási költség' ) ); woocommerce_wp_text_input( array( 'id' => 'woo_prod_category', 'label' =>'Terméknek megfelelő Árukereső kategória', 'placeholder' => 'Terméknek megfelelő Árukereső kategória', 'desc_tip' => 'true', 'description' => 'Amennyiben eltér weboldalunk kategória megnevezése az Árukeresőjétől, itt írhatjuk felül' ) ); } function waruk_add_extra_variable_fields ($loop, $variation_data, $variation) { echo '
'; woocommerce_wp_checkbox( array( 'id' => 'arukereso_hide['. $loop .']', 'label' => 'A termék elrejtése az Árukereső xml-ből', 'description' => 'Ha be van pipálva, ez a termék nem lesz bent az árukereső xml-ben.', 'value' => get_post_meta($variation->ID, 'arukereso_hide', true) ) ); woocommerce_wp_text_input( array( 'id' => 'waruk_prod_name['. $loop .']', 'label' =>'Megjelenő terméknév az Árukeresőben', 'placeholder' => 'Akkor töltsük ki, ha termékünk neve eltér az Árukeresőben megjelenő névtől.', 'desc_tip' => 'true', 'description' => 'A termékhez tartozó szálítási költség', 'value' => get_post_meta($variation->ID, 'waruk_prod_name', true) ) ); woocommerce_wp_text_input( array( 'id' => 'manufacturer['. $loop .']', 'label' =>'Termék gyártójának megnevezése', 'placeholder' => 'Termék gyártójának megnevezése', 'desc_tip' => 'true', 'description' => 'A termék gyártójának megnevezése (ha nem szerepel a termék névben)', 'value' => get_post_meta($variation->ID, 'manufacturer', true) ) ); woocommerce_wp_text_input( array( 'id' => 'ean_code['. $loop .']', 'label' =>'Termék azonosító', 'placeholder' => 'gyártó által adott EAn kód', 'desc_tip' => 'true', 'description' => 'Min. 8 - max. 13 számjegyű gyártó által adott termékazonosító; egyedinek kell lennie. (European Article Number)', 'value' => get_post_meta($variation->ID, 'ean_code', true) ) ); woocommerce_wp_text_input( array( 'id' => 'shipping_time['. $loop .']', 'label' =>'Termék kiszállítási ideje', 'placeholder' => 'Termék kiszállításának ideje', 'desc_tip' => 'true', 'description' => 'A termékhez tartozókiszállítási idő napban', 'value' => get_post_meta($variation->ID, 'shipping_time', true) ) ); woocommerce_wp_text_input( array( 'id' => 'shipping_cost['. $loop .']', 'label' =>'Termék szállítási költsége', 'placeholder' => 'Termék szállítási költsége', 'desc_tip' => 'true', 'description' => 'A termékhez tartozó szálítási költség', 'value' => get_post_meta($variation->ID, 'shipping_cost', true) ) ); woocommerce_wp_text_input( array( 'id' => 'woo_prod_category['. $loop .']', 'label' =>'Terméknek megfelelő Árukereső kategória', 'placeholder' => 'Terméknek megfelelő Árukereső kategória', 'desc_tip' => 'true', 'description' => 'Amennyiben eltér weboldalunk kategória megnevezése az Árukeresőjétől, itt írhatjuk felül', 'value' => get_post_meta($variation->ID, 'woo_prod_category', true) ) ); echo "
"; } function waruk_save_fields($post_id) { $aruk_hide =$_POST["arukereso_hide"]; update_post_meta( $post_id, 'arukereso_hide', esc_attr( $aruk_hide ) ); update_post_meta( $post_id, 'waruk_prod_name', esc_attr( $_POST["waruk_prod_name"] ) ); update_post_meta( $post_id, 'manufacturer', esc_attr( $_POST["manufacturer"] ) ); update_post_meta( $post_id, 'ean_code', esc_attr( $_POST["ean_code"] ) ); update_post_meta( $post_id, 'shipping_cost', esc_attr( $_POST["shipping_cost"] ) ); update_post_meta( $post_id, 'shipping_time', esc_attr( $_POST["shipping_time"] ) ); update_post_meta( $post_id, 'woo_prod_category', esc_attr( $_POST["woo_prod_category"] ) ); } add_action( 'woocommerce_process_product_meta', 'waruk_save_fields' ); add_action( 'woocommerce_save_product_variation', 'save_variation_fields', 10, 2 ); function save_variation_fields ($variation_id, $i) { $aruk_hide =$_POST["arukereso_hide"][$i]; update_post_meta( $variation_id, 'arukereso_hide', esc_attr( $aruk_hide ) ); update_post_meta( $variation_id, 'waruk_prod_name', esc_attr( $_POST["waruk_prod_name"][$i] ) ); update_post_meta( $variation_id, 'manufacturer', esc_attr( $_POST["manufacturer"][$i] ) ); update_post_meta( $variation_id, 'ean_code', esc_attr( $_POST["ean_code"][$i] ) ); update_post_meta( $variation_id, 'shipping_cost', esc_attr( $_POST["shipping_cost"][$i] ) ); update_post_meta( $$variation_id, 'shipping_time', esc_attr( $_POST["shipping_time"][$i] ) ); update_post_meta( $variation_id, 'woo_prod_category', esc_attr( $_POST["woo_prod_category"][$i] ) ); } ?>