So far i've got this code, and does return back all category ids on same row. The plugin doesn't allow me to export those products, it gives me error on export. Just to let you know, i do not have a product with more categories, every product have only one category. My xml editor looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<offers>
<!-- BEGIN LOOP -->
<offer id="{ID}" available="true">
<URL>{Permalink}</URL>
<name>{Title}</name>
<price>{Sale Price}</price>
<oldprice>{Regular Price}</oldprice>
<picture>{Image URL}</picture>
<currencyID>RON</currencyID>
<vendor>Dealzz</vendor>
<CategoryID>{fb_product_group_id}</CategoryID>
<description>[wp_filter_nohtml_kses({Content})]</description>
<test>[get_my_prod_cat_ids($prod_id)]</test>
</offer>
<!-- END LOOP -->
</offers>
this function is inside of function editor:
<?php
function get_my_prod_cat_ids($prod_id) {
$terms = get_the_terms( $prod_id, 'product_cat' );
if($terms) {
foreach ($terms as $key => $term) {
$cats_ids_array[$key] = $term->term_id;
//To get only the first category (uncomment below)
break;
}
// to get an array replace below by: $output = $cats_ids_array;
$output = implode( ",", $cats_ids_array );
echo $output;
}
}
?>
</div>